Merge lp:~tpeeters/ubuntu-ui-toolkit/ap-use-qml-files into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 2069
Merged at revision: 2055
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/ap-use-qml-files
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 2077 lines (+1056/-659)
33 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py (+1/-2)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_checkbox.qml (+31/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_switch.qml (+31/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.py (+13/-41)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_common.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.DatePickerBaseTestCase.qml (+72/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py (+7/-60)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.IsFlickableTestCase.qml (+34/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.SwipeFlickableTestCase.qml (+83/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.UnityFlickableTestCase.qml (+31/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+18/-109)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.IsFlickableTestCase.qml (+35/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.SwipeFlickableTestCase.qml (+62/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.UnityFlickableTestCase.qml (+30/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.py (+18/-90)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.SwipeToDeleteTestCase.qml (+79/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py (+6/-68)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_header.qml (+48/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_toolbar.qml (+48/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView10TestCase.qml (+24/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView12TestCase.qml (+24/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.py (+25/-67)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorCustomDelegateTestCase.qml (+60/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorTestCase.qml (+42/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.py (+14/-78)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml (+52/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py (+6/-40)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.QQuickListViewOutOfViewTestCase.qml (+62/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py (+5/-49)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.TextAreaTestCase.qml (+30/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py (+7/-18)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.ToolbarTestCase.qml (+49/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.py (+7/-37)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/ap-use-qml-files
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zoltan Balogh Approve
Review via email: mp+302471@code.launchpad.net

Commit message

Use external QML files instead of embedded QML strings for autopilot tests.

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

good

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py 2016-06-21 05:51:15 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py 2016-08-09 21:14:31 +0000
@@ -98,8 +98,7 @@
98 self.pointing_device.click_object(button)98 self.pointing_device.click_object(button)
9999
100 def _get_button(self, object_name):100 def _get_button(self, object_name):
101 return self.select_single(101 return self.select_single(objectName=object_name)
102 'UbuntuToolkit::UCActionItem', objectName=object_name)
103102
104 @autopilot_logging.log_action(logger.info)103 @autopilot_logging.log_action(logger.info)
105 def click_back_button(self):104 def click_back_button(self):
106105
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_checkbox.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_checkbox.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_checkbox.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,31 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24
25 Item {
26 CheckBox {
27 checked: false
28 objectName: "test_checkbox"
29 }
30 }
31}
032
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_switch.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_switch.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_switch.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,31 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24
25 Item {
26 Switch {
27 checked: false
28 objectName: "test_switch"
29 }
30 }
31}
032
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.py 2016-08-09 21:14:31 +0000
@@ -15,6 +15,7 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import time17import time
18import os
1819
19from autopilot import input20from autopilot import input
20from testtools.matchers import GreaterThan, LessThan21from testtools.matchers import GreaterThan, LessThan
@@ -24,51 +25,22 @@
24from ubuntuuitoolkit import tests25from ubuntuuitoolkit import tests
2526
2627
27TEST_QML_WITH_CHECKBOX = ("""28class ToggleTestCase(tests.QMLFileAppTestCase):
28import QtQuick 2.029
29import Ubuntu.Components 1.030 path = os.path.abspath(__file__)
3031 dir_path = os.path.dirname(path)
31MainView {32 switch_test_qml_file_path = os.path.join(
32 width: units.gu(48)33 dir_path, 'test_checkbox.ToggleTestCase.test_with_switch.qml')
33 height: units.gu(60)34 checkbox_test_qml_file_path = os.path.join(
34 objectName: "mainView"35 dir_path, 'test_checkbox.ToggleTestCase.test_with_checkbox.qml')
35
36 Item {
37 CheckBox {
38 checked: false
39 objectName: "test_checkbox"
40 }
41 }
42}
43""")
44
45
46TEST_QML_WITH_SWITCH = ("""
47import QtQuick 2.0
48import Ubuntu.Components 1.0
49
50MainView {
51 width: units.gu(48)
52 height: units.gu(60)
53 objectName: "mainView"
54
55 Item {
56 Switch {
57 checked: false
58 objectName: "test_switch"
59 }
60 }
61}
62""")
63
64
65class ToggleTestCase(tests.QMLStringAppTestCase):
6636
67 scenarios = [37 scenarios = [
68 ('checkbox', dict(38 ('checkbox', dict(
69 test_qml=TEST_QML_WITH_CHECKBOX, objectName='test_checkbox')),39 test_qml_file_path=checkbox_test_qml_file_path,
40 objectName='test_checkbox')),
70 ('switch', dict(41 ('switch', dict(
71 test_qml=TEST_QML_WITH_SWITCH, objectName='test_switch'))42 test_qml_file_path=switch_test_qml_file_path,
43 objectName='test_switch'))
72 ]44 ]
7345
74 def setUp(self):46 def setUp(self):
7547
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_common.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_common.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_common.py 2016-08-09 21:14:31 +0000
@@ -41,6 +41,8 @@
41 ubuntuuitoolkit.check_autopilot_version()41 ubuntuuitoolkit.check_autopilot_version()
4242
4343
44# FIXME: this class is not used anywhere, and QMLStringAppTestCase subclasses
45# no longer work (see bug 1578319), so the code below can be deleted.
44class UbuntuUIToolkitCustomProxyObjectBaseTestCase(tests.QMLStringAppTestCase):46class UbuntuUIToolkitCustomProxyObjectBaseTestCase(tests.QMLStringAppTestCase):
4547
46 def test_pointing_device(self):48 def test_pointing_device(self):
4749
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.DatePickerBaseTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.DatePickerBaseTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.DatePickerBaseTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.1
19import Ubuntu.Components.Pickers 1.0
20
21MainView {
22 width: units.gu(48)
23 height: units.gu(60)
24 objectName: "mainView"
25
26 Column {
27 DatePicker {
28 id: datePicker
29 objectName: 'datePicker'
30 mode: 'Years|Months|Days'
31 maximum: {
32 var d = new Date()
33 d.setFullYear('2030')
34 return d
35 }
36 minimum: {
37 var d = new Date()
38 d.setFullYear('1990')
39 return d
40 }
41 date: {
42 var d = new Date()
43 d.setFullYear('2010')
44 d.setMonth('5')
45 d.setDate('15')
46 return d
47 }
48 }
49 DatePicker {
50 id: timePicker
51 objectName: 'timePicker'
52 mode: 'Hours|Minutes|Seconds'
53 maximum: {
54 var d = new Date()
55 d.setFullYear('2030')
56 return d
57 }
58 minimum: {
59 var d = new Date()
60 d.setFullYear('1990')
61 return d
62 }
63 date: {
64 var d = new Date()
65 d.setHours(12)
66 d.setMinutes('30')
67 d.setSeconds('30')
68 return d
69 }
70 }
71 }
72}
073
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2016-08-09 21:14:31 +0000
@@ -14,72 +14,19 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
17import datetime18import datetime
1819
19import ubuntuuitoolkit20import ubuntuuitoolkit
20from ubuntuuitoolkit import pickers, tests21from ubuntuuitoolkit import pickers, tests
2122
2223
23class DatePickerBaseTestCase(tests.QMLStringAppTestCase):24class DatePickerBaseTestCase(tests.QMLFileAppTestCase):
2425
25 test_qml = ("""26 path = os.path.abspath(__file__)
26import QtQuick 2.027 dir_path = os.path.dirname(path)
27import Ubuntu.Components 1.128 test_qml_file_path = os.path.join(
28import Ubuntu.Components.Pickers 1.029 dir_path, 'test_date_picker.DatePickerBaseTestCase.qml')
29
30MainView {
31 width: units.gu(48)
32 height: units.gu(60)
33 objectName: "mainView"
34
35 Column {
36 DatePicker {
37 id: datePicker
38 objectName: 'datePicker'
39 mode: 'Years|Months|Days'
40 maximum: {
41 var d = new Date()
42 d.setFullYear('2030')
43 return d
44 }
45 minimum: {
46 var d = new Date()
47 d.setFullYear('1990')
48 return d
49 }
50 date: {
51 var d = new Date()
52 d.setFullYear('2010')
53 d.setMonth('5')
54 d.setDate('15')
55 return d
56 }
57 }
58 DatePicker {
59 id: timePicker
60 objectName: 'timePicker'
61 mode: 'Hours|Minutes|Seconds'
62 maximum: {
63 var d = new Date()
64 d.setFullYear('2030')
65 return d
66 }
67 minimum: {
68 var d = new Date()
69 d.setFullYear('1990')
70 return d
71 }
72 date: {
73 var d = new Date()
74 d.setHours(12)
75 d.setMinutes('30')
76 d.setSeconds('30')
77 return d
78 }
79 }
80 }
81}
82""")
8330
84 def setUp(self):31 def setUp(self):
85 super().setUp()32 super().setUp()
8633
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.IsFlickableTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.IsFlickableTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.IsFlickableTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19
20MainView {
21 objectName: 'mainView'
22 width: units.gu(48)
23 height: units.gu(60)
24
25 Flickable {
26 objectName: 'flickable'
27 }
28 ListView {
29 objectName: 'listView'
30 }
31 Label {
32 objectName: 'label'
33 }
34}
035
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.SwipeFlickableTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.SwipeFlickableTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.SwipeFlickableTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,83 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24
25 Label {
26 id: clickedLabel
27 objectName: "clickedLabel"
28 text: "No element clicked."
29 }
30
31 Flickable {
32 anchors {
33 fill: parent
34 topMargin: clickedLabel.height
35 }
36 objectName: 'flickable'
37 height: units.gu(60)
38 contentHeight: bottomButton.y + bottomButton.height
39 contentWidth: topRightButton.x +
40 Math.max(topRightButton.width, bottomRightButton.width)
41
42 Button {
43 id: topButton
44 objectName: 'topButton'
45 text: 'Top button'
46 onClicked: clickedLabel.text = objectName
47 }
48 Rectangle {
49 id: emptyRectangle
50 width: units.gu(70)
51 height: units.gu(80)
52 anchors.top: topButton.bottom
53 }
54 Button {
55 id: bottomButton
56 objectName: 'bottomButton'
57 text: 'Bottom button'
58 onClicked: clickedLabel.text = objectName
59 anchors.top: emptyRectangle.bottom
60 }
61 Button {
62 id: topRightButton
63 objectName: 'topRightButton'
64 text: 'Top-right button'
65 onClicked: clickedLabel.text = objectName
66 anchors {
67 top: parent.top
68 left: emptyRectangle.right
69 }
70 }
71 Button {
72 id: bottomRightButton
73 objectName: 'bottomRightButton'
74 text: 'Bottom-right button'
75 onClicked: clickedLabel.text = objectName
76 anchors {
77 top: emptyRectangle.bottom
78 left: emptyRectangle.right
79 }
80 }
81 }
82}
83
084
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.UnityFlickableTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.UnityFlickableTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.UnityFlickableTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,31 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: 'mainView'
24
25 Flickable {
26 objectName: 'testFlickable'
27 width: 200; height: 200
28 contentWidth: image.width; contentHeight: image.height
29 }
30}
31
032
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2016-01-18 14:51:22 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2016-08-09 21:14:31 +0000
@@ -16,6 +16,7 @@
1616
17from unittest import mock17from unittest import mock
1818
19import os
19import testtools20import testtools
20import ubuntuuitoolkit21import ubuntuuitoolkit
21from ubuntuuitoolkit import (22from ubuntuuitoolkit import (
@@ -49,7 +50,7 @@
49 self.assertFalse(element.is_flickable())50 self.assertFalse(element.is_flickable())
5051
5152
52class IsFlickableTestCase(tests.QMLStringAppTestCase):53class IsFlickableTestCase(tests.QMLFileAppTestCase):
53 """Functional test to check that is_flickable returns the right value.54 """Functional test to check that is_flickable returns the right value.
5455
55 We already have tests for is_flickable with mocks, so here we just check56 We already have tests for is_flickable with mocks, so here we just check
@@ -57,26 +58,10 @@
5758
58 """59 """
5960
60 test_qml = ("""61 path = os.path.abspath(__file__)
61import QtQuick 2.462 dir_path = os.path.dirname(path)
62import Ubuntu.Components 1.363 test_qml_file_path = os.path.join(
6364 dir_path, 'test_flickable.IsFlickableTestCase.qml')
64MainView {
65 objectName: 'mainView'
66 width: units.gu(48)
67 height: units.gu(60)
68
69 Flickable {
70 objectName: 'flickable'
71 }
72 ListView {
73 objectName: 'listView'
74 }
75 Label {
76 objectName: 'label'
77 }
78}
79""")
8065
81 scenarios = [66 scenarios = [
82 ('main view', dict(object_name='mainView', is_flickable=False)),67 ('main view', dict(object_name='mainView', is_flickable=False)),
@@ -93,76 +78,12 @@
9378
94# FIXME: Only left-to-right (where x=0 is leftmost) layouts are taken into79# FIXME: Only left-to-right (where x=0 is leftmost) layouts are taken into
95# account. Add support for horizontal flicking with right-to-left layouts.80# account. Add support for horizontal flicking with right-to-left layouts.
96class SwipeFlickableTestCase(tests.QMLStringAppTestCase):81class SwipeFlickableTestCase(tests.QMLFileAppTestCase):
9782
98 test_qml = ("""83 path = os.path.abspath(__file__)
99import QtQuick 2.484 dir_path = os.path.dirname(path)
100import Ubuntu.Components 1.385 test_qml_file_path = os.path.join(
10186 dir_path, 'test_flickable.SwipeFlickableTestCase.qml')
102MainView {
103 width: units.gu(48)
104 height: units.gu(60)
105 objectName: "mainView"
106
107 Label {
108 id: clickedLabel
109 objectName: "clickedLabel"
110 text: "No element clicked."
111 }
112
113 Flickable {
114 anchors {
115 fill: parent
116 topMargin: clickedLabel.height
117 }
118 objectName: 'flickable'
119 height: units.gu(60)
120 contentHeight: bottomButton.y + bottomButton.height
121 contentWidth: topRightButton.x +
122 Math.max(topRightButton.width, bottomRightButton.width)
123
124 Button {
125 id: topButton
126 objectName: 'topButton'
127 text: 'Top button'
128 onClicked: clickedLabel.text = objectName
129 }
130 Rectangle {
131 id: emptyRectangle
132 width: units.gu(70)
133 height: units.gu(80)
134 anchors.top: topButton.bottom
135 }
136 Button {
137 id: bottomButton
138 objectName: 'bottomButton'
139 text: 'Bottom button'
140 onClicked: clickedLabel.text = objectName
141 anchors.top: emptyRectangle.bottom
142 }
143 Button {
144 id: topRightButton
145 objectName: 'topRightButton'
146 text: 'Top-right button'
147 onClicked: clickedLabel.text = objectName
148 anchors {
149 top: parent.top
150 left: emptyRectangle.right
151 }
152 }
153 Button {
154 id: bottomRightButton
155 objectName: 'bottomRightButton'
156 text: 'Bottom-right button'
157 onClicked: clickedLabel.text = objectName
158 anchors {
159 top: emptyRectangle.bottom
160 left: emptyRectangle.right
161 }
162 }
163 }
164}
165""")
16687
167 def setUp(self):88 def setUp(self):
168 super().setUp()89 super().setUp()
@@ -393,24 +314,12 @@
393 self.assertEqual('Could not swipe in the flickable.', str(error))314 self.assertEqual('Could not swipe in the flickable.', str(error))
394315
395316
396class UnityFlickableTestCase(tests.QMLStringAppTestCase):317class UnityFlickableTestCase(tests.QMLFileAppTestCase):
397318
398 test_qml = ("""319 path = os.path.abspath(__file__)
399import QtQuick 2.4320 dir_path = os.path.dirname(path)
400import Ubuntu.Components 1.3321 test_qml_file_path = os.path.join(
401322 dir_path, 'test_flickable.UnityFlickableTestCase.qml')
402MainView {
403 width: units.gu(48)
404 height: units.gu(60)
405 objectName: 'mainView'
406
407 Flickable {
408 objectName: 'testFlickable'
409 width: 200; height: 200
410 contentWidth: image.width; contentHeight: image.height
411 }
412}
413""")
414323
415 def get_command_line(self, command_line):324 def get_command_line(self, command_line):
416 command_line.append('-engine')325 command_line.append('-engine')
417326
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.IsFlickableTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.IsFlickableTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.IsFlickableTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,35 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19import Ubuntu.Components.ListItems 1.0 as ListItem
20
21MainView {
22 objectName: 'mainView'
23 width: units.gu(48)
24 height: units.gu(60)
25
26 Flickable {
27 objectName: 'flickable'
28 }
29 ListView {
30 objectName: 'listView'
31 }
32 Label {
33 objectName: 'label'
34 }
35}
036
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.SwipeFlickableTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.SwipeFlickableTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.SwipeFlickableTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24
25 Label {
26 id: clickedLabel
27 objectName: "clickedLabel"
28 text: "No element clicked."
29 }
30
31 Flickable {
32 anchors {
33 fill: parent
34 topMargin: clickedLabel.height
35 // It can't be at the bottom, or the toolbar will be opened
36 // when we try to click it.
37 bottomMargin: units.gu(10)
38 }
39 objectName: 'flickable'
40 height: units.gu(60)
41 contentHeight: bottomButton.y + bottomButton.height
42
43 Button {
44 id: topButton
45 objectName: 'topButton'
46 text: 'Top button'
47 onClicked: clickedLabel.text = objectName
48 }
49 Rectangle {
50 id: emptyRectangle
51 height: units.gu(80)
52 anchors.top: topButton.bottom
53 }
54 Button {
55 id: bottomButton
56 objectName: 'bottomButton'
57 text: 'Bottom button'
58 onClicked: clickedLabel.text = objectName
59 anchors.top: emptyRectangle.bottom
60 }
61 }
62}
063
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.UnityFlickableTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.UnityFlickableTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.UnityFlickableTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,30 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: 'mainView'
24
25 Flickable {
26 objectName: 'testFlickable'
27 width: 200; height: 200
28 contentWidth: image.width; contentHeight: image.height
29 }
30}
031
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.py 2016-01-18 15:39:13 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.py 2016-08-09 21:14:31 +0000
@@ -15,6 +15,7 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17from unittest import mock17from unittest import mock
18import os
1819
19import testtools20import testtools
20import ubuntuuitoolkit21import ubuntuuitoolkit
@@ -49,7 +50,7 @@
49 self.assertFalse(element.is_flickable())50 self.assertFalse(element.is_flickable())
5051
5152
52class IsFlickableTestCase(tests.QMLStringAppTestCase):53class IsFlickableTestCase(tests.QMLFileAppTestCase):
53 """Functional test to check that is_flickable returns the right value.54 """Functional test to check that is_flickable returns the right value.
5455
55 We already have tests for is_flickable with mocks, so here we just check56 We already have tests for is_flickable with mocks, so here we just check
@@ -57,27 +58,10 @@
5758
58 """59 """
5960
60 test_qml = ("""61 path = os.path.abspath(__file__)
61import QtQuick 2.062 dir_path = os.path.dirname(path)
62import Ubuntu.Components 1.063 test_qml_file_path = os.path.join(
63import Ubuntu.Components.ListItems 1.0 as ListItem64 dir_path, 'test_flickable_uitk10.IsFlickableTestCase.qml')
64
65MainView {
66 objectName: 'mainView'
67 width: units.gu(48)
68 height: units.gu(60)
69
70 Flickable {
71 objectName: 'flickable'
72 }
73 ListView {
74 objectName: 'listView'
75 }
76 Label {
77 objectName: 'label'
78 }
79}
80""")
8165
82 scenarios = [66 scenarios = [
83 ('main view', dict(object_name='mainView', is_flickable=False)),67 ('main view', dict(object_name='mainView', is_flickable=False)),
@@ -92,56 +76,12 @@
92 self.assertEqual(element.is_flickable(), self.is_flickable)76 self.assertEqual(element.is_flickable(), self.is_flickable)
9377
9478
95class SwipeFlickableTestCase(tests.QMLStringAppTestCase):79class SwipeFlickableTestCase(tests.QMLFileAppTestCase):
9680
97 test_qml = ("""81 path = os.path.abspath(__file__)
98import QtQuick 2.082 dir_path = os.path.dirname(path)
99import Ubuntu.Components 1.083 test_qml_file_path = os.path.join(
10084 dir_path, 'test_flickable_uitk10.SwipeFlickableTestCase.qml')
101MainView {
102 width: units.gu(48)
103 height: units.gu(60)
104 objectName: "mainView"
105
106 Label {
107 id: clickedLabel
108 objectName: "clickedLabel"
109 text: "No element clicked."
110 }
111
112 Flickable {
113 anchors {
114 fill: parent
115 topMargin: clickedLabel.height
116 // It can't be at the bottom, or the toolbar will be opened
117 // when we try to click it.
118 bottomMargin: units.gu(10)
119 }
120 objectName: 'flickable'
121 height: units.gu(60)
122 contentHeight: bottomButton.y + bottomButton.height
123
124 Button {
125 id: topButton
126 objectName: 'topButton'
127 text: 'Top button'
128 onClicked: clickedLabel.text = objectName
129 }
130 Rectangle {
131 id: emptyRectangle
132 height: units.gu(80)
133 anchors.top: topButton.bottom
134 }
135 Button {
136 id: bottomButton
137 objectName: 'bottomButton'
138 text: 'Bottom button'
139 onClicked: clickedLabel.text = objectName
140 anchors.top: emptyRectangle.bottom
141 }
142 }
143}
144""")
14585
146 def setUp(self):86 def setUp(self):
147 super().setUp()87 super().setUp()
@@ -271,24 +211,12 @@
271 self.assertEqual('Could not swipe in the flickable.', str(error))211 self.assertEqual('Could not swipe in the flickable.', str(error))
272212
273213
274class UnityFlickableTestCase(tests.QMLStringAppTestCase):214class UnityFlickableTestCase(tests.QMLFileAppTestCase):
275215
276 test_qml = ("""216 path = os.path.abspath(__file__)
277import QtQuick 2.0217 dir_path = os.path.dirname(path)
278import Ubuntu.Components 1.0218 test_qml_file_path = os.path.join(
279219 dir_path, 'test_flickable_uitk10.UnityFlickableTestCase.qml')
280MainView {
281 width: units.gu(48)
282 height: units.gu(60)
283 objectName: 'mainView'
284
285 Flickable {
286 objectName: 'testFlickable'
287 width: 200; height: 200
288 contentWidth: image.width; contentHeight: image.height
289 }
290}
291""")
292220
293 def get_command_line(self, command_line):221 def get_command_line(self, command_line):
294 command_line.append('-engine')222 command_line.append('-engine')
295223
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.SwipeToDeleteTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.SwipeToDeleteTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.SwipeToDeleteTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,79 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19import Ubuntu.Components.ListItems 1.0
20
21MainView {
22 width: units.gu(48)
23 height: units.gu(60)
24 objectName: "mainView"
25
26 Page {
27
28 ListModel {
29 id: testModel
30
31 ListElement {
32 name: "listitem_destroyed_on_remove_with_confirm"
33 label: "Item destroyed on remove with confirmation"
34 confirm: true
35 }
36 ListElement {
37 name: "listitem_destroyed_on_remove_without_confirm"
38 label: "Item destroyed on remove without confirmation"
39 confirm: false
40 }
41 }
42
43 Column {
44 anchors { fill: parent }
45
46 Standard {
47 objectName: "listitem_standard"
48 confirmRemoval: true
49 removable: true
50 text: 'Slide to remove'
51 }
52
53 Empty {
54 objectName: "listitem_empty"
55 }
56
57 Standard {
58 objectName: "listitem_without_confirm"
59 confirmRemoval: false
60 removable: true
61 text: "Item without delete confirmation"
62 }
63
64 ListView {
65 anchors { left: parent.left; right: parent.right }
66 height: childrenRect.height
67 model: testModel
68
69 delegate: Standard {
70 removable: true
71 confirmRemoval: confirm
72 onItemRemoved: testModel.remove(index)
73 text: label
74 objectName: name
75 }
76 }
77 }
78 }
79}
080
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2016-08-09 21:14:31 +0000
@@ -48,74 +48,12 @@
48 listitems.Subtitled, listitems.Base))48 listitems.Subtitled, listitems.Base))
4949
5050
51class SwipeToDeleteTestCase(tests.QMLStringAppTestCase):51class SwipeToDeleteTestCase(tests.QMLFileAppTestCase):
5252
53 test_qml = ("""53 path = os.path.abspath(__file__)
54import QtQuick 2.054 dir_path = os.path.dirname(path)
55import Ubuntu.Components 1.055 test_qml_file_path = os.path.join(
56import Ubuntu.Components.ListItems 1.056 dir_path, 'test_listitems.SwipeToDeleteTestCase.qml')
57
58
59MainView {
60 width: units.gu(48)
61 height: units.gu(60)
62 objectName: "mainView"
63
64 Page {
65
66 ListModel {
67 id: testModel
68
69 ListElement {
70 name: "listitem_destroyed_on_remove_with_confirm"
71 label: "Item destroyed on remove with confirmation"
72 confirm: true
73 }
74 ListElement {
75 name: "listitem_destroyed_on_remove_without_confirm"
76 label: "Item destroyed on remove without confirmation"
77 confirm: false
78 }
79 }
80
81 Column {
82 anchors { fill: parent }
83
84 Standard {
85 objectName: "listitem_standard"
86 confirmRemoval: true
87 removable: true
88 text: 'Slide to remove'
89 }
90
91 Empty {
92 objectName: "listitem_empty"
93 }
94
95 Standard {
96 objectName: "listitem_without_confirm"
97 confirmRemoval: false
98 removable: true
99 text: "Item without delete confirmation"
100 }
101
102 ListView {
103 anchors { left: parent.left; right: parent.right }
104 height: childrenRect.height
105 model: testModel
106
107 delegate: Standard {
108 removable: true
109 confirmRemoval: confirm
110 onItemRemoved: testModel.remove(index)
111 text: label
112 objectName: name
113 }
114 }
115 }
116 }
117}
118""")
11957
120 def setUp(self):58 def setUp(self):
121 super().setUp()59 super().setUp()
12260
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_header.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_header.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_header.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24 useDeprecatedToolbar: false
25
26 PageStack {
27 id: pageStack
28 Component.onCompleted: push(page0)
29
30 Page {
31 id: page0
32 title: "Page 0"
33 visible: false
34
35 Button {
36 objectName: "go_to_page1"
37 text: "Go to page 1"
38 onClicked: pageStack.push(page1)
39 }
40 }
41
42 Page {
43 id: page1
44 title: "Page 1"
45 visible: false
46 }
47 }
48}
049
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_toolbar.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_toolbar.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_toolbar.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24 useDeprecatedToolbar: true
25
26 PageStack {
27 id: pageStack
28 Component.onCompleted: push(page0)
29
30 Page {
31 id: page0
32 title: "Page 0"
33 visible: false
34
35 Button {
36 objectName: "go_to_page1"
37 text: "Go to page 1"
38 onClicked: pageStack.push(page1)
39 }
40 }
41
42 Page {
43 id: page1
44 title: "Page 1"
45 visible: false
46 }
47 }
48}
049
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView10TestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView10TestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView10TestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24}
025
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView12TestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView12TestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView12TestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.3
18import Ubuntu.Components 1.2
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24}
025
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.py 2015-09-22 15:56:35 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.py 2016-08-09 21:14:31 +0000
@@ -14,24 +14,19 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
17from unittest import mock18from unittest import mock
1819
19import ubuntuuitoolkit20import ubuntuuitoolkit
20from ubuntuuitoolkit import tests21from ubuntuuitoolkit import tests
2122
2223
23class MainView10TestCase(tests.QMLStringAppTestCase):24class MainView10TestCase(tests.QMLFileAppTestCase):
2425
25 test_qml = ("""26 path = os.path.abspath(__file__)
26import QtQuick 2.027 dir_path = os.path.dirname(path)
27import Ubuntu.Components 1.028 test_qml_file_path = os.path.join(
2829 dir_path, 'test_main_view.MainView10TestCase.qml')
29MainView {
30 width: units.gu(48)
31 height: units.gu(60)
32 objectName: "mainView"
33}
34""")
3530
36 def test_main_view_custom_proxy_object(self):31 def test_main_view_custom_proxy_object(self):
37 self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView)32 self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView)
@@ -75,18 +70,12 @@
75 str(error), 'The MainView has no Tabs.')70 str(error), 'The MainView has no Tabs.')
7671
7772
78class MainView12TestCase(tests.QMLStringAppTestCase):73class MainView12TestCase(tests.QMLFileAppTestCase):
7974
80 test_qml = ("""75 path = os.path.abspath(__file__)
81import QtQuick 2.376 dir_path = os.path.dirname(path)
82import Ubuntu.Components 1.277 test_qml_file_path = os.path.join(
8378 dir_path, 'test_main_view.MainView12TestCase.qml')
84MainView {
85 width: units.gu(48)
86 height: units.gu(60)
87 objectName: "mainView"
88}
89""")
9079
91 def test_main_view_custom_proxy_object(self):80 def test_main_view_custom_proxy_object(self):
92 self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView)81 self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView)
@@ -128,51 +117,20 @@
128 str(error), 'The MainView has no Toolbar.')117 str(error), 'The MainView has no Toolbar.')
129118
130119
131TEST_GO_BACK_QML_FORMAT = ("""120class GoBackTestCase(tests.QMLFileAppTestCase):
132import QtQuick 2.0121
133import Ubuntu.Components 1.0122 path = os.path.abspath(__file__)
134123 dir_path = os.path.dirname(path)
135MainView {{124 toolbar_test_qml_file_path = os.path.join(
136 width: units.gu(48)125 dir_path, 'test_main_view.GoBackTestCase.back_in_toolbar.qml')
137 height: units.gu(60)126 header_test_qml_file_path = os.path.join(
138 objectName: "mainView"127 dir_path, 'test_main_view.GoBackTestCase.back_in_header.qml')
139 useDeprecatedToolbar: {use_deprecated_toolbar}
140
141 PageStack {{
142 id: pageStack
143 Component.onCompleted: push(page0)
144
145 Page {{
146 id: page0
147 title: "Page 0"
148 visible: false
149
150 Button {{
151 objectName: "go_to_page1"
152 text: "Go to page 1"
153 onClicked: pageStack.push(page1)
154 }}
155 }}
156
157 Page {{
158 id: page1
159 title: "Page 1"
160 visible: false
161 }}
162 }}
163}}
164""")
165
166
167class GoBackTestCase(tests.QMLStringAppTestCase):
168128
169 scenarios = [129 scenarios = [
170 ('back in toolbar', dict(130 ('back_in_toolbar', dict(
171 test_qml=TEST_GO_BACK_QML_FORMAT.format(131 test_qml_file_path=toolbar_test_qml_file_path)),
172 use_deprecated_toolbar='true'))),132 ('back_in_header', dict(
173 ('back in header', dict(133 test_qml_file_path=header_test_qml_file_path))
174 test_qml=TEST_GO_BACK_QML_FORMAT.format(
175 use_deprecated_toolbar='false')))
176 ]134 ]
177135
178 def setUp(self):136 def setUp(self):
179137
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorCustomDelegateTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorCustomDelegateTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorCustomDelegateTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,60 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24
25 Page{
26
27 Column {
28 anchors.left: parent.left
29 anchors.right: parent.right
30 anchors.fill: parent
31
32 spacing: units.gu(3)
33
34 Component {
35 id: valueSelectorDelegate
36 OptionSelectorDelegate {
37 text: label
38 objectName: name
39 }
40 }
41
42 ListModel {
43 id: valueModel
44 ListElement { name: "one"; label: "Value 1" }
45 ListElement { name: "two"; label: "Value 2" }
46 ListElement { name: "three"; label: "Value 3" }
47 ListElement { name: "four"; label: "Value 4" }
48 ListElement { name: "five"; label: "Value 5" }
49 }
50
51 OptionSelector {
52 id: valueSelector
53 objectName: "test_option_selector_collapsed"
54 text: "Collapsed"
55 delegate: valueSelectorDelegate
56 model: valueModel
57 }
58 }
59 }
60}
061
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(120)
23 objectName: "mainView"
24
25 Column {
26 anchors.fill: parent
27 anchors.left: parent.left
28 anchors.right: parent.right
29 spacing: units.gu(3)
30
31 OptionSelector {
32 objectName: "option_selector"
33 text: i18n.tr("option_selector")
34 expanded: true
35 model: [i18n.tr("Red"),
36 i18n.tr("Blue"),
37 i18n.tr("Green"),
38 i18n.tr("Yellow"),
39 i18n.tr("Black")]
40 }
41 }
42}
043
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.py 2016-08-09 21:14:31 +0000
@@ -14,58 +14,18 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
17import ubuntuuitoolkit18import ubuntuuitoolkit
18from ubuntuuitoolkit import tests19from ubuntuuitoolkit import tests
1920
2021
21class OptionSelectorCustomDelegateTestCase(tests.QMLStringAppTestCase):22class OptionSelectorCustomDelegateTestCase(tests.QMLFileAppTestCase):
2223
23 test_qml = ("""24 path = os.path.abspath(__file__)
24import QtQuick 2.025 dir_path = os.path.dirname(path)
25import Ubuntu.Components 1.026 test_qml_file_path = os.path.join(
2627 dir_path,
27MainView {28 'test_optionselector.OptionSelectorCustomDelegateTestCase.qml')
28 width: units.gu(48)
29 height: units.gu(60)
30 objectName: "mainView"
31
32 Page{
33
34 Column {
35 anchors.left: parent.left
36 anchors.right: parent.right
37 anchors.fill: parent
38
39 spacing: units.gu(3)
40
41 Component {
42 id: valueSelectorDelegate
43 OptionSelectorDelegate {
44 text: label
45 objectName: name
46 }
47 }
48
49 ListModel {
50 id: valueModel
51 ListElement { name: "one"; label: "Value 1" }
52 ListElement { name: "two"; label: "Value 2" }
53 ListElement { name: "three"; label: "Value 3" }
54 ListElement { name: "four"; label: "Value 4" }
55 ListElement { name: "five"; label: "Value 5" }
56 }
57
58 OptionSelector {
59 id: valueSelector
60 objectName: "test_option_selector_collapsed"
61 text: "Collapsed"
62 delegate: valueSelectorDelegate
63 model: valueModel
64 }
65 }
66 }
67}
68""")
6929
70 def setUp(self):30 def setUp(self):
71 super().setUp()31 super().setUp()
@@ -119,36 +79,12 @@
119 self.assertEqual(2, self.option_selector.selectedIndex)79 self.assertEqual(2, self.option_selector.selectedIndex)
12080
12181
122class OptionSelectorTestCase(tests.QMLStringAppTestCase):82class OptionSelectorTestCase(tests.QMLFileAppTestCase):
12383
124 test_qml = ("""84 path = os.path.abspath(__file__)
125import QtQuick 2.085 dir_path = os.path.dirname(path)
126import Ubuntu.Components 1.086 test_qml_file_path = os.path.join(
12787 dir_path, 'test_optionselector.OptionSelectorTestCase.qml')
128MainView {
129 width: units.gu(48)
130 height: units.gu(120)
131 objectName: "mainView"
132
133 Column {
134 anchors.fill: parent
135 anchors.left: parent.left
136 anchors.right: parent.right
137 spacing: units.gu(3)
138
139 OptionSelector {
140 objectName: "option_selector"
141 text: i18n.tr("option_selector")
142 expanded: true
143 model: [i18n.tr("Red"),
144 i18n.tr("Blue"),
145 i18n.tr("Green"),
146 i18n.tr("Yellow"),
147 i18n.tr("Black")]
148 }
149 }
150}
151""")
15288
153 def setUp(self):89 def setUp(self):
154 super().setUp()90 super().setUp()
15591
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19import Ubuntu.Components.Popups 1.0
20
21MainView {
22 width: units.gu(48)
23 height: units.gu(60)
24 objectName: "mainView"
25
26 Button {
27 objectName: "openComposerSheetButton"
28 text: "Open Composer Sheet"
29 onClicked: PopupUtils.open(testComposerSheet);
30 }
31
32 Label {
33 id: "label"
34 objectName: "actionLabel"
35 anchors.centerIn: parent
36 text: "No action taken."
37 }
38
39 Component {
40 id: testComposerSheet
41 ComposerSheet {
42 id: sheet
43 objectName: "testComposerSheet"
44 onCancelClicked: {
45 label.text = "Cancel selected."
46 }
47 onConfirmClicked: {
48 label.text = "Confirm selected."
49 }
50 }
51 }
52}
053
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-09-30 15:10:11 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2016-08-09 21:14:31 +0000
@@ -110,46 +110,12 @@
110 str(error), 'The popover is not open.')110 str(error), 'The popover is not open.')
111111
112112
113class ComposerSheetTestCase(tests.QMLStringAppTestCase):113class ComposerSheetTestCase(tests.QMLFileAppTestCase):
114114
115 test_qml = ("""115 path = os.path.abspath(__file__)
116import QtQuick 2.0116 dir_path = os.path.dirname(path)
117import Ubuntu.Components 1.0117 test_qml_file_path = os.path.join(
118import Ubuntu.Components.Popups 1.0118 dir_path, 'test_popups.ComposerSheetTestCase.qml')
119
120MainView {
121 width: units.gu(48)
122 height: units.gu(60)
123 objectName: "mainView"
124
125 Button {
126 objectName: "openComposerSheetButton"
127 text: "Open Composer Sheet"
128 onClicked: PopupUtils.open(testComposerSheet);
129 }
130
131 Label {
132 id: "label"
133 objectName: "actionLabel"
134 anchors.centerIn: parent
135 text: "No action taken."
136 }
137
138 Component {
139 id: testComposerSheet
140 ComposerSheet {
141 id: sheet
142 objectName: "testComposerSheet"
143 onCancelClicked: {
144 label.text = "Cancel selected."
145 }
146 onConfirmClicked: {
147 label.text = "Confirm selected."
148 }
149 }
150 }
151}
152""")
153119
154 def setUp(self):120 def setUp(self):
155 super().setUp()121 super().setUp()
156122
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.QQuickListViewOutOfViewTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.QQuickListViewOutOfViewTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.QQuickListViewOutOfViewTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19import Ubuntu.Components.ListItems 1.0 as ListItem
20
21MainView {
22 width: units.gu(48)
23 height: units.gu(20)
24 objectName: "mainView"
25
26 Page {
27
28 Flickable {
29
30 Column {
31 id: column
32 width: units.gu(48)
33 // The column height is greater than the main view height, so
34 // the bottom of the list is out of view.
35 height: units.gu(40)
36
37 Label {
38 id: clickedLabel
39 objectName: "clickedLabel"
40 text: "No element clicked."
41 }
42
43 ListView {
44 id: testListView
45 objectName: "testListView"
46 anchors.left: parent.left
47 anchors.right: parent.right
48 height: column.height - clickedLabel.paintedHeight
49 clip: true
50 model: 20
51
52 delegate: ListItem.Standard {
53 objectName: "testListElement%1".arg(index)
54 text: "test list element %1".arg(index)
55 onClicked: clickedLabel.text = objectName
56 height: units.gu(5)
57 }
58 }
59 }
60 }
61 }
62}
063
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py 2016-01-20 17:35:53 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py 2016-08-09 21:14:31 +0000
@@ -150,57 +150,13 @@
150 str(error), 'List element with objectName "unexisting" not found.')150 str(error), 'List element with objectName "unexisting" not found.')
151151
152152
153class QQuickListViewOutOfViewTestCase(tests.QMLStringAppTestCase):153class QQuickListViewOutOfViewTestCase(tests.QMLFileAppTestCase):
154 """Test that we can make elements visible when the list is out of view."""154 """Test that we can make elements visible when the list is out of view."""
155155
156 test_qml = ("""156 path = os.path.abspath(__file__)
157import QtQuick 2.0157 dir_path = os.path.dirname(path)
158import Ubuntu.Components 1.0158 test_qml_file_path = os.path.join(
159import Ubuntu.Components.ListItems 1.0 as ListItem159 dir_path, 'test_qquicklistview.QQuickListViewOutOfViewTestCase.qml')
160
161MainView {
162 width: units.gu(48)
163 height: units.gu(20)
164 objectName: "mainView"
165
166 Page {
167
168 Flickable {
169
170 Column {
171 id: column
172 width: units.gu(48)
173 // The column height is greater than the main view height, so
174 // the bottom of the list is out of view.
175 height: units.gu(40)
176
177 Label {
178 id: clickedLabel
179 objectName: "clickedLabel"
180 text: "No element clicked."
181 }
182
183 ListView {
184 id: testListView
185 objectName: "testListView"
186 anchors.left: parent.left
187 anchors.right: parent.right
188 height: column.height - clickedLabel.paintedHeight
189 clip: true
190 model: 20
191
192 delegate: ListItem.Standard {
193 objectName: "testListElement%1".arg(index)
194 text: "test list element %1".arg(index)
195 onClicked: clickedLabel.text = objectName
196 height: units.gu(5)
197 }
198 }
199 }
200 }
201 }
202}
203""")
204160
205 def setUp(self):161 def setUp(self):
206 super().setUp()162 super().setUp()
207163
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.TextAreaTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.TextAreaTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.TextAreaTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,30 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 objectName: "mainView"
24
25 Item {
26 TextArea {
27 objectName: "simple_text_area"
28 }
29 }
30}
031
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2015-06-17 15:06:48 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2016-08-09 21:14:31 +0000
@@ -14,30 +14,19 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
17from testtools.matchers import GreaterThan18from testtools.matchers import GreaterThan
1819
19import ubuntuuitoolkit20import ubuntuuitoolkit
20from ubuntuuitoolkit import tests21from ubuntuuitoolkit import tests
2122
2223
23class TextAreaTestCase(tests.QMLStringAppTestCase):24class TextAreaTestCase(tests.QMLFileAppTestCase):
2425
25 test_qml = ("""26 path = os.path.abspath(__file__)
26import QtQuick 2.027 dir_path = os.path.dirname(path)
27import Ubuntu.Components 1.028 test_qml_file_path = os.path.join(
2829 dir_path, 'test_textarea.TextAreaTestCase.qml')
29MainView {
30 width: units.gu(48)
31 height: units.gu(60)
32 objectName: "mainView"
33
34 Item {
35 TextArea {
36 objectName: "simple_text_area"
37 }
38 }
39}
40""")
4130
42 def setUp(self):31 def setUp(self):
43 super().setUp()32 super().setUp()
4433
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.ToolbarTestCase.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.ToolbarTestCase.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.ToolbarTestCase.qml 2016-08-09 21:14:31 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19
20MainView {
21 width: units.gu(50)
22 height: units.gu(50)
23 objectName: "mainView"
24
25 // Make sure that for these tests the toolbar starts closed.
26 Component.onCompleted: {
27 __propagated.toolbar.close();
28 }
29
30 Page {
31
32 Label {
33 id: "label"
34 objectName: "clicked_label"
35 anchors.centerIn: parent
36 text: "Button not clicked."
37 }
38
39 tools: ToolbarItems {
40 ToolbarButton {
41 objectName: "buttonName"
42 action: Action {
43 text: "buttonText"
44 onTriggered: label.text = "Button clicked."
45 }
46 }
47 }
48 }
49}
050
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.py 2016-08-09 21:14:31 +0000
@@ -14,49 +14,19 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
17from unittest import mock18from unittest import mock
1819
19import ubuntuuitoolkit20import ubuntuuitoolkit
20from ubuntuuitoolkit import tests21from ubuntuuitoolkit import tests
2122
2223
23class ToolbarTestCase(tests.QMLStringAppTestCase):24class ToolbarTestCase(tests.QMLFileAppTestCase):
2425
25 test_qml = ("""26 path = os.path.abspath(__file__)
26import QtQuick 2.027 dir_path = os.path.dirname(path)
27import Ubuntu.Components 1.028 test_qml_file_path = os.path.join(
2829 dir_path, 'test_toolbar.ToolbarTestCase.qml')
29MainView {
30 width: units.gu(50)
31 height: units.gu(50)
32 objectName: "mainView"
33
34 // Make sure that for these tests the toolbar starts closed.
35 Component.onCompleted: {
36 __propagated.toolbar.close();
37 }
38
39 Page {
40
41 Label {
42 id: "label"
43 objectName: "clicked_label"
44 anchors.centerIn: parent
45 text: "Button not clicked."
46 }
47
48 tools: ToolbarItems {
49 ToolbarButton {
50 objectName: "buttonName"
51 action: Action {
52 text: "buttonText"
53 onTriggered: label.text = "Button clicked."
54 }
55 }
56 }
57 }
58}
59""")
6030
61 def setUp(self):31 def setUp(self):
62 super().setUp()32 super().setUp()

Subscribers

People subscribed via source and target branches