Merge lp:~bzoltan/ubuntu-ui-toolkit/OTA13-2016-06-29 into lp:ubuntu-ui-toolkit
- OTA13-2016-06-29
- Merge into trunk
Proposed by
Zoltan Balogh
Status: | Merged |
---|---|
Approved by: | Zoltan Balogh |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1347 |
Proposed branch: | lp:~bzoltan/ubuntu-ui-toolkit/OTA13-2016-06-29 |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
5506 lines (+2586/-907) (has conflicts) 103 files modified
README (+35/-0) components.api (+10/-0) debian/changelog (+70/-0) documentation/docs.sh (+13/-5) documentation/ubuntu-ui-toolkit-indexes.qdocconf (+9/-0) documentation/ubuntu-ui-toolkit-offline-indexes.qdocconf (+2/-11) documentation/ubuntu-ui-toolkit-online-indexes.qdocconf (+2/-0) examples/ubuntu-ui-toolkit-gallery/Buttons.qml (+8/-8) src/Ubuntu/Components/1.3/ComboButton.qml (+13/-0) src/Ubuntu/Components/1.3/PageHeader.qml (+6/-0) src/Ubuntu/Components/1.3/Scrollbar.qml (+35/-21) src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml (+2/-0) src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml (+12/-2) src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml (+56/-0) src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml (+7/-0) src/Ubuntu/Components/Styles/Styles.pro (+1/-0) src/Ubuntu/Components/Styles/qmldir (+1/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml (+36/-6) src/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml (+5/-1) src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml (+1/-1) src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+19/-2) src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml (+38/-18) src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml (+2/-0) src/Ubuntu/UbuntuToolkit/UbuntuToolkit.pro (+4/-2) src/Ubuntu/UbuntuToolkit/privates/listviewextensions.cpp (+6/-4) src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp (+6/-0) src/Ubuntu/UbuntuToolkit/privates/ucpagewrapper.cpp (+15/-2) src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils.cpp (+44/-0) src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils_p.h (+41/-0) src/Ubuntu/UbuntuToolkit/ubuntutoolkitmodule.cpp (+4/-0) src/Ubuntu/UbuntuToolkit/ucabstractbutton.cpp (+1/-1) src/Ubuntu/UbuntuToolkit/ucbottomedgeregion.cpp (+1/-1) src/Ubuntu/UbuntuToolkit/uclistitem.cpp (+1/-1) src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp (+97/-5) src/Ubuntu/UbuntuToolkit/ucslotslayout.cpp (+2/-2) src/Ubuntu/UbuntuToolkit/ucstyleditembase_p.h (+1/-1) src/Ubuntu/UbuntuToolkit/ucstylehints.cpp (+6/-3) src/Ubuntu/UbuntuToolkit/ucunits.cpp (+15/-17) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_actionbar.py (+3/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+3/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_optionselector.py (+3/-3) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py (+1/-2) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py (+6/-1) 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 (+18/-82) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ActionSelectionPopoverTestCase.qml (+2/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml (+52/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py (+11/-43) 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) tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py (+0/-20) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py (+5/-3) tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py (+12/-0) tests/autopilot/ubuntuuitoolkit/tests/test_launcher.testcase.qml (+1/-1) tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml (+43/-0) tests/unit/README (+0/-4) tests/unit/bottomedge/ExternalContent.qml (+27/-0) tests/unit/bottomedge/PreloadContentUrl.qml (+35/-0) tests/unit/bottomedge/bottomedge.pro (+3/-1) tests/unit/bottomedge/tst_bottomedge.cpp (+10/-0) tests/unit/subtheming/GroupPropertyValueHints.qml (+33/-0) tests/unit/subtheming/StyleHintsInvalidGroupedProperty.qml (+30/-0) tests/unit/subtheming/subtheming.pro (+2/-0) tests/unit/subtheming/tst_subtheming.cpp (+7/-1) tests/unit/units/dpr1/tst_units.cpp (+2/-2) tests/unit/units/dpr2/tst_units_dpr2.cpp (+2/-0) tests/unit/units/dpr3/tst_units_dpr3.cpp (+2/-0) tests/unit/visual/tst_actionbar.13.qml (+78/-17) tests/unit/visual/tst_adaptivepagelayout_param.13.qml (+62/-0) tests/unit/visual/tst_combobutton.13.qml (+23/-10) tests/unit/visual/tst_focus.13.qml (+8/-2) tests/unit/visual/tst_listitem.12.qml (+1/-1) tests/unit/visual/tst_listitem.13.qml (+1/-1) tests/unit/visual/tst_listitem_focus.13.qml (+241/-22) tests/unit/visual/tst_pageheader.13.qml (+31/-1) tests/unit/visual/tst_scrollbar.13.qml (+135/-12) ubuntu-ui-toolkit-launcher/launcher.cpp (+83/-25) Text conflict in debian/changelog |
To merge this branch: | bzr merge lp:~bzoltan/ubuntu-ui-toolkit/OTA13-2016-06-29 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zoltan Balogh | Approve | ||
Review via email: mp+301493@code.launchpad.net |
Commit message
Landing OTA13-2016-06-29
Description of the change
Landing OTA13-2016-06-29
To post a comment you must log in.
Revision history for this message
Zoltan Balogh (bzoltan) : | # |
review:
Approve
- 2045. By Zoltan Balogh
-
update from staging
- 2046. By Zoltan Balogh
-
Update from staging
- 2047. By Zoltan Balogh
-
Sync with staging
- 2048. By Zoltan Balogh
-
Sync with staging
- 2049. By Zoltan Balogh
-
Use safe qstrcmp: typeName() can be 0
- 2050. By Zoltan Balogh
-
Update from staging
- 2051. By Zoltan Balogh
-
Update from staging
- 2052. By Zoltan Balogh
-
Update from staging
- 2053. By Zoltan Balogh
-
Update from staging
- 2054. By Zoltan Balogh
-
sync with staging
- 2055. By Zoltan Balogh
-
sync with staging
- 2056. By Zoltan Balogh
-
update from staging
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README' | |||
2 | --- README 2016-03-16 14:53:19 +0000 | |||
3 | +++ README 2016-08-14 09:05:30 +0000 | |||
4 | @@ -44,6 +44,41 @@ | |||
5 | 44 | shell. | 44 | shell. |
6 | 45 | 45 | ||
7 | 46 | 46 | ||
8 | 47 | Tests | ||
9 | 48 | ----- | ||
10 | 49 | |||
11 | 50 | tests | ||
12 | 51 | - autopilot/ubuntuuitoolkit: Autopilot test cases and CPOs | ||
13 | 52 | ./run_tests.sh list | ||
14 | 53 | ./run_tests.sh run [TESTCASE] | ||
15 | 54 | - api: Tests for apicheck (API description generator) | ||
16 | 55 | Run 'make check' in the folder | ||
17 | 56 | - license: Script to verify that sources contains copright headers | ||
18 | 57 | make license | ||
19 | 58 | - resources: Manual test cases (deprecated, should move to unit/visual) | ||
20 | 59 | - unit: | ||
21 | 60 | Unit tests using QTest/UbuntuTestCase | ||
22 | 61 | Run 'make check[_BASENAME_WITH_UNDERSCORES]' in the respective subfolder | ||
23 | 62 | eg. 'tst_label_extras.13.qml' becomes 'make check_tst_label_extras_13' | ||
24 | 63 | This is driven by runtest.sh and checkresults.sh. | ||
25 | 64 | - visual: All tests in this folder can be run as unit tests as well as | ||
26 | 65 | interactively. That means 'make check' or via gallery.sh. | ||
27 | 66 | Optional: prefix with './tests/xvfb.sh' to run inside XVfb. | ||
28 | 67 | Note for adding new files: The root must be a visual Item-based type | ||
29 | 68 | with a width and height. TestCase or UbuntuTestCase must be a child. | ||
30 | 69 | |||
31 | 70 | Verify the whole Toolkit API: | ||
32 | 71 | './tests/qmlapicheck.sh' inspects components.api and produces components.api.new | ||
33 | 72 | |||
34 | 73 | Verify the tidyness of packaging: | ||
35 | 74 | ./packaging-sorting.sh | ||
36 | 75 | |||
37 | 76 | Verify the coding style of Python source code: | ||
38 | 77 | pyflakes . | ||
39 | 78 | |||
40 | 79 | 'source export_qml_dir.sh' can be used in bash to setup the environment. | ||
41 | 80 | |||
42 | 81 | |||
43 | 47 | Documentation | 82 | Documentation |
44 | 48 | ------------- | 83 | ------------- |
45 | 49 | 84 | ||
46 | 50 | 85 | ||
47 | === modified file 'components.api' | |||
48 | --- components.api 2016-07-25 14:14:08 +0000 | |||
49 | +++ components.api 2016-08-14 09:05:30 +0000 | |||
50 | @@ -29,6 +29,8 @@ | |||
51 | 29 | property Component delegate | 29 | property Component delegate |
52 | 30 | property int numberOfSlots | 30 | property int numberOfSlots |
53 | 31 | Ubuntu.Components.Styles.ActionBarStyle 1.3: Item | 31 | Ubuntu.Components.Styles.ActionBarStyle 1.3: Item |
54 | 32 | property color backgroundColor | ||
55 | 33 | readonly property ActionItemProperties buttons | ||
56 | 32 | property Component defaultDelegate | 34 | property Component defaultDelegate |
57 | 33 | property int defaultNumberOfSlots | 35 | property int defaultNumberOfSlots |
58 | 34 | property string overflowIconName | 36 | property string overflowIconName |
59 | @@ -47,6 +49,13 @@ | |||
60 | 47 | function trigger(var value) | 49 | function trigger(var value) |
61 | 48 | function trigger() | 50 | function trigger() |
62 | 49 | property string text | 51 | property string text |
63 | 52 | Ubuntu.Components.Styles.ActionItemProperties 1.3: QtObject | ||
64 | 53 | property color backgroundColor | ||
65 | 54 | property color disabledBackgroundColor | ||
66 | 55 | property color disabledForegroundColor | ||
67 | 56 | property color foregroundColor | ||
68 | 57 | property color pressedBackgroundColor | ||
69 | 58 | property color pressedForegroundColor | ||
70 | 50 | Ubuntu.Components.ActionList 1.0 0.1: QtObject | 59 | Ubuntu.Components.ActionList 1.0 0.1: QtObject |
71 | 51 | property list<Action> actions | 60 | property list<Action> actions |
72 | 52 | default property list<Action> children | 61 | default property list<Action> children |
73 | @@ -821,6 +830,7 @@ | |||
74 | 821 | readonly property ActionBar trailingActionBar | 830 | readonly property ActionBar trailingActionBar |
75 | 822 | Ubuntu.Components.Styles.PageHeaderStyle 1.3: Item | 831 | Ubuntu.Components.Styles.PageHeaderStyle 1.3: Item |
76 | 823 | property color backgroundColor | 832 | property color backgroundColor |
77 | 833 | readonly property ActionItemProperties buttons | ||
78 | 824 | property double contentHeight | 834 | property double contentHeight |
79 | 825 | property Component defaultActionDelegate | 835 | property Component defaultActionDelegate |
80 | 826 | property color disabledForegroundColor | 836 | property color disabledForegroundColor |
81 | 827 | 837 | ||
82 | === modified file 'debian/changelog' | |||
83 | --- debian/changelog 2016-08-09 13:05:01 +0000 | |||
84 | +++ debian/changelog 2016-08-14 09:05:30 +0000 | |||
85 | @@ -1,3 +1,4 @@ | |||
86 | 1 | <<<<<<< TREE | ||
87 | 1 | ubuntu-ui-toolkit (1.3.2030+16.10.20160726.15) yakkety; urgency=medium | 2 | ubuntu-ui-toolkit (1.3.2030+16.10.20160726.15) yakkety; urgency=medium |
88 | 2 | 3 | ||
89 | 3 | * More s390x dependencies workarounding until upstart is really fixed. | 4 | * More s390x dependencies workarounding until upstart is really fixed. |
90 | @@ -5,6 +6,75 @@ | |||
91 | 5 | 6 | ||
92 | 6 | -- Timo Jyrinki <timo-jyrinki@ubuntu.com> Mon, 08 Aug 2016 13:26:34 +0300 | 7 | -- Timo Jyrinki <timo-jyrinki@ubuntu.com> Mon, 08 Aug 2016 13:26:34 +0300 |
93 | 7 | 8 | ||
94 | 9 | ======= | ||
95 | 10 | ubuntu-ui-toolkit (1.3.2060+16.10) UNRELEASED; urgency=medium | ||
96 | 11 | |||
97 | 12 | [ Zoltan Balogh ] | ||
98 | 13 | * Fix OptionSelectorTestCase tests. | ||
99 | 14 | * Fix more OptionSelector autopilot tests | ||
100 | 15 | |||
101 | 16 | [ Timo Jyrinki ] | ||
102 | 17 | * Disable documentation building for GLES builds. Fixes LP: #1606222. | ||
103 | 18 | * Replace abs with qFabs due to GCC6 breakage. Fixes LP: #1610943. | ||
104 | 19 | * Limit s390x dependencies more due to upstart/s390x problems and removed | ||
105 | 20 | packages in archives. Fixes LP: #1610951 | ||
106 | 21 | |||
107 | 22 | [ Andrea Bernabei ] | ||
108 | 23 | * ListItemLayout doc: add elide mode change example and add section about | ||
109 | 24 | labels default properties values. Fixes LP: #1603450. | ||
110 | 25 | * ListItemLayout doc: add explicit note about the need to bind ListItem's | ||
111 | 26 | height to layout's height. | ||
112 | 27 | * More Scrollbar optimizations: 20% faster creation time. Fixes LP: #1606451 | ||
113 | 28 | * Scrollbar: fix wrong thumb color on tap/mouse release and increase coverage | ||
114 | 29 | of hover states unit tests. Fixes LP: #1608897 | ||
115 | 30 | |||
116 | 31 | [ Zsombor Egri ] | ||
117 | 32 | * Fix null pointer property initializer used with 1.3 PageWrapper. | ||
118 | 33 | Fixes LP: #1604780. | ||
119 | 34 | * Fix BottomEdge content URL preloading. Fixes LP: #1604509. | ||
120 | 35 | |||
121 | 36 | [Albert Astals Cid ] | ||
122 | 37 | * UCUnits::resolveResource: Prefer image path if it exists. This saves | ||
123 | 38 | searching the disk for @gu images, which is a big speedup. According to | ||
124 | 39 | callgrind loading 100 images from a folder that contains 380 images goes | ||
125 | 40 | from around 3 million instructions per UCUnits::resolveResource call down | ||
126 | 41 | to around 10 thousand. This optimization is ok since it is not correct to | ||
127 | 42 | ship both image.png and image@20.png. You either have to ship gu-enabled | ||
128 | 43 | files or not, but mixing them is not allowed. Searched for cases in which | ||
129 | 44 | that may be happening in my phone and found none. Fixes LP: #1604029. | ||
130 | 45 | |||
131 | 46 | [ Tim Peeters ] | ||
132 | 47 | * Configure colors of the buttons in the ActionBar and PageHeader through | ||
133 | 48 | their Styles. Fixes LP: #1597774. | ||
134 | 49 | * Fix assigning of constant values to a grouped property in StyleHints. | ||
135 | 50 | Fixes LP: #1602836. | ||
136 | 51 | * Fix list view keyboard navigation for RightToLeft and BottomToTop | ||
137 | 52 | directions. Fixes LP: #1605634 | ||
138 | 53 | * Use external QML files instead of embedded QML strings for autopilot tests. | ||
139 | 54 | Fixes LP: #1578319 | ||
140 | 55 | * Fix failing autopilot header tests. | ||
141 | 56 | * Fix ActionSelectionPopover Autopilot CPO tests. | ||
142 | 57 | |||
143 | 58 | [Christian Dywan ] | ||
144 | 59 | * Include indexes in "offline" docs and filter out link errors. | ||
145 | 60 | Fixes LP: #1603937. | ||
146 | 61 | * Increase focus ring thickness from 1dp to 2dp. Fixes LP: #1602690. | ||
147 | 62 | * Add a snippet about tests to the toplevel README | ||
148 | 63 | * Enter/Return to trigger, Space to expand ComboButton. Fixes LP: #1523817. | ||
149 | 64 | * Initialize engine variable before using it in the _engine case. | ||
150 | 65 | * Use Qt.rgba instead of #0000 checking ListItem default color. | ||
151 | 66 | Fixes LP: #1560004 | ||
152 | 67 | * Don't use a different .desktop file in the gallery tests. | ||
153 | 68 | Fixes LP: #1578319 | ||
154 | 69 | * Update scaling docs, set QT_SCALE_FACTOR and unset GRID_UNIT_PX. | ||
155 | 70 | Fixes LP: #1610208 | ||
156 | 71 | |||
157 | 72 | [ Florian Boucault ] | ||
158 | 73 | * Sections: load Icons asynchronously. | ||
159 | 74 | |||
160 | 75 | -- Zoltán Balogh <zoltan@bakter.hu> Fri, 29 Jul 2016 14:49:16 +0300 | ||
161 | 76 | |||
162 | 77 | >>>>>>> MERGE-SOURCE | ||
163 | 8 | ubuntu-ui-toolkit (1.3.2030+16.10.20160726.2) yakkety; urgency=medium | 78 | ubuntu-ui-toolkit (1.3.2030+16.10.20160726.2) yakkety; urgency=medium |
164 | 9 | [ William Hua ] | 79 | [ William Hua ] |
165 | 10 | * Make qml-module-ubuntu-components-gles depend on | 80 | * Make qml-module-ubuntu-components-gles depend on |
166 | 11 | 81 | ||
167 | === modified file 'documentation/docs.sh' | |||
168 | --- documentation/docs.sh 2015-05-19 09:16:44 +0000 | |||
169 | +++ documentation/docs.sh 2016-08-14 09:05:30 +0000 | |||
170 | @@ -28,7 +28,7 @@ | |||
171 | 28 | # Offline docs for QtCreator | 28 | # Offline docs for QtCreator |
172 | 29 | eval "$QDOC $SRC/ubuntu-ui-toolkit-qtcreator.qdocconf 2> $DOC_PATH/qdoc.log" | 29 | eval "$QDOC $SRC/ubuntu-ui-toolkit-qtcreator.qdocconf 2> $DOC_PATH/qdoc.log" |
173 | 30 | # FIXME: With Qt 5.2 this warning shows up, forcibly omit it from errors | 30 | # FIXME: With Qt 5.2 this warning shows up, forcibly omit it from errors |
175 | 31 | grep -v "error: HTML file already exists; overwriting" $DOC_PATH/qdoc.log | grep -v "qdoc: warning: No documentation for 'global'" > $DOC_PATH/qdoc.err | 31 | grep -v "error: HTML file already exists; overwriting" $DOC_PATH/qdoc.log | grep -v "qdoc: warning: No documentation for 'global'" | grep -v "warning: Can't link to" > $DOC_PATH/qdoc.err |
176 | 32 | cat $DOC_PATH/qdoc.err | 32 | cat $DOC_PATH/qdoc.err |
177 | 33 | test ! -s $DOC_PATH/qdoc.err || exit 1 | 33 | test ! -s $DOC_PATH/qdoc.err || exit 1 |
178 | 34 | echo docs: Offline done. | 34 | echo docs: Offline done. |
179 | @@ -36,15 +36,23 @@ | |||
180 | 36 | eval "$QHELPGENERATOR -o '$DOC_PATH/ubuntuuserinterfacetoolkit.qch' '$DOC_PATH/offline/ubuntuuserinterfacetoolkit.qhp' | grep -v ' does not exist! Skipping it'" | 36 | eval "$QHELPGENERATOR -o '$DOC_PATH/ubuntuuserinterfacetoolkit.qch' '$DOC_PATH/offline/ubuntuuserinterfacetoolkit.qhp' | grep -v ' does not exist! Skipping it'" |
181 | 37 | echo docs: qch done: $DOC_PATH | 37 | echo docs: qch done: $DOC_PATH |
182 | 38 | 38 | ||
185 | 39 | # Online docs. Run qdoc twice: the second run with indexes for cross-referencing | 39 | # Online docs |
184 | 40 | # other APIs but discard errors because qdoc inherits all doc bugs otherwise | ||
186 | 41 | eval "$QDOC $SRC/ubuntu-ui-toolkit-online.qdocconf 2> $DOC_PATH/qdoc.log" | 40 | eval "$QDOC $SRC/ubuntu-ui-toolkit-online.qdocconf 2> $DOC_PATH/qdoc.log" |
188 | 42 | grep -v "error: HTML file already exists; overwriting" $DOC_PATH/qdoc.log | grep -v "qdoc: warning: No documentation for 'global'" > $DOC_PATH/qdoc.err | 41 | grep -v "error: HTML file already exists; overwriting" $DOC_PATH/qdoc.log | grep -v "qdoc: warning: No documentation for 'global'" | grep -v "warning: Can't link to" > $DOC_PATH/qdoc.err |
189 | 43 | cat $DOC_PATH/qdoc.err | 42 | cat $DOC_PATH/qdoc.err |
190 | 44 | test ! -s $DOC_PATH/qdoc.err || exit 1 | 43 | test ! -s $DOC_PATH/qdoc.err || exit 1 |
191 | 45 | echo docs: Online done. | 44 | echo docs: Online done. |
192 | 46 | 45 | ||
194 | 47 | eval "$QDOC $SRC/ubuntu-ui-toolkit-online-indexes.qdocconf 2> /dev/null" | 46 | # Second qdoc pass, this time with indexes for cross-referencing. |
195 | 47 | # If we don't do this, bugs in docs from other modules (Qt, Unity) fail our build | ||
196 | 48 | eval "$QDOC $SRC/ubuntu-ui-toolkit-offline-indexes.qdocconf 2> $DOC_PATH/qdoc.log" | ||
197 | 49 | grep "warning: Can't link to" $DOC_PATH/qdoc.log > $DOC_PATH/qdoc.err | ||
198 | 50 | cat $DOC_PATH/qdoc.err | ||
199 | 51 | test ! -s $DOC_PATH/qdoc.err || exit 1 | ||
200 | 52 | eval "$QDOC $SRC/ubuntu-ui-toolkit-online-indexes.qdocconf 2> $DOC_PATH/qdoc.log" | ||
201 | 53 | grep "warning: Can't link to" $DOC_PATH/qdoc.log > $DOC_PATH/qdoc.err | ||
202 | 54 | cat $DOC_PATH/qdoc.err | ||
203 | 55 | test ! -s $DOC_PATH/qdoc.err || exit 1 | ||
204 | 48 | echo docs: Cross-referenced done. | 56 | echo docs: Cross-referenced done. |
205 | 49 | 57 | ||
206 | 50 | sed -r -i 's@(</p>)<p/>@\1@g' $DOC_PATH/html/*.html | 58 | sed -r -i 's@(</p>)<p/>@\1@g' $DOC_PATH/html/*.html |
207 | 51 | 59 | ||
208 | === added file 'documentation/ubuntu-ui-toolkit-indexes.qdocconf' | |||
209 | --- documentation/ubuntu-ui-toolkit-indexes.qdocconf 1970-01-01 00:00:00 +0000 | |||
210 | +++ documentation/ubuntu-ui-toolkit-indexes.qdocconf 2016-08-14 09:05:30 +0000 | |||
211 | @@ -0,0 +1,9 @@ | |||
212 | 1 | indexes = \ | ||
213 | 2 | /usr/share/qt5/doc/qtqml/qtqml.index \ | ||
214 | 3 | /usr/share/qt5/doc/qtquick/qtquick.index \ | ||
215 | 4 | /usr/share/qt5/doc/qtwebkit/qtwebkit.index \ | ||
216 | 5 | /usr/share/qt5/doc/qtsvg/qtsvg.index \ | ||
217 | 6 | /usr/share/qt5/doc/qtscript/qtscript.index \ | ||
218 | 7 | /usr/share/qt5/doc/qtmultimedia/qtmultimedia.index \ | ||
219 | 8 | /usr/share/doc/unity-action/qml/unity-action-qml-api.index \ | ||
220 | 9 | |||
221 | 0 | 10 | ||
222 | === renamed file 'documentation/ubuntu-ui-toolkit-online-indexes.qdocconf' => 'documentation/ubuntu-ui-toolkit-offline-indexes.qdocconf' | |||
223 | --- documentation/ubuntu-ui-toolkit-online-indexes.qdocconf 2013-12-09 11:33:51 +0000 | |||
224 | +++ documentation/ubuntu-ui-toolkit-offline-indexes.qdocconf 2016-08-14 09:05:30 +0000 | |||
225 | @@ -1,11 +1,2 @@ | |||
237 | 1 | include(ubuntu-ui-toolkit-online.qdocconf) | 1 | include(ubuntu-ui-toolkit-offline.qdocconf) |
238 | 2 | 2 | include(ubuntu-ui-toolkit-indexes.qdocconf) | |
228 | 3 | indexes = \ | ||
229 | 4 | /usr/share/qt5/doc/qtqml/qtqml.index \ | ||
230 | 5 | /usr/share/qt5/doc/qtquick/qtquick.index \ | ||
231 | 6 | /usr/share/qt5/doc/qtwebkit/qtwebkit.index \ | ||
232 | 7 | /usr/share/qt5/doc/qtsvg/qtsvg.index \ | ||
233 | 8 | /usr/share/qt5/doc/qtscript/qtscript.index \ | ||
234 | 9 | /usr/share/qt5/doc/qtmultimedia/qtmultimedia.index \ | ||
235 | 10 | /usr/share/doc/unity-action/qml/unity-action-qml-api.index \ | ||
236 | 11 | |||
239 | 12 | 3 | ||
240 | === added file 'documentation/ubuntu-ui-toolkit-online-indexes.qdocconf' | |||
241 | --- documentation/ubuntu-ui-toolkit-online-indexes.qdocconf 1970-01-01 00:00:00 +0000 | |||
242 | +++ documentation/ubuntu-ui-toolkit-online-indexes.qdocconf 2016-08-14 09:05:30 +0000 | |||
243 | @@ -0,0 +1,2 @@ | |||
244 | 1 | include(ubuntu-ui-toolkit-online.qdocconf) | ||
245 | 2 | include(ubuntu-ui-toolkit-indexes.qdocconf) | ||
246 | 0 | 3 | ||
247 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Buttons.qml' | |||
248 | --- examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2016-02-12 10:55:51 +0000 | |||
249 | +++ examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2016-08-14 09:05:30 +0000 | |||
250 | @@ -110,8 +110,8 @@ | |||
251 | 110 | width: parent.width < units.gu(30)? parent.width : units.gu(30) | 110 | width: parent.width < units.gu(30)? parent.width : units.gu(30) |
252 | 111 | comboList: UbuntuListView { | 111 | comboList: UbuntuListView { |
253 | 112 | model: 10 | 112 | model: 10 |
256 | 113 | delegate: Standard { | 113 | delegate: ListItemWithLabel { |
257 | 114 | text: "item #" + modelData | 114 | title.text: "item #" + modelData |
258 | 115 | } | 115 | } |
259 | 116 | } | 116 | } |
260 | 117 | } | 117 | } |
261 | @@ -125,8 +125,8 @@ | |||
262 | 125 | width: parent.width < units.gu(30)? parent.width : units.gu(30) | 125 | width: parent.width < units.gu(30)? parent.width : units.gu(30) |
263 | 126 | comboList: UbuntuListView { | 126 | comboList: UbuntuListView { |
264 | 127 | model: 10 | 127 | model: 10 |
267 | 128 | delegate: Standard { | 128 | delegate: ListItemWithLabel { |
268 | 129 | text: "item #" + modelData | 129 | title.text: "item #" + modelData |
269 | 130 | } | 130 | } |
270 | 131 | } | 131 | } |
271 | 132 | } | 132 | } |
272 | @@ -141,8 +141,8 @@ | |||
273 | 141 | width: parent.width < units.gu(30)? parent.width : units.gu(30) | 141 | width: parent.width < units.gu(30)? parent.width : units.gu(30) |
274 | 142 | comboList: UbuntuListView { | 142 | comboList: UbuntuListView { |
275 | 143 | model: 10 | 143 | model: 10 |
278 | 144 | delegate: Standard { | 144 | delegate: ListItemWithLabel { |
279 | 145 | text: "item #" + modelData | 145 | title.text: "item #" + modelData |
280 | 146 | } | 146 | } |
281 | 147 | } | 147 | } |
282 | 148 | } | 148 | } |
283 | @@ -157,8 +157,8 @@ | |||
284 | 157 | width: parent.width < units.gu(30)? parent.width : units.gu(30) | 157 | width: parent.width < units.gu(30)? parent.width : units.gu(30) |
285 | 158 | comboList: UbuntuListView { | 158 | comboList: UbuntuListView { |
286 | 159 | model: 10 | 159 | model: 10 |
289 | 160 | delegate: Standard { | 160 | delegate: ListItemWithLabel { |
290 | 161 | text: "item #" + modelData | 161 | title.text: "item #" + modelData |
291 | 162 | } | 162 | } |
292 | 163 | } | 163 | } |
293 | 164 | } | 164 | } |
294 | 165 | 165 | ||
295 | === modified file 'src/Ubuntu/Components/1.3/ComboButton.qml' | |||
296 | --- src/Ubuntu/Components/1.3/ComboButton.qml 2016-05-25 12:48:10 +0000 | |||
297 | +++ src/Ubuntu/Components/1.3/ComboButton.qml 2016-08-14 09:05:30 +0000 | |||
298 | @@ -331,6 +331,19 @@ | |||
299 | 331 | onClicked: { | 331 | onClicked: { |
300 | 332 | // toggle expanded | 332 | // toggle expanded |
301 | 333 | combo.expanded = !combo.expanded; | 333 | combo.expanded = !combo.expanded; |
302 | 334 | combo.forceActiveFocus() | ||
303 | 335 | } | ||
304 | 336 | } | ||
305 | 337 | |||
306 | 338 | Keys.onReleased: { | ||
307 | 339 | if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return) { | ||
308 | 340 | // Enter or Return should trigger, not expand | ||
309 | 341 | event.accepted = true; | ||
310 | 342 | combo.trigger(); | ||
311 | 343 | } else if (event.key == Qt.Key_Space) { | ||
312 | 344 | // Space should expand, not trigger | ||
313 | 345 | event.accepted = true; | ||
314 | 346 | combo.expanded = !combo.expanded; | ||
315 | 334 | } | 347 | } |
316 | 335 | } | 348 | } |
317 | 336 | 349 | ||
318 | 337 | 350 | ||
319 | === modified file 'src/Ubuntu/Components/1.3/PageHeader.qml' | |||
320 | --- src/Ubuntu/Components/1.3/PageHeader.qml 2016-06-14 14:37:54 +0000 | |||
321 | +++ src/Ubuntu/Components/1.3/PageHeader.qml 2016-08-14 09:05:30 +0000 | |||
322 | @@ -181,7 +181,9 @@ | |||
323 | 181 | actions: header.navigationActions | 181 | actions: header.navigationActions |
324 | 182 | visible: leading.width > 0 // at least 1 visible action | 182 | visible: leading.width > 0 // at least 1 visible action |
325 | 183 | StyleHints { | 183 | StyleHints { |
326 | 184 | ignoreUnknownProperties: false | ||
327 | 184 | overflowIconName: "navigation-menu" | 185 | overflowIconName: "navigation-menu" |
328 | 186 | backgroundColor: header.__styleInstance.backgroundColor | ||
329 | 185 | } | 187 | } |
330 | 186 | } | 188 | } |
331 | 187 | 189 | ||
332 | @@ -227,6 +229,10 @@ | |||
333 | 227 | numberOfSlots: MathUtils.clamp(0.3*header.width/units.gu(4), 3, 6) | 229 | numberOfSlots: MathUtils.clamp(0.3*header.width/units.gu(4), 3, 6) |
334 | 228 | delegate: header.__styleInstance.defaultActionDelegate | 230 | delegate: header.__styleInstance.defaultActionDelegate |
335 | 229 | visible: trailing.width > 0 // at least 1 visible action | 231 | visible: trailing.width > 0 // at least 1 visible action |
336 | 232 | StyleHints { | ||
337 | 233 | ignoreUnknownProperties: false | ||
338 | 234 | backgroundColor: header.__styleInstance.backgroundColor | ||
339 | 235 | } | ||
340 | 230 | } | 236 | } |
341 | 231 | 237 | ||
342 | 232 | /*! | 238 | /*! |
343 | 233 | 239 | ||
344 | === modified file 'src/Ubuntu/Components/1.3/Scrollbar.qml' | |||
345 | --- src/Ubuntu/Components/1.3/Scrollbar.qml 2016-05-25 12:48:10 +0000 | |||
346 | +++ src/Ubuntu/Components/1.3/Scrollbar.qml 2016-08-14 09:05:30 +0000 | |||
347 | @@ -16,6 +16,7 @@ | |||
348 | 16 | 16 | ||
349 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
350 | 18 | import Ubuntu.Components 1.3 as Toolkit | 18 | import Ubuntu.Components 1.3 as Toolkit |
351 | 19 | import Ubuntu.Components.Private 1.3 as Private | ||
352 | 19 | 20 | ||
353 | 20 | /*! | 21 | /*! |
354 | 21 | \qmltype Scrollbar | 22 | \qmltype Scrollbar |
355 | @@ -141,14 +142,6 @@ | |||
356 | 141 | */ | 142 | */ |
357 | 142 | property bool __interactive: __styleInstance !== null && __styleInstance.interactive | 143 | property bool __interactive: __styleInstance !== null && __styleInstance.interactive |
358 | 143 | 144 | ||
359 | 144 | |||
360 | 145 | /*! | ||
361 | 146 | \internal | ||
362 | 147 | This trough of the scrollbar, it is used to define the position of the slider. | ||
363 | 148 | */ | ||
364 | 149 | property Item __trough: __styleInstance !== null && __styleInstance.trough | ||
365 | 150 | |||
366 | 151 | |||
367 | 152 | /*! | 145 | /*! |
368 | 153 | \internal | 146 | \internal |
369 | 154 | simulate the system setting (which will be implemented in unity8, I guess) | 147 | simulate the system setting (which will be implemented in unity8, I guess) |
370 | @@ -167,27 +160,28 @@ | |||
371 | 167 | //Disable the input handling to let the events pass through in case we have an | 160 | //Disable the input handling to let the events pass through in case we have an |
372 | 168 | //interactive scrollbar right below us (can happen with nested views) | 161 | //interactive scrollbar right below us (can happen with nested views) |
373 | 169 | enabled: __interactive//&& __alwaysOnScrollbars | 162 | enabled: __interactive//&& __alwaysOnScrollbars |
374 | 163 | visible: __initializedFlickable !== null | ||
375 | 170 | 164 | ||
378 | 171 | implicitWidth: internals.vertical ? units.gu(3) : (flickableItem ? flickableItem.width : 0) | 165 | implicitWidth: internals.vertical ? units.gu(3) : (__initializedFlickable ? __initializedFlickable.width : 0) |
379 | 172 | implicitHeight: !internals.vertical ? units.gu(3) : (flickableItem ? flickableItem.height : 0) | 166 | implicitHeight: !internals.vertical ? units.gu(3) : (__initializedFlickable ? __initializedFlickable.height : 0) |
380 | 173 | 167 | ||
381 | 174 | anchors { | 168 | anchors { |
384 | 175 | left: (__viewport || flickableItem) | 169 | left: (__viewport || __initializedFlickable) |
385 | 176 | ? internals.leftAnchor(__viewport ? __viewport : flickableItem) | 170 | ? internals.leftAnchor(__viewport ? __viewport : __initializedFlickable) |
386 | 177 | : undefined | 171 | : undefined |
387 | 178 | leftMargin: internals.leftAnchorMargin() | 172 | leftMargin: internals.leftAnchorMargin() |
390 | 179 | right: (__viewport || flickableItem) | 173 | right: (__viewport || __initializedFlickable) |
391 | 180 | ? internals.rightAnchor(__viewport ? __viewport : flickableItem) | 174 | ? internals.rightAnchor(__viewport ? __viewport : __initializedFlickable) |
392 | 181 | : undefined | 175 | : undefined |
393 | 182 | rightMargin: internals.rightAnchorMargin() | 176 | rightMargin: internals.rightAnchorMargin() |
396 | 183 | top: (__viewport || flickableItem) | 177 | top: (__viewport || __initializedFlickable) |
397 | 184 | ? internals.topAnchor(__viewport ? __viewport : flickableItem) | 178 | ? internals.topAnchor(__viewport ? __viewport : __initializedFlickable) |
398 | 185 | : undefined | 179 | : undefined |
402 | 186 | topMargin: (flickableItem ? flickableItem.topMargin : 0) + internals.topAnchorMargin() | 180 | topMargin: (__initializedFlickable ? __initializedFlickable.topMargin : 0) + internals.topAnchorMargin() |
403 | 187 | bottom: (__viewport || flickableItem) | 181 | bottom: (__viewport || __initializedFlickable) |
404 | 188 | ? internals.bottomAnchor(__viewport ? __viewport : flickableItem) | 182 | ? internals.bottomAnchor(__viewport ? __viewport : __initializedFlickable) |
405 | 189 | : undefined | 183 | : undefined |
407 | 190 | bottomMargin: (flickableItem ? flickableItem.bottomMargin : 0) + internals.bottomAnchorMargin() | 184 | bottomMargin: (__initializedFlickable ? __initializedFlickable.bottomMargin : 0) + internals.bottomAnchorMargin() |
408 | 191 | } | 185 | } |
409 | 192 | 186 | ||
410 | 193 | /*! | 187 | /*! |
411 | @@ -195,6 +189,26 @@ | |||
412 | 195 | */ | 189 | */ |
413 | 196 | onAlignChanged: if (!internals.checkAlign()) console.log("Wrong alignment set to Scrollbar: "+align) | 190 | onAlignChanged: if (!internals.checkAlign()) console.log("Wrong alignment set to Scrollbar: "+align) |
414 | 197 | 191 | ||
415 | 192 | //Don't do anything with flickableItem until its creation is complete, it would be a waste of cpu cycles | ||
416 | 193 | //and it would block the rendering thread for much longer | ||
417 | 194 | property var __initializedFlickable: null | ||
418 | 195 | Connections { | ||
419 | 196 | target: flickableItem | ||
420 | 197 | Component.onCompleted: __initializedFlickable = flickableItem | ||
421 | 198 | } | ||
422 | 199 | onFlickableItemChanged: { | ||
423 | 200 | if (!flickableItem) __initializedFlickable = null | ||
424 | 201 | else { | ||
425 | 202 | //can't use a binding for this, because the "completeness" of a component is | ||
426 | 203 | //not esposed to QML, QML just gets Component.onCompleted when a component is | ||
427 | 204 | //completed, but you won't get that if we're assigned a Flickable which is | ||
428 | 205 | //already "complete" | ||
429 | 206 | if (Private.PrivateScrollbarUtils.isComponentComplete(flickableItem)) { | ||
430 | 207 | __initializedFlickable = flickableItem | ||
431 | 208 | } | ||
432 | 209 | } | ||
433 | 210 | } | ||
434 | 211 | |||
435 | 198 | /*! | 212 | /*! |
436 | 199 | \internal | 213 | \internal |
437 | 200 | Internals: contains the common logic of the scrollbar like anchoring, | 214 | Internals: contains the common logic of the scrollbar like anchoring, |
438 | @@ -204,7 +218,7 @@ | |||
439 | 204 | QtObject { | 218 | QtObject { |
440 | 205 | id: internals | 219 | id: internals |
441 | 206 | property bool vertical: (align === Qt.AlignLeading) || (align === Qt.AlignTrailing) | 220 | property bool vertical: (align === Qt.AlignLeading) || (align === Qt.AlignTrailing) |
443 | 207 | property bool scrollable: flickableItem && flickableItem.interactive && checkAlign() | 221 | property bool scrollable: __initializedFlickable && __initializedFlickable.interactive && checkAlign() |
444 | 208 | property real nonOverlayScrollbarMargin: __styleInstance ? __styleInstance.nonOverlayScrollbarMargin : 0 | 222 | property real nonOverlayScrollbarMargin: __styleInstance ? __styleInstance.nonOverlayScrollbarMargin : 0 |
445 | 209 | 223 | ||
446 | 210 | function checkAlign() | 224 | function checkAlign() |
447 | 211 | 225 | ||
448 | === modified file 'src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml' | |||
449 | --- src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2015-08-18 16:28:26 +0000 | |||
450 | +++ src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2016-08-14 09:05:30 +0000 | |||
451 | @@ -120,6 +120,8 @@ | |||
452 | 120 | } | 120 | } |
453 | 121 | /*! \internal */ | 121 | /*! \internal */ |
454 | 122 | onTriggered: popover.hide() | 122 | onTriggered: popover.hide() |
455 | 123 | // FIXME: Disabled actions should be visible, but greyed-out. | ||
456 | 124 | // See bug 1612579. Tests will also need to be updated. | ||
457 | 123 | visible: enabled && ((action === undefined) || action.visible) | 125 | visible: enabled && ((action === undefined) || action.visible) |
458 | 124 | height: visible ? implicitHeight : 0 | 126 | height: visible ? implicitHeight : 0 |
459 | 125 | } | 127 | } |
460 | 126 | 128 | ||
461 | === modified file 'src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml' | |||
462 | --- src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml 2015-10-15 14:17:25 +0000 | |||
463 | +++ src/Ubuntu/Components/Styles/1.3/ActionBarStyle.qml 2016-08-14 09:05:30 +0000 | |||
464 | @@ -1,5 +1,5 @@ | |||
465 | 1 | /* | 1 | /* |
467 | 2 | * Copyright 2015 Canonical Ltd. | 2 | * Copyright 2016 Canonical Ltd. |
468 | 3 | * | 3 | * |
469 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
470 | 5 | * it under the terms of the GNU Lesser General Public License as published by | 5 | * it under the terms of the GNU Lesser General Public License as published by |
471 | @@ -17,7 +17,7 @@ | |||
472 | 17 | 17 | ||
473 | 18 | /*! | 18 | /*! |
474 | 19 | \qmltype ActionBarStyle | 19 | \qmltype ActionBarStyle |
476 | 20 | \inqmlmodule Ubuntu.Components.Styles 1.1 | 20 | \inqmlmodule Ubuntu.Components.Styles 1.3 |
477 | 21 | \ingroup style-api | 21 | \ingroup style-api |
478 | 22 | \brief Style API for action bar. | 22 | \brief Style API for action bar. |
479 | 23 | 23 | ||
480 | @@ -25,6 +25,16 @@ | |||
481 | 25 | */ | 25 | */ |
482 | 26 | Item { | 26 | Item { |
483 | 27 | /*! | 27 | /*! |
484 | 28 | The color of the background of the action bar. | ||
485 | 29 | */ | ||
486 | 30 | property color backgroundColor | ||
487 | 31 | |||
488 | 32 | /*! | ||
489 | 33 | Configuration of the colors of the action buttons in the action bar. | ||
490 | 34 | */ | ||
491 | 35 | readonly property ActionItemProperties buttons: ActionItemProperties { } | ||
492 | 36 | |||
493 | 37 | /*! | ||
494 | 28 | The default action delegate if the styled item does | 38 | The default action delegate if the styled item does |
495 | 29 | not provide a different delegate. | 39 | not provide a different delegate. |
496 | 30 | */ | 40 | */ |
497 | 31 | 41 | ||
498 | === added file 'src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml' | |||
499 | --- src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml 1970-01-01 00:00:00 +0000 | |||
500 | +++ src/Ubuntu/Components/Styles/1.3/ActionItemProperties.qml 2016-08-14 09:05:30 +0000 | |||
501 | @@ -0,0 +1,56 @@ | |||
502 | 1 | /* | ||
503 | 2 | * Copyright 2016 Canonical Ltd. | ||
504 | 3 | * | ||
505 | 4 | * This program is free software; you can redistribute it and/or modify | ||
506 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
507 | 6 | * the Free Software Foundation; version 3. | ||
508 | 7 | * | ||
509 | 8 | * This program is distributed in the hope that it will be useful, | ||
510 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
511 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
512 | 11 | * GNU Lesser General Public License for more details. | ||
513 | 12 | * | ||
514 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
515 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
516 | 15 | */ | ||
517 | 16 | import QtQuick 2.4 | ||
518 | 17 | |||
519 | 18 | /*! | ||
520 | 19 | \qmltype ButtonProperties | ||
521 | 20 | \inqmlmodule Ubuntu.Components.Styles 1.3 | ||
522 | 21 | \ingroup style-api | ||
523 | 22 | \brief Color properties for buttons. | ||
524 | 23 | |||
525 | 24 | Defines the colors of buttons. | ||
526 | 25 | */ | ||
527 | 26 | QtObject { | ||
528 | 27 | /*! | ||
529 | 28 | The foreground color of an unpressed enabled button. | ||
530 | 29 | */ | ||
531 | 30 | property color foregroundColor | ||
532 | 31 | |||
533 | 32 | /*! | ||
534 | 33 | The foreground color of a disabled button. | ||
535 | 34 | */ | ||
536 | 35 | property color disabledForegroundColor | ||
537 | 36 | |||
538 | 37 | /*! | ||
539 | 38 | The foreground color of a button when being pressed. | ||
540 | 39 | */ | ||
541 | 40 | property color pressedForegroundColor | ||
542 | 41 | |||
543 | 42 | /*! | ||
544 | 43 | The background color of an unpressed enabled button. | ||
545 | 44 | */ | ||
546 | 45 | property color backgroundColor | ||
547 | 46 | |||
548 | 47 | /*! | ||
549 | 48 | The background color of a disabled button. | ||
550 | 49 | */ | ||
551 | 50 | property color disabledBackgroundColor | ||
552 | 51 | |||
553 | 52 | /*! | ||
554 | 53 | The background color of a button when being pressed. | ||
555 | 54 | */ | ||
556 | 55 | property color pressedBackgroundColor | ||
557 | 56 | } | ||
558 | 0 | 57 | ||
559 | === modified file 'src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml' | |||
560 | --- src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml 2016-03-30 15:12:36 +0000 | |||
561 | +++ src/Ubuntu/Components/Styles/1.3/PageHeaderStyle.qml 2016-08-14 09:05:30 +0000 | |||
562 | @@ -30,7 +30,9 @@ | |||
563 | 30 | property color foregroundColor | 30 | property color foregroundColor |
564 | 31 | 31 | ||
565 | 32 | /*! | 32 | /*! |
566 | 33 | \deprecated | ||
567 | 33 | The color of disabled action buttons in the header. | 34 | The color of disabled action buttons in the header. |
568 | 35 | Replaced by buttons.disabledForegroundColor. | ||
569 | 34 | */ | 36 | */ |
570 | 35 | property color disabledForegroundColor | 37 | property color disabledForegroundColor |
571 | 36 | 38 | ||
572 | @@ -45,6 +47,11 @@ | |||
573 | 45 | property color backgroundColor | 47 | property color backgroundColor |
574 | 46 | 48 | ||
575 | 47 | /*! | 49 | /*! |
576 | 50 | Configuration of the colors of the action buttons in the header. | ||
577 | 51 | */ | ||
578 | 52 | readonly property ActionItemProperties buttons: ActionItemProperties { } | ||
579 | 53 | |||
580 | 54 | /*! | ||
581 | 48 | The color of the divider at the bottom of the header. | 55 | The color of the divider at the bottom of the header. |
582 | 49 | */ | 56 | */ |
583 | 50 | property color dividerColor | 57 | property color dividerColor |
584 | 51 | 58 | ||
585 | === modified file 'src/Ubuntu/Components/Styles/Styles.pro' | |||
586 | --- src/Ubuntu/Components/Styles/Styles.pro 2016-06-23 09:13:51 +0000 | |||
587 | +++ src/Ubuntu/Components/Styles/Styles.pro 2016-08-14 09:05:30 +0000 | |||
588 | @@ -13,6 +13,7 @@ | |||
589 | 13 | 1.3/PageHeaderStyle.qml \ | 13 | 1.3/PageHeaderStyle.qml \ |
590 | 14 | 1.3/ToolbarStyle.qml \ | 14 | 1.3/ToolbarStyle.qml \ |
591 | 15 | 1.3/SectionsStyle.qml \ | 15 | 1.3/SectionsStyle.qml \ |
592 | 16 | 1.3/ActionItemProperties.qml \ | ||
593 | 16 | 17 | ||
594 | 17 | load(ubuntu_qml_plugin) | 18 | load(ubuntu_qml_plugin) |
595 | 18 | 19 | ||
596 | 19 | 20 | ||
597 | === modified file 'src/Ubuntu/Components/Styles/qmldir' | |||
598 | --- src/Ubuntu/Components/Styles/qmldir 2016-06-23 09:13:51 +0000 | |||
599 | +++ src/Ubuntu/Components/Styles/qmldir 2016-08-14 09:05:30 +0000 | |||
600 | @@ -12,3 +12,4 @@ | |||
601 | 12 | PageHeaderStyle 1.3 1.3/PageHeaderStyle.qml | 12 | PageHeaderStyle 1.3 1.3/PageHeaderStyle.qml |
602 | 13 | ToolbarStyle 1.3 1.3/ToolbarStyle.qml | 13 | ToolbarStyle 1.3 1.3/ToolbarStyle.qml |
603 | 14 | SectionsStyle 1.3 1.3/SectionsStyle.qml | 14 | SectionsStyle 1.3 1.3/SectionsStyle.qml |
604 | 15 | ActionItemProperties 1.3 1.3/ActionItemProperties.qml | ||
605 | 15 | 16 | ||
606 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml' | |||
607 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2015-12-09 21:41:45 +0000 | |||
608 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2016-08-14 09:05:30 +0000 | |||
609 | @@ -1,5 +1,5 @@ | |||
610 | 1 | /* | 1 | /* |
612 | 2 | * Copyright 2015 Canonical Ltd. | 2 | * Copyright 2016 Canonical Ltd. |
613 | 3 | * | 3 | * |
614 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
615 | 5 | * it under the terms of the GNU Lesser General Public License as published by | 5 | * it under the terms of the GNU Lesser General Public License as published by |
616 | @@ -28,19 +28,49 @@ | |||
617 | 28 | // Unused with the standard action icon buttons, but may be used with a custom delegate. | 28 | // Unused with the standard action icon buttons, but may be used with a custom delegate. |
618 | 29 | overflowText: "More" | 29 | overflowText: "More" |
619 | 30 | 30 | ||
620 | 31 | backgroundColor: theme.palette.normal.background | ||
621 | 32 | buttons { | ||
622 | 33 | foregroundColor: theme.palette.normal.backgroundText | ||
623 | 34 | pressedForegroundColor: buttons.foregroundColor | ||
624 | 35 | disabledForegroundColor: theme.palette.disabled.backgroundText | ||
625 | 36 | backgroundColor: "transparent" // action bar background is already colored | ||
626 | 37 | pressedBackgroundColor: theme.palette.highlighted.background | ||
627 | 38 | disabledBackgroundColor: buttons.backgroundColor | ||
628 | 39 | } | ||
629 | 40 | |||
630 | 31 | /*! | 41 | /*! |
631 | 32 | The default action delegate if the styled item does | 42 | The default action delegate if the styled item does |
632 | 33 | not provide a delegate. | 43 | not provide a delegate. |
633 | 34 | */ | 44 | */ |
639 | 35 | defaultDelegate: AbstractButton { | 45 | defaultDelegate: Component { |
640 | 36 | style: IconButtonStyle { } | 46 | AbstractButton { |
641 | 37 | objectName: action.objectName + "_button" | 47 | id: button |
642 | 38 | height: parent ? parent.height : undefined | 48 | style: IconButtonStyle { |
643 | 39 | action: modelData | 49 | foregroundColor: button.pressed ? |
644 | 50 | actionBarStyle.buttons.pressedForegroundColor : | ||
645 | 51 | button.enabled ? | ||
646 | 52 | actionBarStyle.buttons.foregroundColor : | ||
647 | 53 | actionBarStyle.buttons.disabledForegroundColor | ||
648 | 54 | backgroundColor: button.pressed ? | ||
649 | 55 | actionBarStyle.buttons.pressedBackgroundColor : | ||
650 | 56 | button.enabled ? | ||
651 | 57 | actionBarStyle.buttons.backgroundColor : | ||
652 | 58 | actionBarStyle.buttons.disabledBackgroundColor | ||
653 | 59 | } | ||
654 | 60 | objectName: action.objectName + "_button" | ||
655 | 61 | height: parent ? parent.height : undefined | ||
656 | 62 | action: modelData | ||
657 | 63 | } | ||
658 | 40 | } | 64 | } |
659 | 41 | 65 | ||
660 | 42 | defaultNumberOfSlots: 3 | 66 | defaultNumberOfSlots: 3 |
661 | 43 | 67 | ||
662 | 68 | Rectangle { | ||
663 | 69 | id: background | ||
664 | 70 | anchors.fill: parent | ||
665 | 71 | color: actionBarStyle.backgroundColor | ||
666 | 72 | } | ||
667 | 73 | |||
668 | 44 | Component { | 74 | Component { |
669 | 45 | id: fadeInComponent | 75 | id: fadeInComponent |
670 | 46 | SequentialAnimation { | 76 | SequentialAnimation { |
671 | 47 | 77 | ||
672 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml' | |||
673 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml 2016-02-09 15:56:48 +0000 | |||
674 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ComboButtonStyle.qml 2016-08-14 09:05:30 +0000 | |||
675 | @@ -237,6 +237,9 @@ | |||
676 | 237 | } | 237 | } |
677 | 238 | } | 238 | } |
678 | 239 | } | 239 | } |
679 | 240 | |||
680 | 241 | FocusShape { | ||
681 | 242 | } | ||
682 | 240 | } | 243 | } |
683 | 241 | 244 | ||
684 | 242 | Item { | 245 | Item { |
685 | @@ -247,7 +250,8 @@ | |||
686 | 247 | top: mainButton.bottom | 250 | top: mainButton.bottom |
687 | 248 | right: parent.right | 251 | right: parent.right |
688 | 249 | } | 252 | } |
690 | 250 | opacity: styledItem.expanded && (styledItem.comboList.length > 0)? 1.0 : 0.0 | 253 | // Hide panel to suppress keyboard input including (Shift)Tab |
691 | 254 | visible: styledItem.expanded && (styledItem.comboList.length > 0) | ||
692 | 251 | 255 | ||
693 | 252 | ShaderEffectSource { | 256 | ShaderEffectSource { |
694 | 253 | id: listContent | 257 | id: listContent |
695 | 254 | 258 | ||
696 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml' | |||
697 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2016-04-27 07:31:49 +0000 | |||
698 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2016-08-14 09:05:30 +0000 | |||
699 | @@ -26,7 +26,7 @@ | |||
700 | 26 | color: styledItem.enabled | 26 | color: styledItem.enabled |
701 | 27 | ? theme.palette.normal.focus | 27 | ? theme.palette.normal.focus |
702 | 28 | : theme.palette.disabled.focus | 28 | : theme.palette.disabled.focus |
704 | 29 | thickness: units.dp(1) | 29 | thickness: units.dp(2) |
705 | 30 | radius: units.gu(1.7) | 30 | radius: units.gu(1.7) |
706 | 31 | visible: styledItem.keyNavigationFocus | 31 | visible: styledItem.keyNavigationFocus |
707 | 32 | 32 | ||
708 | 33 | 33 | ||
709 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml' | |||
710 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-06-14 14:37:54 +0000 | |||
711 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-08-14 09:05:30 +0000 | |||
712 | @@ -26,6 +26,14 @@ | |||
713 | 26 | subtitleColor: theme.palette.normal.backgroundTertiaryText | 26 | subtitleColor: theme.palette.normal.backgroundTertiaryText |
714 | 27 | backgroundColor: theme.palette.normal.background | 27 | backgroundColor: theme.palette.normal.background |
715 | 28 | dividerColor: theme.palette.normal.base | 28 | dividerColor: theme.palette.normal.base |
716 | 29 | buttons { | ||
717 | 30 | foregroundColor: pageHeaderStyle.foregroundColor | ||
718 | 31 | disabledForegroundColor: pageHeaderStyle.disabledForegroundColor | ||
719 | 32 | pressedForegroundColor: buttons.foregroundColor | ||
720 | 33 | backgroundColor: "transparent" | ||
721 | 34 | pressedBackgroundColor: theme.palette.highlighted.background | ||
722 | 35 | disabledBackgroundColor: buttons.backgroundColor | ||
723 | 36 | } | ||
724 | 29 | 37 | ||
725 | 30 | // Font weight for the title and subtitle | 38 | // Font weight for the title and subtitle |
726 | 31 | property int fontWeight: Font.Light | 39 | property int fontWeight: Font.Light |
727 | @@ -84,13 +92,22 @@ | |||
728 | 84 | } | 92 | } |
729 | 85 | 93 | ||
730 | 86 | defaultActionDelegate: AbstractButton { | 94 | defaultActionDelegate: AbstractButton { |
731 | 95 | id: button | ||
732 | 87 | style: IconButtonStyle { } | 96 | style: IconButtonStyle { } |
733 | 88 | objectName: action.objectName + "_button" | 97 | objectName: action.objectName + "_button" |
734 | 89 | height: internal.titleAreaHeight | 98 | height: internal.titleAreaHeight |
735 | 90 | action: modelData | 99 | action: modelData |
736 | 91 | StyleHints { | 100 | StyleHints { |
739 | 92 | foregroundColor: enabled ? pageHeaderStyle.foregroundColor | 101 | foregroundColor: button.pressed ? |
740 | 93 | : pageHeaderStyle.disabledForegroundColor | 102 | pageHeaderStyle.buttons.pressedForegroundColor : |
741 | 103 | button.enabled ? | ||
742 | 104 | pageHeaderStyle.buttons.foregroundColor : | ||
743 | 105 | pageHeaderStyle.buttons.disabledForegroundColor | ||
744 | 106 | backgroundColor: button.pressed ? | ||
745 | 107 | pageHeaderStyle.buttons.pressedBackgroundColor : | ||
746 | 108 | button.enabled ? | ||
747 | 109 | pageHeaderStyle.buttons.backgroundColor : | ||
748 | 110 | pageHeaderStyle.buttons.disabledBackgroundColor | ||
749 | 94 | } | 111 | } |
750 | 95 | } | 112 | } |
751 | 96 | 113 | ||
752 | 97 | 114 | ||
753 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml' | |||
754 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml 2016-06-30 15:19:36 +0000 | |||
755 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml 2016-08-14 09:05:30 +0000 | |||
756 | @@ -114,7 +114,7 @@ | |||
757 | 114 | * HELPER PROPERTIES * | 114 | * HELPER PROPERTIES * |
758 | 115 | *****************************************************/ | 115 | *****************************************************/ |
759 | 116 | property alias thumb: slider | 116 | property alias thumb: slider |
761 | 117 | property Item trough: trough | 117 | property alias trough: trough |
762 | 118 | 118 | ||
763 | 119 | //helper properties to ease code readability | 119 | //helper properties to ease code readability |
764 | 120 | property bool isScrollable: styledItem.__private.scrollable && pageSize > 0.0 | 120 | property bool isScrollable: styledItem.__private.scrollable && pageSize > 0.0 |
765 | @@ -126,7 +126,8 @@ | |||
766 | 126 | property bool bottomAligned: (styledItem.align === Qt.AlignBottom) | 126 | property bool bottomAligned: (styledItem.align === Qt.AlignBottom) |
767 | 127 | 127 | ||
768 | 128 | //flickable helper properties | 128 | //flickable helper properties |
770 | 129 | property Flickable flickableItem: styledItem.flickableItem | 129 | //Don't do anything with the flickable until its Component.onCompleted is called, it's a waste of cycles |
771 | 130 | property Flickable flickableItem: styledItem.__initializedFlickable | ||
772 | 130 | property real pageSize: flickableItem | 131 | property real pageSize: flickableItem |
773 | 131 | ? (isVertical ? flickableItem.height : flickableItem.width) | 132 | ? (isVertical ? flickableItem.height : flickableItem.width) |
774 | 132 | : 0 | 133 | : 0 |
775 | @@ -233,14 +234,18 @@ | |||
776 | 233 | scrollAnimation.restart() | 234 | scrollAnimation.restart() |
777 | 234 | } else { | 235 | } else { |
778 | 235 | if (scrollAnimation.running) scrollAnimation.stop() | 236 | if (scrollAnimation.running) scrollAnimation.stop() |
781 | 236 | styledItem.flickableItem[scrollbarUtils.propContent] = value | 237 | if (flickableItem) { |
782 | 237 | styledItem.flickableItem.returnToBounds() | 238 | flickableItem[scrollbarUtils.propContent] = value |
783 | 239 | flickableItem.returnToBounds() | ||
784 | 240 | } | ||
785 | 238 | } | 241 | } |
786 | 239 | } | 242 | } |
787 | 240 | function scrollToBeginning(animate) { | 243 | function scrollToBeginning(animate) { |
788 | 244 | if (!flickableItem) return | ||
789 | 241 | scrollTo(flickableItem[scrollbarUtils.propOrigin] - visuals.leadingContentMargin, animate) | 245 | scrollTo(flickableItem[scrollbarUtils.propOrigin] - visuals.leadingContentMargin, animate) |
790 | 242 | } | 246 | } |
791 | 243 | function scrollToEnd(animate) { | 247 | function scrollToEnd(animate) { |
792 | 248 | if (!flickableItem) return | ||
793 | 244 | scrollTo((flickableItem[scrollbarUtils.propOrigin] | 249 | scrollTo((flickableItem[scrollbarUtils.propOrigin] |
794 | 245 | + totalContentSize - visuals.leadingContentMargin - pageSize), animate) | 250 | + totalContentSize - visuals.leadingContentMargin - pageSize), animate) |
795 | 246 | } | 251 | } |
796 | @@ -319,12 +324,14 @@ | |||
797 | 319 | Calculates the slider position based on the visible area's ratios. | 324 | Calculates the slider position based on the visible area's ratios. |
798 | 320 | */ | 325 | */ |
799 | 321 | function sliderPos(scrollbar, min, max) { | 326 | function sliderPos(scrollbar, min, max) { |
800 | 327 | if (!scrollbar.__initializedFlickable) return min | ||
801 | 328 | |||
802 | 322 | //the margin between the trough and the thumb min and max values | 329 | //the margin between the trough and the thumb min and max values |
803 | 323 | var margin = scrollbar.__styleInstance.thumbsExtremesMargin | 330 | var margin = scrollbar.__styleInstance.thumbsExtremesMargin |
804 | 324 | 331 | ||
805 | 325 | //The total length of the path where the thumb can be positioned, from its min to its max value | 332 | //The total length of the path where the thumb can be positioned, from its min to its max value |
808 | 326 | var draggableLength = scrollbar.__trough[propSize] - margin*2 | 333 | var draggableLength = visuals.trough[propSize] - margin*2 |
809 | 327 | var maxPosRatio = 1.0 - (scrollbar.flickableItem ? scrollbar.flickableItem.visibleArea[propSizeRatio] : 1.0) | 334 | var maxPosRatio = 1.0 - (scrollbar.__initializedFlickable ? scrollbar.__initializedFlickable.visibleArea[propSizeRatio] : 1.0) |
810 | 328 | 335 | ||
811 | 329 | //Example with x/width, same applies to y/height | 336 | //Example with x/width, same applies to y/height |
812 | 330 | //xPosition is in the range [0...1 - widthRatio] | 337 | //xPosition is in the range [0...1 - widthRatio] |
813 | @@ -335,7 +342,7 @@ | |||
814 | 335 | //the maxPosition is reached when xPosition becomes 1, and that never happens. To compensate that, we | 342 | //the maxPosition is reached when xPosition becomes 1, and that never happens. To compensate that, we |
815 | 336 | //scale xPosition by ( 1 / ( 1 - widthRatio) ). This way, when xPosition reaches its max ( 1 - widthRatio ) | 343 | //scale xPosition by ( 1 / ( 1 - widthRatio) ). This way, when xPosition reaches its max ( 1 - widthRatio ) |
816 | 337 | //we get a multiplication factor of 1 | 344 | //we get a multiplication factor of 1 |
818 | 338 | return MathUtils.clamp(1.0 / maxPosRatio * (scrollbar.flickableItem ? scrollbar.flickableItem.visibleArea[propPosRatio] : 1.0) | 345 | return MathUtils.clamp(1.0 / maxPosRatio * (scrollbar.__initializedFlickable ? scrollbar.__initializedFlickable.visibleArea[propPosRatio] : 1.0) |
819 | 339 | * (draggableLength - scrollbar.__styleInstance.thumb[propSize]) + margin, min, max); | 346 | * (draggableLength - scrollbar.__styleInstance.thumb[propSize]) + margin, min, max); |
820 | 340 | } | 347 | } |
821 | 341 | 348 | ||
822 | @@ -349,8 +356,10 @@ | |||
823 | 349 | THUMB CAN MOVE INTO! (which is what you want in 99.9% of the cases, for a scrollbar) | 356 | THUMB CAN MOVE INTO! (which is what you want in 99.9% of the cases, for a scrollbar) |
824 | 350 | */ | 357 | */ |
825 | 351 | function sliderSize(scrollbar, min, max) { | 358 | function sliderSize(scrollbar, min, max) { |
828 | 352 | var sizeRatio = scrollbar.flickableItem ? scrollbar.flickableItem.visibleArea[propSizeRatio] : 1.0; | 359 | if (!scrollbar.__initializedFlickable) return min |
829 | 353 | var posRatio = scrollbar.flickableItem ? scrollbar.flickableItem.visibleArea[propPosRatio] : 0.0; | 360 | |
830 | 361 | var sizeRatio = scrollbar.__initializedFlickable ? scrollbar.__initializedFlickable.visibleArea[propSizeRatio] : 1.0; | ||
831 | 362 | var posRatio = scrollbar.__initializedFlickable ? scrollbar.__initializedFlickable.visibleArea[propPosRatio] : 0.0; | ||
832 | 354 | 363 | ||
833 | 355 | //(sizeRatio * max) is the current ideal size, as recommended by Flickable visibleArea props | 364 | //(sizeRatio * max) is the current ideal size, as recommended by Flickable visibleArea props |
834 | 356 | var sizeUnderflow = (sizeRatio * max) < min ? min - (sizeRatio * max) : 0 | 365 | var sizeUnderflow = (sizeRatio * max) < min ? min - (sizeRatio * max) : 0 |
835 | @@ -385,9 +394,11 @@ | |||
836 | 385 | using an invisible cursor to drag the slider and the ListView position. | 394 | using an invisible cursor to drag the slider and the ListView position. |
837 | 386 | */ | 395 | */ |
838 | 387 | function scrollAndClamp(scrollbar, amount, min, max) { | 396 | function scrollAndClamp(scrollbar, amount, min, max) { |
842 | 388 | return scrollbar.flickableItem[propOrigin] + | 397 | if (!scrollbar.__initializedFlickable) return |
843 | 389 | MathUtils.clamp(scrollbar.flickableItem[propContent] | 398 | |
844 | 390 | - scrollbar.flickableItem[propOrigin] + amount, | 399 | return scrollbar.__initializedFlickable[propOrigin] + |
845 | 400 | MathUtils.clamp(scrollbar.__initializedFlickable[propContent] | ||
846 | 401 | - scrollbar.__initializedFlickable[propOrigin] + amount, | ||
847 | 391 | min, max); | 402 | min, max); |
848 | 392 | } | 403 | } |
849 | 393 | 404 | ||
850 | @@ -402,8 +413,10 @@ | |||
851 | 402 | NOTE: when flickable.topMargin is 5GU, contentY has to be -5GU (not 0!) to be at the top of the scrollable!! | 413 | NOTE: when flickable.topMargin is 5GU, contentY has to be -5GU (not 0!) to be at the top of the scrollable!! |
852 | 403 | */ | 414 | */ |
853 | 404 | function dragAndClamp(scrollbar, relThumbPosition, contentSize, pageSize) { | 415 | function dragAndClamp(scrollbar, relThumbPosition, contentSize, pageSize) { |
856 | 405 | scrollbar.flickableItem[propContent] = | 416 | if (!scrollbar.__initializedFlickable) return |
857 | 406 | scrollbar.flickableItem[propOrigin] + relThumbPosition * (contentSize - scrollbar.flickableItem[propSize]) - leadingContentMargin; //don't use pageSize, we don't know if the scrollbar is edge to edge!; | 417 | |
858 | 418 | scrollbar.__initializedFlickable[propContent] = | ||
859 | 419 | scrollbar.__initializedFlickable[propOrigin] + relThumbPosition * (contentSize - scrollbar.__initializedFlickable[propSize]) - leadingContentMargin; //don't use pageSize, we don't know if the scrollbar is edge to edge!; | ||
860 | 407 | } | 420 | } |
861 | 408 | } | 421 | } |
862 | 409 | 422 | ||
863 | @@ -424,7 +437,7 @@ | |||
864 | 424 | //duration and easing coming from UX spec | 437 | //duration and easing coming from UX spec |
865 | 425 | duration: UbuntuAnimation.SlowDuration | 438 | duration: UbuntuAnimation.SlowDuration |
866 | 426 | easing.type: Easing.InOutCubic | 439 | easing.type: Easing.InOutCubic |
868 | 427 | target: styledItem.flickableItem | 440 | target: flickableItem |
869 | 428 | property: scrollbarUtils.propContent | 441 | property: scrollbarUtils.propContent |
870 | 429 | //when the listview has variable size delegates the contentHeight estimation done by ListView | 442 | //when the listview has variable size delegates the contentHeight estimation done by ListView |
871 | 430 | //could make us overshoot, especially when going from top to bottom of the list or viceversa. | 443 | //could make us overshoot, especially when going from top to bottom of the list or viceversa. |
872 | @@ -748,7 +761,7 @@ | |||
873 | 748 | pressHoldTimer.stop() | 761 | pressHoldTimer.stop() |
874 | 749 | } | 762 | } |
875 | 750 | onReleased: { | 763 | onReleased: { |
877 | 751 | hoveringThumb = false | 764 | handleHover(mouseX, mouseY) |
878 | 752 | resetDrag() | 765 | resetDrag() |
879 | 753 | pressHoldTimer.stop() | 766 | pressHoldTimer.stop() |
880 | 754 | } | 767 | } |
881 | @@ -939,7 +952,9 @@ | |||
882 | 939 | anchors.centerIn: parent | 952 | anchors.centerIn: parent |
883 | 940 | width: __stepperAssetWidth | 953 | width: __stepperAssetWidth |
884 | 941 | rotation: isVertical ? 180 : 90 | 954 | rotation: isVertical ? 180 : 90 |
886 | 942 | source: visible ? Qt.resolvedUrl("../artwork/toolkit_scrollbar-stepper.svg") : "" | 955 | //NOTE: Qt.resolvedUrl was removed because it does not seem to be needed and |
887 | 956 | //the QML profiler showed it's relatively expensive | ||
888 | 957 | source: visible ? "../artwork/toolkit_scrollbar-stepper.svg" : "" | ||
889 | 943 | asynchronous: true | 958 | asynchronous: true |
890 | 944 | color: Qt.rgba(sliderColor.r, sliderColor.g, sliderColor.b, | 959 | color: Qt.rgba(sliderColor.r, sliderColor.g, sliderColor.b, |
891 | 945 | sliderColor.a * ((flickableItem && flickableItem[scrollbarUtils.propAtBeginning]) | 960 | sliderColor.a * ((flickableItem && flickableItem[scrollbarUtils.propAtBeginning]) |
892 | @@ -983,7 +998,9 @@ | |||
893 | 983 | anchors.centerIn: parent | 998 | anchors.centerIn: parent |
894 | 984 | width: __stepperAssetWidth | 999 | width: __stepperAssetWidth |
895 | 985 | rotation: isVertical ? 0 : -90 | 1000 | rotation: isVertical ? 0 : -90 |
897 | 986 | source: visible ? Qt.resolvedUrl("../artwork/toolkit_scrollbar-stepper.svg") : "" | 1001 | //NOTE: Qt.resolvedUrl was removed because it does not seem to be needed and |
898 | 1002 | //the QML profiler showed it's relatively expensive | ||
899 | 1003 | source: visible ? "../artwork/toolkit_scrollbar-stepper.svg" : "" | ||
900 | 987 | asynchronous: true | 1004 | asynchronous: true |
901 | 988 | color: Qt.rgba(sliderColor.r, sliderColor.g, sliderColor.b, | 1005 | color: Qt.rgba(sliderColor.r, sliderColor.g, sliderColor.b, |
902 | 989 | sliderColor.a * ((flickableItem && flickableItem[scrollbarUtils.propAtEnd]) | 1006 | sliderColor.a * ((flickableItem && flickableItem[scrollbarUtils.propAtEnd]) |
903 | @@ -999,6 +1016,9 @@ | |||
904 | 999 | //just a hack: a rectangle which covers the corner where scrollbars meet, when they're in steppers style | 1016 | //just a hack: a rectangle which covers the corner where scrollbars meet, when they're in steppers style |
905 | 1000 | Rectangle { | 1017 | Rectangle { |
906 | 1001 | id: cornerRect | 1018 | id: cornerRect |
907 | 1019 | //NOTE: I tried grouping styledItem.__buddyScrollbar && styledItem.__buddyScrollbar.__styleInstance | ||
908 | 1020 | // && styledItem.__buddyScrollbar.__styleInstance.isScrollable in 1 property and use that for | ||
909 | 1021 | //all the anchors, but it turned out it makes the instantiation 2-3% slower!!! | ||
910 | 1002 | anchors.left: { | 1022 | anchors.left: { |
911 | 1003 | if (styledItem.__buddyScrollbar && styledItem.__buddyScrollbar.__styleInstance | 1023 | if (styledItem.__buddyScrollbar && styledItem.__buddyScrollbar.__styleInstance |
912 | 1004 | && styledItem.__buddyScrollbar.__styleInstance.isScrollable) { | 1024 | && styledItem.__buddyScrollbar.__styleInstance.isScrollable) { |
913 | 1005 | 1025 | ||
914 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml' | |||
915 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-06-13 15:57:20 +0000 | |||
916 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-08-14 09:05:30 +0000 | |||
917 | @@ -287,6 +287,7 @@ | |||
918 | 287 | width: units.gu(1) | 287 | width: units.gu(1) |
919 | 288 | height: units.gu(1) | 288 | height: units.gu(1) |
920 | 289 | visible: false | 289 | visible: false |
921 | 290 | asynchronous: true | ||
922 | 290 | rotation: 180 | 291 | rotation: 180 |
923 | 291 | opacity: visible | 292 | opacity: visible |
924 | 292 | ? sectionsListView.atXBeginning ? hoveringArea.iconsDisabledOpacity : 1.0 | 293 | ? sectionsListView.atXBeginning ? hoveringArea.iconsDisabledOpacity : 1.0 |
925 | @@ -316,6 +317,7 @@ | |||
926 | 316 | width: units.gu(1) | 317 | width: units.gu(1) |
927 | 317 | height: units.gu(1) | 318 | height: units.gu(1) |
928 | 318 | visible: false | 319 | visible: false |
929 | 320 | asynchronous: true | ||
930 | 319 | opacity: visible | 321 | opacity: visible |
931 | 320 | ? sectionsListView.atXEnd ? hoveringArea.iconsDisabledOpacity : 1.0 | 322 | ? sectionsListView.atXEnd ? hoveringArea.iconsDisabledOpacity : 1.0 |
932 | 321 | : 0.0 | 323 | : 0.0 |
933 | 322 | 324 | ||
934 | === modified file 'src/Ubuntu/UbuntuToolkit/UbuntuToolkit.pro' | |||
935 | --- src/Ubuntu/UbuntuToolkit/UbuntuToolkit.pro 2016-07-07 07:21:48 +0000 | |||
936 | +++ src/Ubuntu/UbuntuToolkit/UbuntuToolkit.pro 2016-08-14 09:05:30 +0000 | |||
937 | @@ -148,7 +148,8 @@ | |||
938 | 148 | privates/ucpagewrapperincubator_p.h \ | 148 | privates/ucpagewrapperincubator_p.h \ |
939 | 149 | privates/appheaderbase_p.h \ | 149 | privates/appheaderbase_p.h \ |
940 | 150 | label_p.h \ | 150 | label_p.h \ |
942 | 151 | ucbottomedgeregion_p_p.h | 151 | ucbottomedgeregion_p_p.h \ |
943 | 152 | privates/ucscrollbarutils_p.h | ||
944 | 152 | 153 | ||
945 | 153 | SOURCES += \ | 154 | SOURCES += \ |
946 | 154 | uctheme.cpp \ | 155 | uctheme.cpp \ |
947 | @@ -224,7 +225,8 @@ | |||
948 | 224 | privates/frame.cpp \ | 225 | privates/frame.cpp \ |
949 | 225 | privates/ucpagewrapper.cpp \ | 226 | privates/ucpagewrapper.cpp \ |
950 | 226 | privates/ucpagewrapperincubator.cpp \ | 227 | privates/ucpagewrapperincubator.cpp \ |
952 | 227 | privates/appheaderbase.cpp | 228 | privates/appheaderbase.cpp \ |
953 | 229 | privates/ucscrollbarutils.cpp | ||
954 | 228 | 230 | ||
955 | 229 | # adapters | 231 | # adapters |
956 | 230 | SOURCES += $$PWD/adapters/alarmsadapter_organizer.cpp | 232 | SOURCES += $$PWD/adapters/alarmsadapter_organizer.cpp |
957 | 231 | 233 | ||
958 | === modified file 'src/Ubuntu/UbuntuToolkit/privates/listviewextensions.cpp' | |||
959 | --- src/Ubuntu/UbuntuToolkit/privates/listviewextensions.cpp 2016-07-07 07:21:48 +0000 | |||
960 | +++ src/Ubuntu/UbuntuToolkit/privates/listviewextensions.cpp 2016-08-14 09:05:30 +0000 | |||
961 | @@ -21,6 +21,7 @@ | |||
962 | 21 | #include "quickutils_p.h" | 21 | #include "quickutils_p.h" |
963 | 22 | #include <QtQuick/QQuickItem> | 22 | #include <QtQuick/QQuickItem> |
964 | 23 | #include <QtQuick/private/qquickflickable_p.h> | 23 | #include <QtQuick/private/qquickflickable_p.h> |
965 | 24 | #include <QtQuick/private/qquickitemview_p.h> // for QQuickItemView::BottomToTop | ||
966 | 24 | 25 | ||
967 | 25 | UT_NAMESPACE_BEGIN | 26 | UT_NAMESPACE_BEGIN |
968 | 26 | 27 | ||
969 | @@ -127,7 +128,7 @@ | |||
970 | 127 | return false; | 128 | return false; |
971 | 128 | } | 129 | } |
972 | 129 | 130 | ||
974 | 130 | // override up/down key presses for ListView; returns true if the key event is consumed | 131 | // override cursor key presses for ListView; returns true if the key event is consumed |
975 | 131 | // in which case ListView won't get it. | 132 | // in which case ListView won't get it. |
976 | 132 | bool ListViewProxy::keyPressEvent(QKeyEvent *event) | 133 | bool ListViewProxy::keyPressEvent(QKeyEvent *event) |
977 | 133 | { | 134 | { |
978 | @@ -138,9 +139,10 @@ | |||
979 | 138 | || (orientation == Qt::Horizontal && key != Qt::Key_Left && key != Qt::Key_Right)) { | 139 | || (orientation == Qt::Horizontal && key != Qt::Key_Left && key != Qt::Key_Right)) { |
980 | 139 | return false; | 140 | return false; |
981 | 140 | } | 141 | } |
985 | 141 | // for horizontal moves take into account the layout mirroring | 142 | // effectiveLayoutDirection takes into account effectiveLayoutMirror and layoutDirection. |
986 | 142 | bool isRtl = QQuickItemPrivate::get(listView)->effectiveLayoutMirror; | 143 | bool isRtl = (Qt::RightToLeft == listView->property("effectiveLayoutDirection").toInt()); |
987 | 143 | bool forwards = (key == Qt::Key_Down || (isRtl ? key == Qt::Key_Left : key == Qt::Key_Right)); | 144 | bool isBtt = (QQuickItemView::BottomToTop == listView->property("verticalLayoutDirection").toInt()); |
988 | 145 | bool forwards = (isBtt ? key == Qt::Key_Up : key == Qt::Key_Down) || (isRtl ? key == Qt::Key_Left : key == Qt::Key_Right); | ||
989 | 144 | int oldIndex = this->currentIndex(); | 146 | int oldIndex = this->currentIndex(); |
990 | 145 | int currentIndex = this->currentIndex(); | 147 | int currentIndex = this->currentIndex(); |
991 | 146 | int count = this->count(); | 148 | int count = this->count(); |
992 | 147 | 149 | ||
993 | === modified file 'src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp' | |||
994 | --- src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp 2016-07-07 07:21:48 +0000 | |||
995 | +++ src/Ubuntu/UbuntuToolkit/privates/threelabelsslot_p.cpp 2016-08-14 09:05:30 +0000 | |||
996 | @@ -44,6 +44,8 @@ | |||
997 | 44 | //Using WrapAnywhere because ElideRight elides too early when used | 44 | //Using WrapAnywhere because ElideRight elides too early when used |
998 | 45 | //together with WrapWord, and that produces an unexpected result. | 45 | //together with WrapWord, and that produces an unexpected result. |
999 | 46 | //This will cover most of the usecases. | 46 | //This will cover most of the usecases. |
1000 | 47 | //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to | ||
1001 | 48 | //set wrapMode to NoWrap (see Text docs for more details) | ||
1002 | 47 | m_title->setWrapMode(UCLabel::WrapAnywhere); | 49 | m_title->setWrapMode(UCLabel::WrapAnywhere); |
1003 | 48 | m_title->setElideMode(UCLabel::ElideRight); | 50 | m_title->setElideMode(UCLabel::ElideRight); |
1004 | 49 | m_title->setMaximumLineCount(1); | 51 | m_title->setMaximumLineCount(1); |
1005 | @@ -55,6 +57,8 @@ | |||
1006 | 55 | { | 57 | { |
1007 | 56 | if (m_subtitle != Q_NULLPTR) { | 58 | if (m_subtitle != Q_NULLPTR) { |
1008 | 57 | m_subtitle->setWrapMode(UCLabel::WrapAnywhere); | 59 | m_subtitle->setWrapMode(UCLabel::WrapAnywhere); |
1009 | 60 | //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to | ||
1010 | 61 | //set wrapMode to NoWrap (see Text docs for more details) | ||
1011 | 58 | m_subtitle->setElideMode(UCLabel::ElideRight); | 62 | m_subtitle->setElideMode(UCLabel::ElideRight); |
1012 | 59 | m_subtitle->setMaximumLineCount(1); | 63 | m_subtitle->setMaximumLineCount(1); |
1013 | 60 | m_subtitle->setTextSize(UCLabel::Small); | 64 | m_subtitle->setTextSize(UCLabel::Small); |
1014 | @@ -65,6 +69,8 @@ | |||
1015 | 65 | { | 69 | { |
1016 | 66 | if (m_summary != Q_NULLPTR) { | 70 | if (m_summary != Q_NULLPTR) { |
1017 | 67 | m_summary->setWrapMode(UCLabel::WrapAnywhere); | 71 | m_summary->setWrapMode(UCLabel::WrapAnywhere); |
1018 | 72 | //NOTE: If you want to use ElideMiddle or ElideLeft you'll have to | ||
1019 | 73 | //set wrapMode to NoWrap (see Text docs for more details) | ||
1020 | 68 | m_summary->setElideMode(UCLabel::ElideRight); | 74 | m_summary->setElideMode(UCLabel::ElideRight); |
1021 | 69 | m_summary->setMaximumLineCount(2); | 75 | m_summary->setMaximumLineCount(2); |
1022 | 70 | m_summary->setTextSize(UCLabel::Small); | 76 | m_summary->setTextSize(UCLabel::Small); |
1023 | 71 | 77 | ||
1024 | === modified file 'src/Ubuntu/UbuntuToolkit/privates/ucpagewrapper.cpp' | |||
1025 | --- src/Ubuntu/UbuntuToolkit/privates/ucpagewrapper.cpp 2016-07-07 08:42:42 +0000 | |||
1026 | +++ src/Ubuntu/UbuntuToolkit/privates/ucpagewrapper.cpp 2016-08-14 09:05:30 +0000 | |||
1027 | @@ -208,8 +208,21 @@ | |||
1028 | 208 | 208 | ||
1029 | 209 | QQmlContext *context = m_itemContext ? m_itemContext : qmlContext(target); | 209 | QQmlContext *context = m_itemContext ? m_itemContext : qmlContext(target); |
1030 | 210 | for (;i != propMap.constEnd(); i++) { | 210 | for (;i != propMap.constEnd(); i++) { |
1033 | 211 | if (!QQmlProperty::write(target, i.key(), i.value(), context)) { | 211 | QQmlProperty prop(target, i.key(), context); |
1034 | 212 | qmlInfo(q) << "Could not assign value: "<<i.value()<<"to property: "<<i.key(); | 212 | bool convertible = true; |
1035 | 213 | if (!qstrcmp(i.value().typeName(),"void*")) { | ||
1036 | 214 | // we have void*, we cannot convert that one, so we must force the conversion | ||
1037 | 215 | void *pvalue = i.value().value<void*>(); | ||
1038 | 216 | QVariant value(QVariant::Type(prop.propertyType()), pvalue); | ||
1039 | 217 | convertible = value.isValid(); | ||
1040 | 218 | if (convertible) { | ||
1041 | 219 | convertible = prop.write(value); | ||
1042 | 220 | } | ||
1043 | 221 | } else { | ||
1044 | 222 | convertible = prop.write(i.value()); | ||
1045 | 223 | } | ||
1046 | 224 | if (!convertible) { | ||
1047 | 225 | qmlInfo(q) << "Could not assign value: " << i.value() << " to property: " << i.key(); | ||
1048 | 213 | } | 226 | } |
1049 | 214 | } | 227 | } |
1050 | 215 | } | 228 | } |
1051 | 216 | 229 | ||
1052 | === added file 'src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils.cpp' | |||
1053 | --- src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils.cpp 1970-01-01 00:00:00 +0000 | |||
1054 | +++ src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils.cpp 2016-08-14 09:05:30 +0000 | |||
1055 | @@ -0,0 +1,44 @@ | |||
1056 | 1 | /* | ||
1057 | 2 | * Copyright 2016 Canonical Ltd. | ||
1058 | 3 | * | ||
1059 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1060 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1061 | 6 | * the Free Software Foundation; version 3. | ||
1062 | 7 | * | ||
1063 | 8 | * This program is distributed in the hope that it will be useful, | ||
1064 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1065 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1066 | 11 | * GNU Lesser General Public License for more details. | ||
1067 | 12 | * | ||
1068 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1069 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1070 | 15 | * | ||
1071 | 16 | * Author: Andrea Bernabei <andrea.bernabei@canonical.com> | ||
1072 | 17 | */ | ||
1073 | 18 | |||
1074 | 19 | #include "ucscrollbarutils_p.h" | ||
1075 | 20 | #include <QtQuick/private/qquickitem_p.h> | ||
1076 | 21 | |||
1077 | 22 | UT_NAMESPACE_BEGIN | ||
1078 | 23 | |||
1079 | 24 | UCScrollbarUtils::UCScrollbarUtils(QObject *parent) : QObject(parent) | ||
1080 | 25 | { | ||
1081 | 26 | } | ||
1082 | 27 | |||
1083 | 28 | bool UCScrollbarUtils::isComponentComplete(QQuickItem *item) | ||
1084 | 29 | { | ||
1085 | 30 | if (item == Q_NULLPTR) { | ||
1086 | 31 | qDebug() << "ScrollbarUtils: null Item parameter."; | ||
1087 | 32 | return false; | ||
1088 | 33 | } else { | ||
1089 | 34 | QQuickItemPrivate *f = QQuickItemPrivate::get(item); | ||
1090 | 35 | if (f == Q_NULLPTR) { | ||
1091 | 36 | //don't fall apart, but give a warning | ||
1092 | 37 | qDebug() << "ScrollbarUtils: failed to get item's pimpl."; | ||
1093 | 38 | return false; | ||
1094 | 39 | } | ||
1095 | 40 | return f->componentComplete; | ||
1096 | 41 | } | ||
1097 | 42 | } | ||
1098 | 43 | |||
1099 | 44 | UT_NAMESPACE_END | ||
1100 | 0 | 45 | ||
1101 | === added file 'src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils_p.h' | |||
1102 | --- src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils_p.h 1970-01-01 00:00:00 +0000 | |||
1103 | +++ src/Ubuntu/UbuntuToolkit/privates/ucscrollbarutils_p.h 2016-08-14 09:05:30 +0000 | |||
1104 | @@ -0,0 +1,41 @@ | |||
1105 | 1 | /* | ||
1106 | 2 | * Copyright 2016 Canonical Ltd. | ||
1107 | 3 | * | ||
1108 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1109 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1110 | 6 | * the Free Software Foundation; version 3. | ||
1111 | 7 | * | ||
1112 | 8 | * This program is distributed in the hope that it will be useful, | ||
1113 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1114 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1115 | 11 | * GNU Lesser General Public License for more details. | ||
1116 | 12 | * | ||
1117 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1118 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1119 | 15 | * | ||
1120 | 16 | * Author: Andrea Bernabei <andrea.bernabei@canonical.com> | ||
1121 | 17 | */ | ||
1122 | 18 | |||
1123 | 19 | #ifndef UCSCROLLBARUTILS_H | ||
1124 | 20 | #define UCSCROLLBARUTILS_H | ||
1125 | 21 | |||
1126 | 22 | #include <QObject> | ||
1127 | 23 | #include <ubuntutoolkitglobal.h> | ||
1128 | 24 | |||
1129 | 25 | class QQuickItem; | ||
1130 | 26 | |||
1131 | 27 | UT_NAMESPACE_BEGIN | ||
1132 | 28 | |||
1133 | 29 | class UBUNTUTOOLKIT_EXPORT UCScrollbarUtils : public QObject | ||
1134 | 30 | { | ||
1135 | 31 | Q_OBJECT | ||
1136 | 32 | public: | ||
1137 | 33 | explicit UCScrollbarUtils(QObject *parent = 0); | ||
1138 | 34 | |||
1139 | 35 | Q_INVOKABLE static bool isComponentComplete(QQuickItem *item); | ||
1140 | 36 | |||
1141 | 37 | }; | ||
1142 | 38 | |||
1143 | 39 | UT_NAMESPACE_END | ||
1144 | 40 | |||
1145 | 41 | #endif // UCSCROLLBARUTILS_H | ||
1146 | 0 | 42 | ||
1147 | === modified file 'src/Ubuntu/UbuntuToolkit/ubuntutoolkitmodule.cpp' | |||
1148 | --- src/Ubuntu/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-07-07 07:21:48 +0000 | |||
1149 | +++ src/Ubuntu/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-08-14 09:05:30 +0000 | |||
1150 | @@ -88,6 +88,7 @@ | |||
1151 | 88 | #include <privates/frame_p.h> | 88 | #include <privates/frame_p.h> |
1152 | 89 | #include <privates/ucpagewrapper_p.h> | 89 | #include <privates/ucpagewrapper_p.h> |
1153 | 90 | #include <privates/appheaderbase_p.h> | 90 | #include <privates/appheaderbase_p.h> |
1154 | 91 | #include <privates/ucscrollbarutils_p.h> | ||
1155 | 91 | 92 | ||
1156 | 92 | // styles | 93 | // styles |
1157 | 93 | #include <ucbottomedgestyle_p.h> | 94 | #include <ucbottomedgestyle_p.h> |
1158 | @@ -245,6 +246,9 @@ | |||
1159 | 245 | qmlRegisterType<UCAppHeaderBase>(privateUri, 1, 3, "AppHeaderBase"); | 246 | qmlRegisterType<UCAppHeaderBase>(privateUri, 1, 3, "AppHeaderBase"); |
1160 | 246 | qmlRegisterType<Tree>(privateUri, 1, 3, "Tree"); | 247 | qmlRegisterType<Tree>(privateUri, 1, 3, "Tree"); |
1161 | 247 | 248 | ||
1162 | 249 | //FIXME: move to a more generic location, i.e StyledItem or QuickUtils | ||
1163 | 250 | qmlRegisterSimpleSingletonType<UCScrollbarUtils>(privateUri, 1, 3, "PrivateScrollbarUtils"); | ||
1164 | 251 | |||
1165 | 248 | // allocate all context property objects prior we register them | 252 | // allocate all context property objects prior we register them |
1166 | 249 | initializeContextProperties(engine); | 253 | initializeContextProperties(engine); |
1167 | 250 | 254 | ||
1168 | 251 | 255 | ||
1169 | === modified file 'src/Ubuntu/UbuntuToolkit/ucabstractbutton.cpp' | |||
1170 | --- src/Ubuntu/UbuntuToolkit/ucabstractbutton.cpp 2016-07-07 08:42:42 +0000 | |||
1171 | +++ src/Ubuntu/UbuntuToolkit/ucabstractbutton.cpp 2016-08-14 09:05:30 +0000 | |||
1172 | @@ -35,12 +35,12 @@ | |||
1173 | 35 | , acceptEvents(true) | 35 | , acceptEvents(true) |
1174 | 36 | , pressAndHoldConnected(false) | 36 | , pressAndHoldConnected(false) |
1175 | 37 | { | 37 | { |
1176 | 38 | isFocusScope = false; | ||
1177 | 38 | } | 39 | } |
1178 | 39 | void UCAbstractButtonPrivate::init() | 40 | void UCAbstractButtonPrivate::init() |
1179 | 40 | { | 41 | { |
1180 | 41 | Q_Q(UCAbstractButton); | 42 | Q_Q(UCAbstractButton); |
1181 | 42 | q->setActiveFocusOnPress(true); | 43 | q->setActiveFocusOnPress(true); |
1182 | 43 | q->setActiveFocusOnTab(true); | ||
1183 | 44 | } | 44 | } |
1184 | 45 | 45 | ||
1185 | 46 | /*! | 46 | /*! |
1186 | 47 | 47 | ||
1187 | === modified file 'src/Ubuntu/UbuntuToolkit/ucbottomedgeregion.cpp' | |||
1188 | --- src/Ubuntu/UbuntuToolkit/ucbottomedgeregion.cpp 2016-07-07 08:42:42 +0000 | |||
1189 | +++ src/Ubuntu/UbuntuToolkit/ucbottomedgeregion.cpp 2016-08-14 09:05:30 +0000 | |||
1190 | @@ -382,7 +382,7 @@ | |||
1191 | 382 | d->url = url; | 382 | d->url = url; |
1192 | 383 | Q_EMIT contentChanged(d->url); | 383 | Q_EMIT contentChanged(d->url); |
1193 | 384 | // invoke loader if the preload is set | 384 | // invoke loader if the preload is set |
1195 | 385 | if (d->bottomEdge && (d->bottomEdge->preloadContent()) && !d->url.isValid()) { | 385 | if (d->bottomEdge && (d->bottomEdge->preloadContent()) && d->url.isValid()) { |
1196 | 386 | d->loadContent(UCBottomEdgeRegionPrivate::LoadingUrl); | 386 | d->loadContent(UCBottomEdgeRegionPrivate::LoadingUrl); |
1197 | 387 | } | 387 | } |
1198 | 388 | } | 388 | } |
1199 | 389 | 389 | ||
1200 | === modified file 'src/Ubuntu/UbuntuToolkit/uclistitem.cpp' | |||
1201 | --- src/Ubuntu/UbuntuToolkit/uclistitem.cpp 2016-07-07 08:42:42 +0000 | |||
1202 | +++ src/Ubuntu/UbuntuToolkit/uclistitem.cpp 2016-08-14 09:05:30 +0000 | |||
1203 | @@ -1127,7 +1127,7 @@ | |||
1204 | 1127 | 1127 | ||
1205 | 1128 | // focus frame | 1128 | // focus frame |
1206 | 1129 | bool paintFocus = hasActiveFocus() && keyNavigationFocus(); | 1129 | bool paintFocus = hasActiveFocus() && keyNavigationFocus(); |
1208 | 1130 | rectNode->setPenWidth(paintFocus ? UCUnits::instance()->dp(1) : 0); | 1130 | rectNode->setPenWidth(paintFocus ? UCUnits::instance()->dp(2) : 0); |
1209 | 1131 | if (paintFocus) { | 1131 | if (paintFocus) { |
1210 | 1132 | QColor penColor; | 1132 | QColor penColor; |
1211 | 1133 | if (getTheme()) { | 1133 | if (getTheme()) { |
1212 | 1134 | 1134 | ||
1213 | === modified file 'src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp' | |||
1214 | --- src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp 2016-07-07 07:21:48 +0000 | |||
1215 | +++ src/Ubuntu/UbuntuToolkit/uclistitemlayout.cpp 2016-08-14 09:05:30 +0000 | |||
1216 | @@ -40,6 +40,11 @@ | |||
1217 | 40 | ListItemLayout is essentially a \l {SlotsLayout} with a predefined | 40 | ListItemLayout is essentially a \l {SlotsLayout} with a predefined |
1218 | 41 | \l {SlotsLayout::mainSlot} that provides (up to) 3 Labels automatically laid out | 41 | \l {SlotsLayout::mainSlot} that provides (up to) 3 Labels automatically laid out |
1219 | 42 | according to our UI guidelines. | 42 | according to our UI guidelines. |
1220 | 43 | |||
1221 | 44 | \b Note: those labels may have properties whose default value is different | ||
1222 | 45 | from what is used by the standard Label component. The default wrapMode, | ||
1223 | 46 | for instance, is different. Have a look at \l {Labels' properties} section. | ||
1224 | 47 | |||
1225 | 43 | This main slot has been optimized to cover most of the usecases | 48 | This main slot has been optimized to cover most of the usecases |
1226 | 44 | without compromising performance (read more in \l {Optimizing memory consumption}). | 49 | without compromising performance (read more in \l {Optimizing memory consumption}). |
1227 | 45 | 50 | ||
1228 | @@ -59,6 +64,28 @@ | |||
1229 | 59 | we made it possible to tweak the position of each slot by modifying | 64 | we made it possible to tweak the position of each slot by modifying |
1230 | 60 | its attached properties (see \l {Advanced layout tweaks}). | 65 | its attached properties (see \l {Advanced layout tweaks}). |
1231 | 61 | 66 | ||
1232 | 67 | \b Note that if you're wrapping the ListItemLayout in a container such | ||
1233 | 68 | as \l {ListItem}, \b {you will have to specify the height of the container so that | ||
1234 | 69 | it follows ListItemLayout's height}, otherwise the layout content may appear clipped or | ||
1235 | 70 | not vertically centered. | ||
1236 | 71 | |||
1237 | 72 | See \b {\l {Resizing the layout} {here}} for more details. Here's an example: | ||
1238 | 73 | \qml | ||
1239 | 74 | import QtQuick 2.4 | ||
1240 | 75 | import Ubuntu.Component 1.3 | ||
1241 | 76 | ListItem { | ||
1242 | 77 | //CORRECT, ListItem will be tall enough to accomodate all the content | ||
1243 | 78 | height: layout.height + (divider.visible ? divider.height : 0) | ||
1244 | 79 | |||
1245 | 80 | ListItemLayout { | ||
1246 | 81 | id: layout | ||
1247 | 82 | title.text: "Hello developers!" | ||
1248 | 83 | subtitle.text: "I am a ListItemLayout" | ||
1249 | 84 | summary.text: "I resize automatically to accomodate all the elements I hold. My parents should track my height property!" | ||
1250 | 85 | } | ||
1251 | 86 | } | ||
1252 | 87 | \endqml | ||
1253 | 88 | |||
1254 | 62 | If you need a progression symbol in your list item, | 89 | If you need a progression symbol in your list item, |
1255 | 63 | just add \l ProgressionSlot as a child of your ListItemLayout. | 90 | just add \l ProgressionSlot as a child of your ListItemLayout. |
1256 | 64 | No manual positioning is needed, the layout will handle it for you. | 91 | No manual positioning is needed, the layout will handle it for you. |
1257 | @@ -186,6 +213,39 @@ | |||
1258 | 186 | to have the same height even without having to fill \l subtitle's (or summary's) | 213 | to have the same height even without having to fill \l subtitle's (or summary's) |
1259 | 187 | text with dummy content. | 214 | text with dummy content. |
1260 | 188 | 215 | ||
1261 | 216 | \section1 Labels' properties | ||
1262 | 217 | |||
1263 | 218 | ListItemLayout's labels are the same component as \l {Label}, but with slightly different | ||
1264 | 219 | default properties. Moreover, \l Label derives from \l {Text}. As a consequence, | ||
1265 | 220 | you can access and override all the properties provided by \l {Text} and \l {Label}, if needed. Please | ||
1266 | 221 | refer to \l {Text}'s and \l {Label}'s documentation to see the list of all the properties. | ||
1267 | 222 | |||
1268 | 223 | The default values for ListItemLayout's labels are defined in the documentation of each label. | ||
1269 | 224 | See \l title, \l subtitle and \l summary. | ||
1270 | 225 | |||
1271 | 226 | \b Note: if you want to change the elide mode of a label to something other than \c Text.ElideRight, | ||
1272 | 227 | make sure its \c wrapMode is set to \c Text.NoWrap. See \l Text::wrapMode for more details. | ||
1273 | 228 | |||
1274 | 229 | \qml | ||
1275 | 230 | import QtQuick 2.4 | ||
1276 | 231 | import Ubuntu.Components 1.3 | ||
1277 | 232 | Item { | ||
1278 | 233 | width: units.gu(30) | ||
1279 | 234 | height: units.gu(50) | ||
1280 | 235 | ListItem { | ||
1281 | 236 | height: layout.height + (divider.visible ? divider.height : 0) | ||
1282 | 237 | ListItemLayout { | ||
1283 | 238 | id: fileLayout | ||
1284 | 239 | //Let's change the default elide mode to Text.ElideMiddle | ||
1285 | 240 | title.elide: Text.ElideMiddle | ||
1286 | 241 | //ElideMiddle only works if there is no wrapping (see Text::wrapMode doc) | ||
1287 | 242 | title.wrapMode: Text.NoWrap | ||
1288 | 243 | title.text: "Red Roses run no risk, sir, on nurses order." | ||
1289 | 244 | } | ||
1290 | 245 | } | ||
1291 | 246 | } | ||
1292 | 247 | \endqml | ||
1293 | 248 | |||
1294 | 189 | \section1 Optimizing memory consumption | 249 | \section1 Optimizing memory consumption |
1295 | 190 | 250 | ||
1296 | 191 | In order to minimize memory consumption, the Labels in the \l SlotsLayout::mainSlot | 251 | In order to minimize memory consumption, the Labels in the \l SlotsLayout::mainSlot |
1297 | @@ -221,6 +281,7 @@ | |||
1298 | 221 | 281 | ||
1299 | 222 | \qml | 282 | \qml |
1300 | 223 | ListItem { | 283 | ListItem { |
1301 | 284 | height: layout.height + (divider.visible ? divider.height : 0) | ||
1302 | 224 | property alias titleText: layout.title.text | 285 | property alias titleText: layout.title.text |
1303 | 225 | ListItemLayout { | 286 | ListItemLayout { |
1304 | 226 | id: layout | 287 | id: layout |
1305 | @@ -301,13 +362,28 @@ | |||
1306 | 301 | Text component, as shown in the following example: | 362 | Text component, as shown in the following example: |
1307 | 302 | 363 | ||
1308 | 303 | \qml | 364 | \qml |
1314 | 304 | Item { | 365 | import QtQuick 2.4 |
1315 | 305 | ListItemLayout { | 366 | import Ubuntu.Components 1.3 |
1316 | 306 | title.text: "Hello" | 367 | ListItemLayout { |
1317 | 307 | title.color: "yellow" | 368 | height: units.gu(10) |
1318 | 308 | } | 369 | width: units.gu(30) |
1319 | 370 | title.color: UbuntuColors.orange | ||
1320 | 371 | title.maximumLineCount: 3 | ||
1321 | 372 | title.text: "Red Roses\nrun no risk,\nsir, on nurses order." | ||
1322 | 309 | } | 373 | } |
1323 | 310 | \endqml | 374 | \endqml |
1324 | 375 | |||
1325 | 376 | The default \l Text::elide value for \l title is \c Text.ElideRight. | ||
1326 | 377 | |||
1327 | 378 | The default \l Text::wrapMode is \c Text.WrapAnywhere. | ||
1328 | 379 | |||
1329 | 380 | That means, for instance, that if you want to use a different elide mode, you also have | ||
1330 | 381 | to set wrapMode to \c Text.NoWrap. Refer to the official \l Text documentation for | ||
1331 | 382 | further details. | ||
1332 | 383 | |||
1333 | 384 | The default \l Label::textSize is \c Label.Medium. | ||
1334 | 385 | |||
1335 | 386 | The rest of the properties have the same default values as \l Label. | ||
1336 | 311 | */ | 387 | */ |
1337 | 312 | UCLabel *UCListItemLayout::title() | 388 | UCLabel *UCListItemLayout::title() |
1338 | 313 | { | 389 | { |
1339 | @@ -320,6 +396,14 @@ | |||
1340 | 320 | This property defines the subtitle label and its properties. | 396 | This property defines the subtitle label and its properties. |
1341 | 321 | Styling and font properties can be set by using the prefix | 397 | Styling and font properties can be set by using the prefix |
1342 | 322 | \c {subtitle.} in a similar way as shown in \l title. | 398 | \c {subtitle.} in a similar way as shown in \l title. |
1343 | 399 | |||
1344 | 400 | The default \l Text::elide value for \l subtitle is \c Text.ElideRight. | ||
1345 | 401 | |||
1346 | 402 | The default \l Text::wrapMode is \c Text.WrapAnywhere. | ||
1347 | 403 | |||
1348 | 404 | The default \l Label::textSize is \c Label.Small. | ||
1349 | 405 | |||
1350 | 406 | The rest of the properties have the same default values as \l Label. | ||
1351 | 323 | */ | 407 | */ |
1352 | 324 | UCLabel *UCListItemLayout::subtitle() | 408 | UCLabel *UCListItemLayout::subtitle() |
1353 | 325 | { | 409 | { |
1354 | @@ -332,6 +416,14 @@ | |||
1355 | 332 | This property defines the subtitle label and its properties. | 416 | This property defines the subtitle label and its properties. |
1356 | 333 | Styling and font properties can be set by using the prefix | 417 | Styling and font properties can be set by using the prefix |
1357 | 334 | \c {summary.} in a similar way as shown in \l title. | 418 | \c {summary.} in a similar way as shown in \l title. |
1358 | 419 | |||
1359 | 420 | The default \l Text::elide value for \l summary is \c Text.ElideRight. | ||
1360 | 421 | |||
1361 | 422 | The default \l Text::wrapMode is \c Text.WrapAnywhere. | ||
1362 | 423 | |||
1363 | 424 | The default \l Label::textSize is \c Label.Small. | ||
1364 | 425 | |||
1365 | 426 | The rest of the properties have the same default values as \l Label. | ||
1366 | 335 | */ | 427 | */ |
1367 | 336 | UCLabel *UCListItemLayout::summary() | 428 | UCLabel *UCListItemLayout::summary() |
1368 | 337 | { | 429 | { |
1369 | 338 | 430 | ||
1370 | === modified file 'src/Ubuntu/UbuntuToolkit/ucslotslayout.cpp' | |||
1371 | --- src/Ubuntu/UbuntuToolkit/ucslotslayout.cpp 2016-07-07 08:42:42 +0000 | |||
1372 | +++ src/Ubuntu/UbuntuToolkit/ucslotslayout.cpp 2016-08-14 09:05:30 +0000 | |||
1373 | @@ -703,7 +703,7 @@ | |||
1374 | 703 | \qml | 703 | \qml |
1375 | 704 | ListItem { | 704 | ListItem { |
1376 | 705 | //CORRECT | 705 | //CORRECT |
1378 | 706 | height: layout.height + divider.height | 706 | height: layout.height + (divider.visible ? divider.height : 0) |
1379 | 707 | 707 | ||
1380 | 708 | SlotsLayout { | 708 | SlotsLayout { |
1381 | 709 | id: layout | 709 | id: layout |
1382 | @@ -765,7 +765,7 @@ | |||
1383 | 765 | 765 | ||
1384 | 766 | \qml | 766 | \qml |
1385 | 767 | ListItem { | 767 | ListItem { |
1387 | 768 | height: layout.height + divider.height | 768 | height: layout.height + (divider.visible ? divider.height : 0) |
1388 | 769 | onClicked: console.log("clicked!") | 769 | onClicked: console.log("clicked!") |
1389 | 770 | 770 | ||
1390 | 771 | SlotsLayout { | 771 | SlotsLayout { |
1391 | 772 | 772 | ||
1392 | === modified file 'src/Ubuntu/UbuntuToolkit/ucstyleditembase_p.h' | |||
1393 | --- src/Ubuntu/UbuntuToolkit/ucstyleditembase_p.h 2016-07-07 07:21:48 +0000 | |||
1394 | +++ src/Ubuntu/UbuntuToolkit/ucstyleditembase_p.h 2016-08-14 09:05:30 +0000 | |||
1395 | @@ -43,7 +43,7 @@ | |||
1396 | 43 | Q_PROPERTY(bool activeFocusOnTab | 43 | Q_PROPERTY(bool activeFocusOnTab |
1397 | 44 | READ activeFocusOnTab2 | 44 | READ activeFocusOnTab2 |
1398 | 45 | WRITE setActiveFocusOnTab2 | 45 | WRITE setActiveFocusOnTab2 |
1400 | 46 | NOTIFY activeFocusOnTabChanged2 FINAL) | 46 | NOTIFY activeFocusOnTabChanged2) |
1401 | 47 | Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QQmlComponent *style READ style WRITE setStyle RESET resetStyle NOTIFY styleChanged FINAL DESIGNABLE false) | 47 | Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QQmlComponent *style READ style WRITE setStyle RESET resetStyle NOTIFY styleChanged FINAL DESIGNABLE false) |
1402 | 48 | Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QQuickItem *__styleInstance READ styleInstance NOTIFY styleInstanceChanged FINAL DESIGNABLE false) | 48 | Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QQuickItem *__styleInstance READ styleInstance NOTIFY styleInstanceChanged FINAL DESIGNABLE false) |
1403 | 49 | Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged FINAL REVISION 2) | 49 | Q_PRIVATE_PROPERTY(UCStyledItemBase::d_func(), QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged FINAL REVISION 2) |
1404 | 50 | 50 | ||
1405 | === modified file 'src/Ubuntu/UbuntuToolkit/ucstylehints.cpp' | |||
1406 | --- src/Ubuntu/UbuntuToolkit/ucstylehints.cpp 2016-07-07 07:21:48 +0000 | |||
1407 | +++ src/Ubuntu/UbuntuToolkit/ucstylehints.cpp 2016-08-14 09:05:30 +0000 | |||
1408 | @@ -225,15 +225,18 @@ | |||
1409 | 225 | m_propertyBackup.clear(); | 225 | m_propertyBackup.clear(); |
1410 | 226 | 226 | ||
1411 | 227 | QQuickItem *item = UCStyledItemBasePrivate::get(m_styledItem)->styleItem; | 227 | QQuickItem *item = UCStyledItemBasePrivate::get(m_styledItem)->styleItem; |
1412 | 228 | const QMetaObject *mo = item->metaObject(); | ||
1413 | 229 | const QString styleName = UCStyledItemBasePrivate::get(m_styledItem)->styleName(); | 228 | const QString styleName = UCStyledItemBasePrivate::get(m_styledItem)->styleName(); |
1414 | 230 | // apply values first | 229 | // apply values first |
1415 | 231 | for (int i = 0; i < m_values.size(); i++) { | 230 | for (int i = 0; i < m_values.size(); i++) { |
1417 | 232 | if (mo->indexOfProperty(m_values[i].first.toUtf8()) < 0) { | 231 | // Checking the validity of the property using the index of m_values[i].first in |
1418 | 232 | // item->metaObject is not sufficient in case of a grouped property, so we use | ||
1419 | 233 | // PropertyChange to detect all properties that are not valid. | ||
1420 | 234 | PropertyChange *change = new PropertyChange(item, m_values[i].first.toUtf8()); | ||
1421 | 235 | if (!change->property().isValid()) { | ||
1422 | 233 | propertyNotFound(styleName, m_values[i].first); | 236 | propertyNotFound(styleName, m_values[i].first); |
1423 | 237 | delete change; | ||
1424 | 234 | continue; | 238 | continue; |
1425 | 235 | } | 239 | } |
1426 | 236 | PropertyChange *change = new PropertyChange(item, m_values[i].first.toUtf8()); | ||
1427 | 237 | PropertyChange::setValue(change, m_values[i].second); | 240 | PropertyChange::setValue(change, m_values[i].second); |
1428 | 238 | m_propertyBackup << change; | 241 | m_propertyBackup << change; |
1429 | 239 | } | 242 | } |
1430 | 240 | 243 | ||
1431 | === modified file 'src/Ubuntu/UbuntuToolkit/ucunits.cpp' | |||
1432 | --- src/Ubuntu/UbuntuToolkit/ucunits.cpp 2016-07-07 07:21:48 +0000 | |||
1433 | +++ src/Ubuntu/UbuntuToolkit/ucunits.cpp 2016-08-14 09:05:30 +0000 | |||
1434 | @@ -71,16 +71,15 @@ | |||
1435 | 71 | */ | 71 | */ |
1436 | 72 | 72 | ||
1437 | 73 | /* | 73 | /* |
1439 | 74 | * Note on the interaction between GRID_UNIT_PX and QT_DEVICE_PIXEL_RATIO | 74 | * In Qt5.6 the following variables affect scaling in QWidget and QML: |
1440 | 75 | * 1. QT_SCALE_FACTOR: global integer scale factor, including point-sized fonts | ||
1441 | 76 | * 2. QT_SCREEN_SCALE_FACTORS: a list of scale factors | ||
1442 | 77 | * 3. QT_AUTO_SCREEN_SCALE_FACTOR: enables automatic scaling heuristics | ||
1443 | 75 | * | 78 | * |
1444 | 76 | * In Qt5.4 there is a single means to scale the UI: the QT_DEVICE_PIXEL_RATIO environment | 79 | * In Qt5.4 there is a single means to scale the UI: the QT_DEVICE_PIXEL_RATIO environment |
1445 | 77 | * variable. This accepts only integer values, thus allowing a x2 or x3 scaling of any | 80 | * variable. This accepts only integer values, thus allowing a x2 or x3 scaling of any |
1446 | 78 | * Qt-based UI, that includes QWidget as well as any QML UI. | 81 | * Qt-based UI, that includes QWidget as well as any QML UI. |
1447 | 79 | * | 82 | * |
1448 | 80 | * Setting QT_DEVICE_PIXEL_RATIO=2 implies one density-independent pixel corresponds to 2 | ||
1449 | 81 | * physical pixels. Developers describe their UI in terms of density-independent pixels. | ||
1450 | 82 | * Qt scales accordingly. | ||
1451 | 83 | * | ||
1452 | 84 | * The Ubuntu UI Toolkit has solved the scaling problem with the GRID_UNIT_PX variable. | 83 | * The Ubuntu UI Toolkit has solved the scaling problem with the GRID_UNIT_PX variable. |
1453 | 85 | * It offers more flexibility, but only scales QML applications written to use the UITK | 84 | * It offers more flexibility, but only scales QML applications written to use the UITK |
1454 | 86 | * (since it uses this Units class) as it is built on top of QML. | 85 | * (since it uses this Units class) as it is built on top of QML. |
1455 | @@ -184,13 +183,17 @@ | |||
1456 | 184 | return QString(); | 183 | return QString(); |
1457 | 185 | } | 184 | } |
1458 | 186 | 185 | ||
1462 | 187 | QFileInfo fileInfo(path); | 186 | const QFileInfo fileInfo(path); |
1463 | 188 | if (fileInfo.exists() && !fileInfo.isFile()) { | 187 | if (fileInfo.exists()) { |
1464 | 189 | return QString(); | 188 | if (fileInfo.isFile()) { |
1465 | 189 | return QStringLiteral("1/") + path; | ||
1466 | 190 | } else { | ||
1467 | 191 | return QString(); | ||
1468 | 192 | } | ||
1469 | 190 | } | 193 | } |
1470 | 191 | 194 | ||
1473 | 192 | QString prefix = fileInfo.dir().absolutePath() + "/" + fileInfo.baseName(); | 195 | const QString prefix = fileInfo.dir().absolutePath() + "/" + fileInfo.baseName(); |
1474 | 193 | QString suffix = "." + fileInfo.completeSuffix(); | 196 | const QString suffix = "." + fileInfo.completeSuffix(); |
1475 | 194 | 197 | ||
1476 | 195 | /* Use file with expected grid unit suffix if it exists. | 198 | /* Use file with expected grid unit suffix if it exists. |
1477 | 196 | For example, if m_gridUnit = 10, look for resource@10.png. | 199 | For example, if m_gridUnit = 10, look for resource@10.png. |
1478 | @@ -198,7 +201,7 @@ | |||
1479 | 198 | 201 | ||
1480 | 199 | path = prefix + suffixForGridUnit(m_gridUnit) + suffix; | 202 | path = prefix + suffixForGridUnit(m_gridUnit) + suffix; |
1481 | 200 | if (QFile::exists(path)) { | 203 | if (QFile::exists(path)) { |
1483 | 201 | return QString("1") + "/" + path; | 204 | return QStringLiteral("1/") + path; |
1484 | 202 | } | 205 | } |
1485 | 203 | 206 | ||
1486 | 204 | /* No file with expected grid unit suffix exists. | 207 | /* No file with expected grid unit suffix exists. |
1487 | @@ -219,7 +222,7 @@ | |||
1488 | 219 | */ | 222 | */ |
1489 | 220 | QStringList nameFilters; | 223 | QStringList nameFilters; |
1490 | 221 | nameFilters << fileInfo.baseName() + "@[0-9]*" + suffix; | 224 | nameFilters << fileInfo.baseName() + "@[0-9]*" + suffix; |
1492 | 222 | QStringList files = fileInfo.dir().entryList(nameFilters, QDir::Files); | 225 | const QStringList files = fileInfo.dir().entryList(nameFilters, QDir::Files); |
1493 | 223 | 226 | ||
1494 | 224 | if (!files.empty()) { | 227 | if (!files.empty()) { |
1495 | 225 | float selectedGridUnitSuffix = gridUnitSuffixFromFileName(files.first()); | 228 | float selectedGridUnitSuffix = gridUnitSuffixFromFileName(files.first()); |
1496 | @@ -237,11 +240,6 @@ | |||
1497 | 237 | return QString::number(scaleFactor) + "/" + path; | 240 | return QString::number(scaleFactor) + "/" + path; |
1498 | 238 | } | 241 | } |
1499 | 239 | 242 | ||
1500 | 240 | path = prefix + suffix; | ||
1501 | 241 | if (QFile::exists(path)) { | ||
1502 | 242 | return QString("1") + "/" + path; | ||
1503 | 243 | } | ||
1504 | 244 | |||
1505 | 245 | return QString(); | 243 | return QString(); |
1506 | 246 | } | 244 | } |
1507 | 247 | 245 | ||
1508 | 248 | 246 | ||
1509 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_actionbar.py' | |||
1510 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_actionbar.py 2015-12-07 13:30:11 +0000 | |||
1511 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_actionbar.py 2016-08-14 09:05:30 +0000 | |||
1512 | @@ -62,6 +62,9 @@ | |||
1513 | 62 | try: | 62 | try: |
1514 | 63 | object_name = action_object_name + "_button" | 63 | object_name = action_object_name + "_button" |
1515 | 64 | button = self.select_single(objectName=object_name) | 64 | button = self.select_single(objectName=object_name) |
1516 | 65 | # In an animating header, the button is disabled until the header | ||
1517 | 66 | # animation is done. Wait for that: | ||
1518 | 67 | button.enabled.wait_for(True) | ||
1519 | 65 | self.pointing_device.click_object(button) | 68 | self.pointing_device.click_object(button) |
1520 | 66 | except dbus.StateNotFoundError: | 69 | except dbus.StateNotFoundError: |
1521 | 67 | # the button is not in the ActionBar, but it may be in the overflow | 70 | # the button is not in the ActionBar, but it may be in the overflow |
1522 | 68 | 71 | ||
1523 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py' | |||
1524 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2016-04-21 03:23:24 +0000 | |||
1525 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2016-08-14 09:05:30 +0000 | |||
1526 | @@ -261,6 +261,9 @@ | |||
1527 | 261 | except dbus.StateNotFoundError: | 261 | except dbus.StateNotFoundError: |
1528 | 262 | # for Ubuntu.Components < 1.3 | 262 | # for Ubuntu.Components < 1.3 |
1529 | 263 | button = self._get_action_button(action_object_name) | 263 | button = self._get_action_button(action_object_name) |
1530 | 264 | # In an animating header, the button is disabled until the header | ||
1531 | 265 | # animation is done. Wait for that: | ||
1532 | 266 | button.enabled.wait_for(True) | ||
1533 | 264 | self.pointing_device.click_object(button) | 267 | self.pointing_device.click_object(button) |
1534 | 265 | except _common.ToolkitException: | 268 | except _common.ToolkitException: |
1535 | 266 | # Catch 'Button not found in ActionBar or overflow' exception | 269 | # Catch 'Button not found in ActionBar or overflow' exception |
1536 | 267 | 270 | ||
1537 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_optionselector.py' | |||
1538 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_optionselector.py 2014-07-16 19:19:03 +0000 | |||
1539 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_optionselector.py 2016-08-14 09:05:30 +0000 | |||
1540 | @@ -40,7 +40,7 @@ | |||
1541 | 40 | option_selector_delegate = self.select_single( | 40 | option_selector_delegate = self.select_single( |
1542 | 41 | 'OptionSelectorDelegate', focus='True') | 41 | 'OptionSelectorDelegate', focus='True') |
1543 | 42 | current_label = option_selector_delegate.select_single( | 42 | current_label = option_selector_delegate.select_single( |
1545 | 43 | 'Label', visible='True') | 43 | 'UCLabel', visible='True') |
1546 | 44 | return current_label.text | 44 | return current_label.text |
1547 | 45 | 45 | ||
1548 | 46 | def get_current_label(self): | 46 | def get_current_label(self): |
1549 | @@ -48,7 +48,7 @@ | |||
1550 | 48 | option_selector_delegate = self.select_single( | 48 | option_selector_delegate = self.select_single( |
1551 | 49 | 'OptionSelectorDelegate', focus='True') | 49 | 'OptionSelectorDelegate', focus='True') |
1552 | 50 | current_label = option_selector_delegate.select_single( | 50 | current_label = option_selector_delegate.select_single( |
1554 | 51 | 'Label', visible='True') | 51 | 'UCLabel', visible='True') |
1555 | 52 | return current_label | 52 | return current_label |
1556 | 53 | 53 | ||
1557 | 54 | def _expand(self): | 54 | def _expand(self): |
1558 | @@ -69,7 +69,7 @@ | |||
1559 | 69 | 69 | ||
1560 | 70 | Example usage:: | 70 | Example usage:: |
1561 | 71 | select_option(objectName="myOptionSelectorDelegate") | 71 | select_option(objectName="myOptionSelectorDelegate") |
1563 | 72 | select_option('Label', text="some_text_here") | 72 | select_option('UCLabel', text="some_text_here") |
1564 | 73 | 73 | ||
1565 | 74 | :parameter kwargs: keywords used to find property(s) of delegate in | 74 | :parameter kwargs: keywords used to find property(s) of delegate in |
1566 | 75 | option selector | 75 | option selector |
1567 | 76 | 76 | ||
1568 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py' | |||
1569 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py 2016-06-21 05:51:15 +0000 | |||
1570 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_toolbar.py 2016-08-14 09:05:30 +0000 | |||
1571 | @@ -98,8 +98,7 @@ | |||
1572 | 98 | self.pointing_device.click_object(button) | 98 | self.pointing_device.click_object(button) |
1573 | 99 | 99 | ||
1574 | 100 | def _get_button(self, object_name): | 100 | def _get_button(self, object_name): |
1577 | 101 | return self.select_single( | 101 | return self.select_single(objectName=object_name) |
1576 | 102 | 'UbuntuToolkit::UCActionItem', objectName=object_name) | ||
1578 | 103 | 102 | ||
1579 | 104 | @autopilot_logging.log_action(logger.info) | 103 | @autopilot_logging.log_action(logger.info) |
1580 | 105 | def click_back_button(self): | 104 | def click_back_button(self): |
1581 | 106 | 105 | ||
1582 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py' | |||
1583 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2016-06-21 18:55:01 +0000 | |||
1584 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2016-08-14 09:05:30 +0000 | |||
1585 | @@ -98,7 +98,12 @@ | |||
1586 | 98 | button = self.select_single(objectName=object_name) | 98 | button = self.select_single(objectName=object_name) |
1587 | 99 | except dbus.StateNotFoundError: | 99 | except dbus.StateNotFoundError: |
1588 | 100 | raise _common.ToolkitException( | 100 | raise _common.ToolkitException( |
1590 | 101 | 'Action with objectName "{0}" not found.'.format(object_name)) | 101 | 'Button for action with objectName "{0}" not found.'.format( |
1591 | 102 | action_object_name)) | ||
1592 | 103 | if not button.visible: | ||
1593 | 104 | raise _common.ToolkitException( | ||
1594 | 105 | 'Button for action with objectName "{0}" not visible.'.format( | ||
1595 | 106 | action_object_name)) | ||
1596 | 102 | self.pointing_device.click_object(button) | 107 | self.pointing_device.click_object(button) |
1597 | 103 | if self.autoClose: | 108 | if self.autoClose: |
1598 | 104 | try: | 109 | try: |
1599 | 105 | 110 | ||
1600 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_checkbox.qml' | |||
1601 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_checkbox.qml 1970-01-01 00:00:00 +0000 | |||
1602 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_checkbox.qml 2016-08-14 09:05:30 +0000 | |||
1603 | @@ -0,0 +1,31 @@ | |||
1604 | 1 | /* | ||
1605 | 2 | * Copyright 2016 Canonical Ltd. | ||
1606 | 3 | * | ||
1607 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1608 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1609 | 6 | * the Free Software Foundation; version 3. | ||
1610 | 7 | * | ||
1611 | 8 | * This program is distributed in the hope that it will be useful, | ||
1612 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1613 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1614 | 11 | * GNU Lesser General Public License for more details. | ||
1615 | 12 | * | ||
1616 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1617 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1618 | 15 | */ | ||
1619 | 16 | |||
1620 | 17 | import QtQuick 2.0 | ||
1621 | 18 | import Ubuntu.Components 1.0 | ||
1622 | 19 | |||
1623 | 20 | MainView { | ||
1624 | 21 | width: units.gu(48) | ||
1625 | 22 | height: units.gu(60) | ||
1626 | 23 | objectName: "mainView" | ||
1627 | 24 | |||
1628 | 25 | Item { | ||
1629 | 26 | CheckBox { | ||
1630 | 27 | checked: false | ||
1631 | 28 | objectName: "test_checkbox" | ||
1632 | 29 | } | ||
1633 | 30 | } | ||
1634 | 31 | } | ||
1635 | 0 | 32 | ||
1636 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_switch.qml' | |||
1637 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_switch.qml 1970-01-01 00:00:00 +0000 | |||
1638 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.ToggleTestCase.test_with_switch.qml 2016-08-14 09:05:30 +0000 | |||
1639 | @@ -0,0 +1,31 @@ | |||
1640 | 1 | /* | ||
1641 | 2 | * Copyright 2016 Canonical Ltd. | ||
1642 | 3 | * | ||
1643 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1644 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1645 | 6 | * the Free Software Foundation; version 3. | ||
1646 | 7 | * | ||
1647 | 8 | * This program is distributed in the hope that it will be useful, | ||
1648 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1649 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1650 | 11 | * GNU Lesser General Public License for more details. | ||
1651 | 12 | * | ||
1652 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1653 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1654 | 15 | */ | ||
1655 | 16 | |||
1656 | 17 | import QtQuick 2.0 | ||
1657 | 18 | import Ubuntu.Components 1.0 | ||
1658 | 19 | |||
1659 | 20 | MainView { | ||
1660 | 21 | width: units.gu(48) | ||
1661 | 22 | height: units.gu(60) | ||
1662 | 23 | objectName: "mainView" | ||
1663 | 24 | |||
1664 | 25 | Item { | ||
1665 | 26 | Switch { | ||
1666 | 27 | checked: false | ||
1667 | 28 | objectName: "test_switch" | ||
1668 | 29 | } | ||
1669 | 30 | } | ||
1670 | 31 | } | ||
1671 | 0 | 32 | ||
1672 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.py' | |||
1673 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.py 2015-04-14 21:02:06 +0000 | |||
1674 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_checkbox.py 2016-08-14 09:05:30 +0000 | |||
1675 | @@ -15,6 +15,7 @@ | |||
1676 | 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/>. |
1677 | 16 | 16 | ||
1678 | 17 | import time | 17 | import time |
1679 | 18 | import os | ||
1680 | 18 | 19 | ||
1681 | 19 | from autopilot import input | 20 | from autopilot import input |
1682 | 20 | from testtools.matchers import GreaterThan, LessThan | 21 | from testtools.matchers import GreaterThan, LessThan |
1683 | @@ -24,51 +25,22 @@ | |||
1684 | 24 | from ubuntuuitoolkit import tests | 25 | from ubuntuuitoolkit import tests |
1685 | 25 | 26 | ||
1686 | 26 | 27 | ||
1726 | 27 | TEST_QML_WITH_CHECKBOX = (""" | 28 | class ToggleTestCase(tests.QMLFileAppTestCase): |
1727 | 28 | import QtQuick 2.0 | 29 | |
1728 | 29 | import Ubuntu.Components 1.0 | 30 | path = os.path.abspath(__file__) |
1729 | 30 | 31 | dir_path = os.path.dirname(path) | |
1730 | 31 | MainView { | 32 | switch_test_qml_file_path = os.path.join( |
1731 | 32 | width: units.gu(48) | 33 | dir_path, 'test_checkbox.ToggleTestCase.test_with_switch.qml') |
1732 | 33 | height: units.gu(60) | 34 | checkbox_test_qml_file_path = os.path.join( |
1733 | 34 | objectName: "mainView" | 35 | dir_path, 'test_checkbox.ToggleTestCase.test_with_checkbox.qml') |
1695 | 35 | |||
1696 | 36 | Item { | ||
1697 | 37 | CheckBox { | ||
1698 | 38 | checked: false | ||
1699 | 39 | objectName: "test_checkbox" | ||
1700 | 40 | } | ||
1701 | 41 | } | ||
1702 | 42 | } | ||
1703 | 43 | """) | ||
1704 | 44 | |||
1705 | 45 | |||
1706 | 46 | TEST_QML_WITH_SWITCH = (""" | ||
1707 | 47 | import QtQuick 2.0 | ||
1708 | 48 | import Ubuntu.Components 1.0 | ||
1709 | 49 | |||
1710 | 50 | MainView { | ||
1711 | 51 | width: units.gu(48) | ||
1712 | 52 | height: units.gu(60) | ||
1713 | 53 | objectName: "mainView" | ||
1714 | 54 | |||
1715 | 55 | Item { | ||
1716 | 56 | Switch { | ||
1717 | 57 | checked: false | ||
1718 | 58 | objectName: "test_switch" | ||
1719 | 59 | } | ||
1720 | 60 | } | ||
1721 | 61 | } | ||
1722 | 62 | """) | ||
1723 | 63 | |||
1724 | 64 | |||
1725 | 65 | class ToggleTestCase(tests.QMLStringAppTestCase): | ||
1734 | 66 | 36 | ||
1735 | 67 | scenarios = [ | 37 | scenarios = [ |
1736 | 68 | ('checkbox', dict( | 38 | ('checkbox', dict( |
1738 | 69 | test_qml=TEST_QML_WITH_CHECKBOX, objectName='test_checkbox')), | 39 | test_qml_file_path=checkbox_test_qml_file_path, |
1739 | 40 | objectName='test_checkbox')), | ||
1740 | 70 | ('switch', dict( | 41 | ('switch', dict( |
1742 | 71 | test_qml=TEST_QML_WITH_SWITCH, objectName='test_switch')) | 42 | test_qml_file_path=switch_test_qml_file_path, |
1743 | 43 | objectName='test_switch')) | ||
1744 | 72 | ] | 44 | ] |
1745 | 73 | 45 | ||
1746 | 74 | def setUp(self): | 46 | def setUp(self): |
1747 | 75 | 47 | ||
1748 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_common.py' | |||
1749 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_common.py 2015-04-14 21:02:06 +0000 | |||
1750 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_common.py 2016-08-14 09:05:30 +0000 | |||
1751 | @@ -41,6 +41,8 @@ | |||
1752 | 41 | ubuntuuitoolkit.check_autopilot_version() | 41 | ubuntuuitoolkit.check_autopilot_version() |
1753 | 42 | 42 | ||
1754 | 43 | 43 | ||
1755 | 44 | # FIXME: this class is not used anywhere, and QMLStringAppTestCase subclasses | ||
1756 | 45 | # no longer work (see bug 1578319), so the code below can be deleted. | ||
1757 | 44 | class UbuntuUIToolkitCustomProxyObjectBaseTestCase(tests.QMLStringAppTestCase): | 46 | class UbuntuUIToolkitCustomProxyObjectBaseTestCase(tests.QMLStringAppTestCase): |
1758 | 45 | 47 | ||
1759 | 46 | def test_pointing_device(self): | 48 | def test_pointing_device(self): |
1760 | 47 | 49 | ||
1761 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.DatePickerBaseTestCase.qml' | |||
1762 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.DatePickerBaseTestCase.qml 1970-01-01 00:00:00 +0000 | |||
1763 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.DatePickerBaseTestCase.qml 2016-08-14 09:05:30 +0000 | |||
1764 | @@ -0,0 +1,72 @@ | |||
1765 | 1 | /* | ||
1766 | 2 | * Copyright 2016 Canonical Ltd. | ||
1767 | 3 | * | ||
1768 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1769 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1770 | 6 | * the Free Software Foundation; version 3. | ||
1771 | 7 | * | ||
1772 | 8 | * This program is distributed in the hope that it will be useful, | ||
1773 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1774 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1775 | 11 | * GNU Lesser General Public License for more details. | ||
1776 | 12 | * | ||
1777 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1778 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1779 | 15 | */ | ||
1780 | 16 | |||
1781 | 17 | import QtQuick 2.0 | ||
1782 | 18 | import Ubuntu.Components 1.1 | ||
1783 | 19 | import Ubuntu.Components.Pickers 1.0 | ||
1784 | 20 | |||
1785 | 21 | MainView { | ||
1786 | 22 | width: units.gu(48) | ||
1787 | 23 | height: units.gu(60) | ||
1788 | 24 | objectName: "mainView" | ||
1789 | 25 | |||
1790 | 26 | Column { | ||
1791 | 27 | DatePicker { | ||
1792 | 28 | id: datePicker | ||
1793 | 29 | objectName: 'datePicker' | ||
1794 | 30 | mode: 'Years|Months|Days' | ||
1795 | 31 | maximum: { | ||
1796 | 32 | var d = new Date() | ||
1797 | 33 | d.setFullYear('2030') | ||
1798 | 34 | return d | ||
1799 | 35 | } | ||
1800 | 36 | minimum: { | ||
1801 | 37 | var d = new Date() | ||
1802 | 38 | d.setFullYear('1990') | ||
1803 | 39 | return d | ||
1804 | 40 | } | ||
1805 | 41 | date: { | ||
1806 | 42 | var d = new Date() | ||
1807 | 43 | d.setFullYear('2010') | ||
1808 | 44 | d.setMonth('5') | ||
1809 | 45 | d.setDate('15') | ||
1810 | 46 | return d | ||
1811 | 47 | } | ||
1812 | 48 | } | ||
1813 | 49 | DatePicker { | ||
1814 | 50 | id: timePicker | ||
1815 | 51 | objectName: 'timePicker' | ||
1816 | 52 | mode: 'Hours|Minutes|Seconds' | ||
1817 | 53 | maximum: { | ||
1818 | 54 | var d = new Date() | ||
1819 | 55 | d.setFullYear('2030') | ||
1820 | 56 | return d | ||
1821 | 57 | } | ||
1822 | 58 | minimum: { | ||
1823 | 59 | var d = new Date() | ||
1824 | 60 | d.setFullYear('1990') | ||
1825 | 61 | return d | ||
1826 | 62 | } | ||
1827 | 63 | date: { | ||
1828 | 64 | var d = new Date() | ||
1829 | 65 | d.setHours(12) | ||
1830 | 66 | d.setMinutes('30') | ||
1831 | 67 | d.setSeconds('30') | ||
1832 | 68 | return d | ||
1833 | 69 | } | ||
1834 | 70 | } | ||
1835 | 71 | } | ||
1836 | 72 | } | ||
1837 | 0 | 73 | ||
1838 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py' | |||
1839 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2015-04-14 21:02:06 +0000 | |||
1840 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2016-08-14 09:05:30 +0000 | |||
1841 | @@ -14,72 +14,19 @@ | |||
1842 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
1843 | 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/>. |
1844 | 16 | 16 | ||
1845 | 17 | import os | ||
1846 | 17 | import datetime | 18 | import datetime |
1847 | 18 | 19 | ||
1848 | 19 | import ubuntuuitoolkit | 20 | import ubuntuuitoolkit |
1849 | 20 | from ubuntuuitoolkit import pickers, tests | 21 | from ubuntuuitoolkit import pickers, tests |
1850 | 21 | 22 | ||
1851 | 22 | 23 | ||
1912 | 23 | class DatePickerBaseTestCase(tests.QMLStringAppTestCase): | 24 | class DatePickerBaseTestCase(tests.QMLFileAppTestCase): |
1913 | 24 | 25 | ||
1914 | 25 | test_qml = (""" | 26 | path = os.path.abspath(__file__) |
1915 | 26 | import QtQuick 2.0 | 27 | dir_path = os.path.dirname(path) |
1916 | 27 | import Ubuntu.Components 1.1 | 28 | test_qml_file_path = os.path.join( |
1917 | 28 | import Ubuntu.Components.Pickers 1.0 | 29 | dir_path, 'test_date_picker.DatePickerBaseTestCase.qml') |
1858 | 29 | |||
1859 | 30 | MainView { | ||
1860 | 31 | width: units.gu(48) | ||
1861 | 32 | height: units.gu(60) | ||
1862 | 33 | objectName: "mainView" | ||
1863 | 34 | |||
1864 | 35 | Column { | ||
1865 | 36 | DatePicker { | ||
1866 | 37 | id: datePicker | ||
1867 | 38 | objectName: 'datePicker' | ||
1868 | 39 | mode: 'Years|Months|Days' | ||
1869 | 40 | maximum: { | ||
1870 | 41 | var d = new Date() | ||
1871 | 42 | d.setFullYear('2030') | ||
1872 | 43 | return d | ||
1873 | 44 | } | ||
1874 | 45 | minimum: { | ||
1875 | 46 | var d = new Date() | ||
1876 | 47 | d.setFullYear('1990') | ||
1877 | 48 | return d | ||
1878 | 49 | } | ||
1879 | 50 | date: { | ||
1880 | 51 | var d = new Date() | ||
1881 | 52 | d.setFullYear('2010') | ||
1882 | 53 | d.setMonth('5') | ||
1883 | 54 | d.setDate('15') | ||
1884 | 55 | return d | ||
1885 | 56 | } | ||
1886 | 57 | } | ||
1887 | 58 | DatePicker { | ||
1888 | 59 | id: timePicker | ||
1889 | 60 | objectName: 'timePicker' | ||
1890 | 61 | mode: 'Hours|Minutes|Seconds' | ||
1891 | 62 | maximum: { | ||
1892 | 63 | var d = new Date() | ||
1893 | 64 | d.setFullYear('2030') | ||
1894 | 65 | return d | ||
1895 | 66 | } | ||
1896 | 67 | minimum: { | ||
1897 | 68 | var d = new Date() | ||
1898 | 69 | d.setFullYear('1990') | ||
1899 | 70 | return d | ||
1900 | 71 | } | ||
1901 | 72 | date: { | ||
1902 | 73 | var d = new Date() | ||
1903 | 74 | d.setHours(12) | ||
1904 | 75 | d.setMinutes('30') | ||
1905 | 76 | d.setSeconds('30') | ||
1906 | 77 | return d | ||
1907 | 78 | } | ||
1908 | 79 | } | ||
1909 | 80 | } | ||
1910 | 81 | } | ||
1911 | 82 | """) | ||
1918 | 83 | 30 | ||
1919 | 84 | def setUp(self): | 31 | def setUp(self): |
1920 | 85 | super().setUp() | 32 | super().setUp() |
1921 | 86 | 33 | ||
1922 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.IsFlickableTestCase.qml' | |||
1923 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.IsFlickableTestCase.qml 1970-01-01 00:00:00 +0000 | |||
1924 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.IsFlickableTestCase.qml 2016-08-14 09:05:30 +0000 | |||
1925 | @@ -0,0 +1,34 @@ | |||
1926 | 1 | /* | ||
1927 | 2 | * Copyright 2016 Canonical Ltd. | ||
1928 | 3 | * | ||
1929 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1930 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1931 | 6 | * the Free Software Foundation; version 3. | ||
1932 | 7 | * | ||
1933 | 8 | * This program is distributed in the hope that it will be useful, | ||
1934 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1935 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1936 | 11 | * GNU Lesser General Public License for more details. | ||
1937 | 12 | * | ||
1938 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1939 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1940 | 15 | */ | ||
1941 | 16 | |||
1942 | 17 | import QtQuick 2.4 | ||
1943 | 18 | import Ubuntu.Components 1.3 | ||
1944 | 19 | |||
1945 | 20 | MainView { | ||
1946 | 21 | objectName: 'mainView' | ||
1947 | 22 | width: units.gu(48) | ||
1948 | 23 | height: units.gu(60) | ||
1949 | 24 | |||
1950 | 25 | Flickable { | ||
1951 | 26 | objectName: 'flickable' | ||
1952 | 27 | } | ||
1953 | 28 | ListView { | ||
1954 | 29 | objectName: 'listView' | ||
1955 | 30 | } | ||
1956 | 31 | Label { | ||
1957 | 32 | objectName: 'label' | ||
1958 | 33 | } | ||
1959 | 34 | } | ||
1960 | 0 | 35 | ||
1961 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.SwipeFlickableTestCase.qml' | |||
1962 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.SwipeFlickableTestCase.qml 1970-01-01 00:00:00 +0000 | |||
1963 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.SwipeFlickableTestCase.qml 2016-08-14 09:05:30 +0000 | |||
1964 | @@ -0,0 +1,83 @@ | |||
1965 | 1 | /* | ||
1966 | 2 | * Copyright 2016 Canonical Ltd. | ||
1967 | 3 | * | ||
1968 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1969 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1970 | 6 | * the Free Software Foundation; version 3. | ||
1971 | 7 | * | ||
1972 | 8 | * This program is distributed in the hope that it will be useful, | ||
1973 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1974 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1975 | 11 | * GNU Lesser General Public License for more details. | ||
1976 | 12 | * | ||
1977 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1978 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1979 | 15 | */ | ||
1980 | 16 | |||
1981 | 17 | import QtQuick 2.4 | ||
1982 | 18 | import Ubuntu.Components 1.3 | ||
1983 | 19 | |||
1984 | 20 | MainView { | ||
1985 | 21 | width: units.gu(48) | ||
1986 | 22 | height: units.gu(60) | ||
1987 | 23 | objectName: "mainView" | ||
1988 | 24 | |||
1989 | 25 | Label { | ||
1990 | 26 | id: clickedLabel | ||
1991 | 27 | objectName: "clickedLabel" | ||
1992 | 28 | text: "No element clicked." | ||
1993 | 29 | } | ||
1994 | 30 | |||
1995 | 31 | Flickable { | ||
1996 | 32 | anchors { | ||
1997 | 33 | fill: parent | ||
1998 | 34 | topMargin: clickedLabel.height | ||
1999 | 35 | } | ||
2000 | 36 | objectName: 'flickable' | ||
2001 | 37 | height: units.gu(60) | ||
2002 | 38 | contentHeight: bottomButton.y + bottomButton.height | ||
2003 | 39 | contentWidth: topRightButton.x + | ||
2004 | 40 | Math.max(topRightButton.width, bottomRightButton.width) | ||
2005 | 41 | |||
2006 | 42 | Button { | ||
2007 | 43 | id: topButton | ||
2008 | 44 | objectName: 'topButton' | ||
2009 | 45 | text: 'Top button' | ||
2010 | 46 | onClicked: clickedLabel.text = objectName | ||
2011 | 47 | } | ||
2012 | 48 | Rectangle { | ||
2013 | 49 | id: emptyRectangle | ||
2014 | 50 | width: units.gu(70) | ||
2015 | 51 | height: units.gu(80) | ||
2016 | 52 | anchors.top: topButton.bottom | ||
2017 | 53 | } | ||
2018 | 54 | Button { | ||
2019 | 55 | id: bottomButton | ||
2020 | 56 | objectName: 'bottomButton' | ||
2021 | 57 | text: 'Bottom button' | ||
2022 | 58 | onClicked: clickedLabel.text = objectName | ||
2023 | 59 | anchors.top: emptyRectangle.bottom | ||
2024 | 60 | } | ||
2025 | 61 | Button { | ||
2026 | 62 | id: topRightButton | ||
2027 | 63 | objectName: 'topRightButton' | ||
2028 | 64 | text: 'Top-right button' | ||
2029 | 65 | onClicked: clickedLabel.text = objectName | ||
2030 | 66 | anchors { | ||
2031 | 67 | top: parent.top | ||
2032 | 68 | left: emptyRectangle.right | ||
2033 | 69 | } | ||
2034 | 70 | } | ||
2035 | 71 | Button { | ||
2036 | 72 | id: bottomRightButton | ||
2037 | 73 | objectName: 'bottomRightButton' | ||
2038 | 74 | text: 'Bottom-right button' | ||
2039 | 75 | onClicked: clickedLabel.text = objectName | ||
2040 | 76 | anchors { | ||
2041 | 77 | top: emptyRectangle.bottom | ||
2042 | 78 | left: emptyRectangle.right | ||
2043 | 79 | } | ||
2044 | 80 | } | ||
2045 | 81 | } | ||
2046 | 82 | } | ||
2047 | 83 | |||
2048 | 0 | 84 | ||
2049 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.UnityFlickableTestCase.qml' | |||
2050 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.UnityFlickableTestCase.qml 1970-01-01 00:00:00 +0000 | |||
2051 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.UnityFlickableTestCase.qml 2016-08-14 09:05:30 +0000 | |||
2052 | @@ -0,0 +1,31 @@ | |||
2053 | 1 | /* | ||
2054 | 2 | * Copyright 2016 Canonical Ltd. | ||
2055 | 3 | * | ||
2056 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2057 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2058 | 6 | * the Free Software Foundation; version 3. | ||
2059 | 7 | * | ||
2060 | 8 | * This program is distributed in the hope that it will be useful, | ||
2061 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2062 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2063 | 11 | * GNU Lesser General Public License for more details. | ||
2064 | 12 | * | ||
2065 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2066 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2067 | 15 | */ | ||
2068 | 16 | |||
2069 | 17 | import QtQuick 2.4 | ||
2070 | 18 | import Ubuntu.Components 1.3 | ||
2071 | 19 | |||
2072 | 20 | MainView { | ||
2073 | 21 | width: units.gu(48) | ||
2074 | 22 | height: units.gu(60) | ||
2075 | 23 | objectName: 'mainView' | ||
2076 | 24 | |||
2077 | 25 | Flickable { | ||
2078 | 26 | objectName: 'testFlickable' | ||
2079 | 27 | width: 200; height: 200 | ||
2080 | 28 | contentWidth: image.width; contentHeight: image.height | ||
2081 | 29 | } | ||
2082 | 30 | } | ||
2083 | 31 | |||
2084 | 0 | 32 | ||
2085 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py' | |||
2086 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2016-01-18 14:51:22 +0000 | |||
2087 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2016-08-14 09:05:30 +0000 | |||
2088 | @@ -16,6 +16,7 @@ | |||
2089 | 16 | 16 | ||
2090 | 17 | from unittest import mock | 17 | from unittest import mock |
2091 | 18 | 18 | ||
2092 | 19 | import os | ||
2093 | 19 | import testtools | 20 | import testtools |
2094 | 20 | import ubuntuuitoolkit | 21 | import ubuntuuitoolkit |
2095 | 21 | from ubuntuuitoolkit import ( | 22 | from ubuntuuitoolkit import ( |
2096 | @@ -49,7 +50,7 @@ | |||
2097 | 49 | self.assertFalse(element.is_flickable()) | 50 | self.assertFalse(element.is_flickable()) |
2098 | 50 | 51 | ||
2099 | 51 | 52 | ||
2101 | 52 | class IsFlickableTestCase(tests.QMLStringAppTestCase): | 53 | class IsFlickableTestCase(tests.QMLFileAppTestCase): |
2102 | 53 | """Functional test to check that is_flickable returns the right value. | 54 | """Functional test to check that is_flickable returns the right value. |
2103 | 54 | 55 | ||
2104 | 55 | We already have tests for is_flickable with mocks, so here we just check | 56 | We already have tests for is_flickable with mocks, so here we just check |
2105 | @@ -57,26 +58,10 @@ | |||
2106 | 57 | 58 | ||
2107 | 58 | """ | 59 | """ |
2108 | 59 | 60 | ||
2129 | 60 | test_qml = (""" | 61 | path = os.path.abspath(__file__) |
2130 | 61 | import QtQuick 2.4 | 62 | dir_path = os.path.dirname(path) |
2131 | 62 | import Ubuntu.Components 1.3 | 63 | test_qml_file_path = os.path.join( |
2132 | 63 | 64 | dir_path, 'test_flickable.IsFlickableTestCase.qml') | |
2113 | 64 | MainView { | ||
2114 | 65 | objectName: 'mainView' | ||
2115 | 66 | width: units.gu(48) | ||
2116 | 67 | height: units.gu(60) | ||
2117 | 68 | |||
2118 | 69 | Flickable { | ||
2119 | 70 | objectName: 'flickable' | ||
2120 | 71 | } | ||
2121 | 72 | ListView { | ||
2122 | 73 | objectName: 'listView' | ||
2123 | 74 | } | ||
2124 | 75 | Label { | ||
2125 | 76 | objectName: 'label' | ||
2126 | 77 | } | ||
2127 | 78 | } | ||
2128 | 79 | """) | ||
2133 | 80 | 65 | ||
2134 | 81 | scenarios = [ | 66 | scenarios = [ |
2135 | 82 | ('main view', dict(object_name='mainView', is_flickable=False)), | 67 | ('main view', dict(object_name='mainView', is_flickable=False)), |
2136 | @@ -93,76 +78,12 @@ | |||
2137 | 93 | 78 | ||
2138 | 94 | # FIXME: Only left-to-right (where x=0 is leftmost) layouts are taken into | 79 | # FIXME: Only left-to-right (where x=0 is leftmost) layouts are taken into |
2139 | 95 | # account. Add support for horizontal flicking with right-to-left layouts. | 80 | # account. Add support for horizontal flicking with right-to-left layouts. |
2210 | 96 | class SwipeFlickableTestCase(tests.QMLStringAppTestCase): | 81 | class SwipeFlickableTestCase(tests.QMLFileAppTestCase): |
2211 | 97 | 82 | ||
2212 | 98 | test_qml = (""" | 83 | path = os.path.abspath(__file__) |
2213 | 99 | import QtQuick 2.4 | 84 | dir_path = os.path.dirname(path) |
2214 | 100 | import Ubuntu.Components 1.3 | 85 | test_qml_file_path = os.path.join( |
2215 | 101 | 86 | dir_path, 'test_flickable.SwipeFlickableTestCase.qml') | |
2146 | 102 | MainView { | ||
2147 | 103 | width: units.gu(48) | ||
2148 | 104 | height: units.gu(60) | ||
2149 | 105 | objectName: "mainView" | ||
2150 | 106 | |||
2151 | 107 | Label { | ||
2152 | 108 | id: clickedLabel | ||
2153 | 109 | objectName: "clickedLabel" | ||
2154 | 110 | text: "No element clicked." | ||
2155 | 111 | } | ||
2156 | 112 | |||
2157 | 113 | Flickable { | ||
2158 | 114 | anchors { | ||
2159 | 115 | fill: parent | ||
2160 | 116 | topMargin: clickedLabel.height | ||
2161 | 117 | } | ||
2162 | 118 | objectName: 'flickable' | ||
2163 | 119 | height: units.gu(60) | ||
2164 | 120 | contentHeight: bottomButton.y + bottomButton.height | ||
2165 | 121 | contentWidth: topRightButton.x + | ||
2166 | 122 | Math.max(topRightButton.width, bottomRightButton.width) | ||
2167 | 123 | |||
2168 | 124 | Button { | ||
2169 | 125 | id: topButton | ||
2170 | 126 | objectName: 'topButton' | ||
2171 | 127 | text: 'Top button' | ||
2172 | 128 | onClicked: clickedLabel.text = objectName | ||
2173 | 129 | } | ||
2174 | 130 | Rectangle { | ||
2175 | 131 | id: emptyRectangle | ||
2176 | 132 | width: units.gu(70) | ||
2177 | 133 | height: units.gu(80) | ||
2178 | 134 | anchors.top: topButton.bottom | ||
2179 | 135 | } | ||
2180 | 136 | Button { | ||
2181 | 137 | id: bottomButton | ||
2182 | 138 | objectName: 'bottomButton' | ||
2183 | 139 | text: 'Bottom button' | ||
2184 | 140 | onClicked: clickedLabel.text = objectName | ||
2185 | 141 | anchors.top: emptyRectangle.bottom | ||
2186 | 142 | } | ||
2187 | 143 | Button { | ||
2188 | 144 | id: topRightButton | ||
2189 | 145 | objectName: 'topRightButton' | ||
2190 | 146 | text: 'Top-right button' | ||
2191 | 147 | onClicked: clickedLabel.text = objectName | ||
2192 | 148 | anchors { | ||
2193 | 149 | top: parent.top | ||
2194 | 150 | left: emptyRectangle.right | ||
2195 | 151 | } | ||
2196 | 152 | } | ||
2197 | 153 | Button { | ||
2198 | 154 | id: bottomRightButton | ||
2199 | 155 | objectName: 'bottomRightButton' | ||
2200 | 156 | text: 'Bottom-right button' | ||
2201 | 157 | onClicked: clickedLabel.text = objectName | ||
2202 | 158 | anchors { | ||
2203 | 159 | top: emptyRectangle.bottom | ||
2204 | 160 | left: emptyRectangle.right | ||
2205 | 161 | } | ||
2206 | 162 | } | ||
2207 | 163 | } | ||
2208 | 164 | } | ||
2209 | 165 | """) | ||
2216 | 166 | 87 | ||
2217 | 167 | def setUp(self): | 88 | def setUp(self): |
2218 | 168 | super().setUp() | 89 | super().setUp() |
2219 | @@ -393,24 +314,12 @@ | |||
2220 | 393 | self.assertEqual('Could not swipe in the flickable.', str(error)) | 314 | self.assertEqual('Could not swipe in the flickable.', str(error)) |
2221 | 394 | 315 | ||
2222 | 395 | 316 | ||
2241 | 396 | class UnityFlickableTestCase(tests.QMLStringAppTestCase): | 317 | class UnityFlickableTestCase(tests.QMLFileAppTestCase): |
2242 | 397 | 318 | ||
2243 | 398 | test_qml = (""" | 319 | path = os.path.abspath(__file__) |
2244 | 399 | import QtQuick 2.4 | 320 | dir_path = os.path.dirname(path) |
2245 | 400 | import Ubuntu.Components 1.3 | 321 | test_qml_file_path = os.path.join( |
2246 | 401 | 322 | dir_path, 'test_flickable.UnityFlickableTestCase.qml') | |
2229 | 402 | MainView { | ||
2230 | 403 | width: units.gu(48) | ||
2231 | 404 | height: units.gu(60) | ||
2232 | 405 | objectName: 'mainView' | ||
2233 | 406 | |||
2234 | 407 | Flickable { | ||
2235 | 408 | objectName: 'testFlickable' | ||
2236 | 409 | width: 200; height: 200 | ||
2237 | 410 | contentWidth: image.width; contentHeight: image.height | ||
2238 | 411 | } | ||
2239 | 412 | } | ||
2240 | 413 | """) | ||
2247 | 414 | 323 | ||
2248 | 415 | def get_command_line(self, command_line): | 324 | def get_command_line(self, command_line): |
2249 | 416 | command_line.append('-engine') | 325 | command_line.append('-engine') |
2250 | 417 | 326 | ||
2251 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.IsFlickableTestCase.qml' | |||
2252 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.IsFlickableTestCase.qml 1970-01-01 00:00:00 +0000 | |||
2253 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.IsFlickableTestCase.qml 2016-08-14 09:05:30 +0000 | |||
2254 | @@ -0,0 +1,35 @@ | |||
2255 | 1 | /* | ||
2256 | 2 | * Copyright 2016 Canonical Ltd. | ||
2257 | 3 | * | ||
2258 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2259 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2260 | 6 | * the Free Software Foundation; version 3. | ||
2261 | 7 | * | ||
2262 | 8 | * This program is distributed in the hope that it will be useful, | ||
2263 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2264 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2265 | 11 | * GNU Lesser General Public License for more details. | ||
2266 | 12 | * | ||
2267 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2268 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2269 | 15 | */ | ||
2270 | 16 | |||
2271 | 17 | import QtQuick 2.0 | ||
2272 | 18 | import Ubuntu.Components 1.0 | ||
2273 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
2274 | 20 | |||
2275 | 21 | MainView { | ||
2276 | 22 | objectName: 'mainView' | ||
2277 | 23 | width: units.gu(48) | ||
2278 | 24 | height: units.gu(60) | ||
2279 | 25 | |||
2280 | 26 | Flickable { | ||
2281 | 27 | objectName: 'flickable' | ||
2282 | 28 | } | ||
2283 | 29 | ListView { | ||
2284 | 30 | objectName: 'listView' | ||
2285 | 31 | } | ||
2286 | 32 | Label { | ||
2287 | 33 | objectName: 'label' | ||
2288 | 34 | } | ||
2289 | 35 | } | ||
2290 | 0 | 36 | ||
2291 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.SwipeFlickableTestCase.qml' | |||
2292 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.SwipeFlickableTestCase.qml 1970-01-01 00:00:00 +0000 | |||
2293 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.SwipeFlickableTestCase.qml 2016-08-14 09:05:30 +0000 | |||
2294 | @@ -0,0 +1,62 @@ | |||
2295 | 1 | /* | ||
2296 | 2 | * Copyright 2016 Canonical Ltd. | ||
2297 | 3 | * | ||
2298 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2299 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2300 | 6 | * the Free Software Foundation; version 3. | ||
2301 | 7 | * | ||
2302 | 8 | * This program is distributed in the hope that it will be useful, | ||
2303 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2304 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2305 | 11 | * GNU Lesser General Public License for more details. | ||
2306 | 12 | * | ||
2307 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2308 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2309 | 15 | */ | ||
2310 | 16 | |||
2311 | 17 | import QtQuick 2.0 | ||
2312 | 18 | import Ubuntu.Components 1.0 | ||
2313 | 19 | |||
2314 | 20 | MainView { | ||
2315 | 21 | width: units.gu(48) | ||
2316 | 22 | height: units.gu(60) | ||
2317 | 23 | objectName: "mainView" | ||
2318 | 24 | |||
2319 | 25 | Label { | ||
2320 | 26 | id: clickedLabel | ||
2321 | 27 | objectName: "clickedLabel" | ||
2322 | 28 | text: "No element clicked." | ||
2323 | 29 | } | ||
2324 | 30 | |||
2325 | 31 | Flickable { | ||
2326 | 32 | anchors { | ||
2327 | 33 | fill: parent | ||
2328 | 34 | topMargin: clickedLabel.height | ||
2329 | 35 | // It can't be at the bottom, or the toolbar will be opened | ||
2330 | 36 | // when we try to click it. | ||
2331 | 37 | bottomMargin: units.gu(10) | ||
2332 | 38 | } | ||
2333 | 39 | objectName: 'flickable' | ||
2334 | 40 | height: units.gu(60) | ||
2335 | 41 | contentHeight: bottomButton.y + bottomButton.height | ||
2336 | 42 | |||
2337 | 43 | Button { | ||
2338 | 44 | id: topButton | ||
2339 | 45 | objectName: 'topButton' | ||
2340 | 46 | text: 'Top button' | ||
2341 | 47 | onClicked: clickedLabel.text = objectName | ||
2342 | 48 | } | ||
2343 | 49 | Rectangle { | ||
2344 | 50 | id: emptyRectangle | ||
2345 | 51 | height: units.gu(80) | ||
2346 | 52 | anchors.top: topButton.bottom | ||
2347 | 53 | } | ||
2348 | 54 | Button { | ||
2349 | 55 | id: bottomButton | ||
2350 | 56 | objectName: 'bottomButton' | ||
2351 | 57 | text: 'Bottom button' | ||
2352 | 58 | onClicked: clickedLabel.text = objectName | ||
2353 | 59 | anchors.top: emptyRectangle.bottom | ||
2354 | 60 | } | ||
2355 | 61 | } | ||
2356 | 62 | } | ||
2357 | 0 | 63 | ||
2358 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.UnityFlickableTestCase.qml' | |||
2359 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.UnityFlickableTestCase.qml 1970-01-01 00:00:00 +0000 | |||
2360 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.UnityFlickableTestCase.qml 2016-08-14 09:05:30 +0000 | |||
2361 | @@ -0,0 +1,30 @@ | |||
2362 | 1 | /* | ||
2363 | 2 | * Copyright 2016 Canonical Ltd. | ||
2364 | 3 | * | ||
2365 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2366 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2367 | 6 | * the Free Software Foundation; version 3. | ||
2368 | 7 | * | ||
2369 | 8 | * This program is distributed in the hope that it will be useful, | ||
2370 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2371 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2372 | 11 | * GNU Lesser General Public License for more details. | ||
2373 | 12 | * | ||
2374 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2375 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2376 | 15 | */ | ||
2377 | 16 | |||
2378 | 17 | import QtQuick 2.0 | ||
2379 | 18 | import Ubuntu.Components 1.0 | ||
2380 | 19 | |||
2381 | 20 | MainView { | ||
2382 | 21 | width: units.gu(48) | ||
2383 | 22 | height: units.gu(60) | ||
2384 | 23 | objectName: 'mainView' | ||
2385 | 24 | |||
2386 | 25 | Flickable { | ||
2387 | 26 | objectName: 'testFlickable' | ||
2388 | 27 | width: 200; height: 200 | ||
2389 | 28 | contentWidth: image.width; contentHeight: image.height | ||
2390 | 29 | } | ||
2391 | 30 | } | ||
2392 | 0 | 31 | ||
2393 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.py' | |||
2394 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.py 2016-01-18 15:39:13 +0000 | |||
2395 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable_uitk10.py 2016-08-14 09:05:30 +0000 | |||
2396 | @@ -15,6 +15,7 @@ | |||
2397 | 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/>. |
2398 | 16 | 16 | ||
2399 | 17 | from unittest import mock | 17 | from unittest import mock |
2400 | 18 | import os | ||
2401 | 18 | 19 | ||
2402 | 19 | import testtools | 20 | import testtools |
2403 | 20 | import ubuntuuitoolkit | 21 | import ubuntuuitoolkit |
2404 | @@ -49,7 +50,7 @@ | |||
2405 | 49 | self.assertFalse(element.is_flickable()) | 50 | self.assertFalse(element.is_flickable()) |
2406 | 50 | 51 | ||
2407 | 51 | 52 | ||
2409 | 52 | class IsFlickableTestCase(tests.QMLStringAppTestCase): | 53 | class IsFlickableTestCase(tests.QMLFileAppTestCase): |
2410 | 53 | """Functional test to check that is_flickable returns the right value. | 54 | """Functional test to check that is_flickable returns the right value. |
2411 | 54 | 55 | ||
2412 | 55 | We already have tests for is_flickable with mocks, so here we just check | 56 | We already have tests for is_flickable with mocks, so here we just check |
2413 | @@ -57,27 +58,10 @@ | |||
2414 | 57 | 58 | ||
2415 | 58 | """ | 59 | """ |
2416 | 59 | 60 | ||
2438 | 60 | test_qml = (""" | 61 | path = os.path.abspath(__file__) |
2439 | 61 | import QtQuick 2.0 | 62 | dir_path = os.path.dirname(path) |
2440 | 62 | import Ubuntu.Components 1.0 | 63 | test_qml_file_path = os.path.join( |
2441 | 63 | import Ubuntu.Components.ListItems 1.0 as ListItem | 64 | dir_path, 'test_flickable_uitk10.IsFlickableTestCase.qml') |
2421 | 64 | |||
2422 | 65 | MainView { | ||
2423 | 66 | objectName: 'mainView' | ||
2424 | 67 | width: units.gu(48) | ||
2425 | 68 | height: units.gu(60) | ||
2426 | 69 | |||
2427 | 70 | Flickable { | ||
2428 | 71 | objectName: 'flickable' | ||
2429 | 72 | } | ||
2430 | 73 | ListView { | ||
2431 | 74 | objectName: 'listView' | ||
2432 | 75 | } | ||
2433 | 76 | Label { | ||
2434 | 77 | objectName: 'label' | ||
2435 | 78 | } | ||
2436 | 79 | } | ||
2437 | 80 | """) | ||
2442 | 81 | 65 | ||
2443 | 82 | scenarios = [ | 66 | scenarios = [ |
2444 | 83 | ('main view', dict(object_name='mainView', is_flickable=False)), | 67 | ('main view', dict(object_name='mainView', is_flickable=False)), |
2445 | @@ -92,56 +76,12 @@ | |||
2446 | 92 | self.assertEqual(element.is_flickable(), self.is_flickable) | 76 | self.assertEqual(element.is_flickable(), self.is_flickable) |
2447 | 93 | 77 | ||
2448 | 94 | 78 | ||
2499 | 95 | class SwipeFlickableTestCase(tests.QMLStringAppTestCase): | 79 | class SwipeFlickableTestCase(tests.QMLFileAppTestCase): |
2500 | 96 | 80 | ||
2501 | 97 | test_qml = (""" | 81 | path = os.path.abspath(__file__) |
2502 | 98 | import QtQuick 2.0 | 82 | dir_path = os.path.dirname(path) |
2503 | 99 | import Ubuntu.Components 1.0 | 83 | test_qml_file_path = os.path.join( |
2504 | 100 | 84 | dir_path, 'test_flickable_uitk10.SwipeFlickableTestCase.qml') | |
2455 | 101 | MainView { | ||
2456 | 102 | width: units.gu(48) | ||
2457 | 103 | height: units.gu(60) | ||
2458 | 104 | objectName: "mainView" | ||
2459 | 105 | |||
2460 | 106 | Label { | ||
2461 | 107 | id: clickedLabel | ||
2462 | 108 | objectName: "clickedLabel" | ||
2463 | 109 | text: "No element clicked." | ||
2464 | 110 | } | ||
2465 | 111 | |||
2466 | 112 | Flickable { | ||
2467 | 113 | anchors { | ||
2468 | 114 | fill: parent | ||
2469 | 115 | topMargin: clickedLabel.height | ||
2470 | 116 | // It can't be at the bottom, or the toolbar will be opened | ||
2471 | 117 | // when we try to click it. | ||
2472 | 118 | bottomMargin: units.gu(10) | ||
2473 | 119 | } | ||
2474 | 120 | objectName: 'flickable' | ||
2475 | 121 | height: units.gu(60) | ||
2476 | 122 | contentHeight: bottomButton.y + bottomButton.height | ||
2477 | 123 | |||
2478 | 124 | Button { | ||
2479 | 125 | id: topButton | ||
2480 | 126 | objectName: 'topButton' | ||
2481 | 127 | text: 'Top button' | ||
2482 | 128 | onClicked: clickedLabel.text = objectName | ||
2483 | 129 | } | ||
2484 | 130 | Rectangle { | ||
2485 | 131 | id: emptyRectangle | ||
2486 | 132 | height: units.gu(80) | ||
2487 | 133 | anchors.top: topButton.bottom | ||
2488 | 134 | } | ||
2489 | 135 | Button { | ||
2490 | 136 | id: bottomButton | ||
2491 | 137 | objectName: 'bottomButton' | ||
2492 | 138 | text: 'Bottom button' | ||
2493 | 139 | onClicked: clickedLabel.text = objectName | ||
2494 | 140 | anchors.top: emptyRectangle.bottom | ||
2495 | 141 | } | ||
2496 | 142 | } | ||
2497 | 143 | } | ||
2498 | 144 | """) | ||
2505 | 145 | 85 | ||
2506 | 146 | def setUp(self): | 86 | def setUp(self): |
2507 | 147 | super().setUp() | 87 | super().setUp() |
2508 | @@ -271,24 +211,12 @@ | |||
2509 | 271 | self.assertEqual('Could not swipe in the flickable.', str(error)) | 211 | self.assertEqual('Could not swipe in the flickable.', str(error)) |
2510 | 272 | 212 | ||
2511 | 273 | 213 | ||
2530 | 274 | class UnityFlickableTestCase(tests.QMLStringAppTestCase): | 214 | class UnityFlickableTestCase(tests.QMLFileAppTestCase): |
2531 | 275 | 215 | ||
2532 | 276 | test_qml = (""" | 216 | path = os.path.abspath(__file__) |
2533 | 277 | import QtQuick 2.0 | 217 | dir_path = os.path.dirname(path) |
2534 | 278 | import Ubuntu.Components 1.0 | 218 | test_qml_file_path = os.path.join( |
2535 | 279 | 219 | dir_path, 'test_flickable_uitk10.UnityFlickableTestCase.qml') | |
2518 | 280 | MainView { | ||
2519 | 281 | width: units.gu(48) | ||
2520 | 282 | height: units.gu(60) | ||
2521 | 283 | objectName: 'mainView' | ||
2522 | 284 | |||
2523 | 285 | Flickable { | ||
2524 | 286 | objectName: 'testFlickable' | ||
2525 | 287 | width: 200; height: 200 | ||
2526 | 288 | contentWidth: image.width; contentHeight: image.height | ||
2527 | 289 | } | ||
2528 | 290 | } | ||
2529 | 291 | """) | ||
2536 | 292 | 220 | ||
2537 | 293 | def get_command_line(self, command_line): | 221 | def get_command_line(self, command_line): |
2538 | 294 | command_line.append('-engine') | 222 | command_line.append('-engine') |
2539 | 295 | 223 | ||
2540 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.SwipeToDeleteTestCase.qml' | |||
2541 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.SwipeToDeleteTestCase.qml 1970-01-01 00:00:00 +0000 | |||
2542 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.SwipeToDeleteTestCase.qml 2016-08-14 09:05:30 +0000 | |||
2543 | @@ -0,0 +1,79 @@ | |||
2544 | 1 | /* | ||
2545 | 2 | * Copyright 2016 Canonical Ltd. | ||
2546 | 3 | * | ||
2547 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2548 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2549 | 6 | * the Free Software Foundation; version 3. | ||
2550 | 7 | * | ||
2551 | 8 | * This program is distributed in the hope that it will be useful, | ||
2552 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2553 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2554 | 11 | * GNU Lesser General Public License for more details. | ||
2555 | 12 | * | ||
2556 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2557 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2558 | 15 | */ | ||
2559 | 16 | |||
2560 | 17 | import QtQuick 2.0 | ||
2561 | 18 | import Ubuntu.Components 1.0 | ||
2562 | 19 | import Ubuntu.Components.ListItems 1.0 | ||
2563 | 20 | |||
2564 | 21 | MainView { | ||
2565 | 22 | width: units.gu(48) | ||
2566 | 23 | height: units.gu(60) | ||
2567 | 24 | objectName: "mainView" | ||
2568 | 25 | |||
2569 | 26 | Page { | ||
2570 | 27 | |||
2571 | 28 | ListModel { | ||
2572 | 29 | id: testModel | ||
2573 | 30 | |||
2574 | 31 | ListElement { | ||
2575 | 32 | name: "listitem_destroyed_on_remove_with_confirm" | ||
2576 | 33 | label: "Item destroyed on remove with confirmation" | ||
2577 | 34 | confirm: true | ||
2578 | 35 | } | ||
2579 | 36 | ListElement { | ||
2580 | 37 | name: "listitem_destroyed_on_remove_without_confirm" | ||
2581 | 38 | label: "Item destroyed on remove without confirmation" | ||
2582 | 39 | confirm: false | ||
2583 | 40 | } | ||
2584 | 41 | } | ||
2585 | 42 | |||
2586 | 43 | Column { | ||
2587 | 44 | anchors { fill: parent } | ||
2588 | 45 | |||
2589 | 46 | Standard { | ||
2590 | 47 | objectName: "listitem_standard" | ||
2591 | 48 | confirmRemoval: true | ||
2592 | 49 | removable: true | ||
2593 | 50 | text: 'Slide to remove' | ||
2594 | 51 | } | ||
2595 | 52 | |||
2596 | 53 | Empty { | ||
2597 | 54 | objectName: "listitem_empty" | ||
2598 | 55 | } | ||
2599 | 56 | |||
2600 | 57 | Standard { | ||
2601 | 58 | objectName: "listitem_without_confirm" | ||
2602 | 59 | confirmRemoval: false | ||
2603 | 60 | removable: true | ||
2604 | 61 | text: "Item without delete confirmation" | ||
2605 | 62 | } | ||
2606 | 63 | |||
2607 | 64 | ListView { | ||
2608 | 65 | anchors { left: parent.left; right: parent.right } | ||
2609 | 66 | height: childrenRect.height | ||
2610 | 67 | model: testModel | ||
2611 | 68 | |||
2612 | 69 | delegate: Standard { | ||
2613 | 70 | removable: true | ||
2614 | 71 | confirmRemoval: confirm | ||
2615 | 72 | onItemRemoved: testModel.remove(index) | ||
2616 | 73 | text: label | ||
2617 | 74 | objectName: name | ||
2618 | 75 | } | ||
2619 | 76 | } | ||
2620 | 77 | } | ||
2621 | 78 | } | ||
2622 | 79 | } | ||
2623 | 0 | 80 | ||
2624 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py' | |||
2625 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2015-04-14 21:02:06 +0000 | |||
2626 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2016-08-14 09:05:30 +0000 | |||
2627 | @@ -48,74 +48,12 @@ | |||
2628 | 48 | listitems.Subtitled, listitems.Base)) | 48 | listitems.Subtitled, listitems.Base)) |
2629 | 49 | 49 | ||
2630 | 50 | 50 | ||
2699 | 51 | class SwipeToDeleteTestCase(tests.QMLStringAppTestCase): | 51 | class SwipeToDeleteTestCase(tests.QMLFileAppTestCase): |
2700 | 52 | 52 | ||
2701 | 53 | test_qml = (""" | 53 | path = os.path.abspath(__file__) |
2702 | 54 | import QtQuick 2.0 | 54 | dir_path = os.path.dirname(path) |
2703 | 55 | import Ubuntu.Components 1.0 | 55 | test_qml_file_path = os.path.join( |
2704 | 56 | import Ubuntu.Components.ListItems 1.0 | 56 | dir_path, 'test_listitems.SwipeToDeleteTestCase.qml') |
2637 | 57 | |||
2638 | 58 | |||
2639 | 59 | MainView { | ||
2640 | 60 | width: units.gu(48) | ||
2641 | 61 | height: units.gu(60) | ||
2642 | 62 | objectName: "mainView" | ||
2643 | 63 | |||
2644 | 64 | Page { | ||
2645 | 65 | |||
2646 | 66 | ListModel { | ||
2647 | 67 | id: testModel | ||
2648 | 68 | |||
2649 | 69 | ListElement { | ||
2650 | 70 | name: "listitem_destroyed_on_remove_with_confirm" | ||
2651 | 71 | label: "Item destroyed on remove with confirmation" | ||
2652 | 72 | confirm: true | ||
2653 | 73 | } | ||
2654 | 74 | ListElement { | ||
2655 | 75 | name: "listitem_destroyed_on_remove_without_confirm" | ||
2656 | 76 | label: "Item destroyed on remove without confirmation" | ||
2657 | 77 | confirm: false | ||
2658 | 78 | } | ||
2659 | 79 | } | ||
2660 | 80 | |||
2661 | 81 | Column { | ||
2662 | 82 | anchors { fill: parent } | ||
2663 | 83 | |||
2664 | 84 | Standard { | ||
2665 | 85 | objectName: "listitem_standard" | ||
2666 | 86 | confirmRemoval: true | ||
2667 | 87 | removable: true | ||
2668 | 88 | text: 'Slide to remove' | ||
2669 | 89 | } | ||
2670 | 90 | |||
2671 | 91 | Empty { | ||
2672 | 92 | objectName: "listitem_empty" | ||
2673 | 93 | } | ||
2674 | 94 | |||
2675 | 95 | Standard { | ||
2676 | 96 | objectName: "listitem_without_confirm" | ||
2677 | 97 | confirmRemoval: false | ||
2678 | 98 | removable: true | ||
2679 | 99 | text: "Item without delete confirmation" | ||
2680 | 100 | } | ||
2681 | 101 | |||
2682 | 102 | ListView { | ||
2683 | 103 | anchors { left: parent.left; right: parent.right } | ||
2684 | 104 | height: childrenRect.height | ||
2685 | 105 | model: testModel | ||
2686 | 106 | |||
2687 | 107 | delegate: Standard { | ||
2688 | 108 | removable: true | ||
2689 | 109 | confirmRemoval: confirm | ||
2690 | 110 | onItemRemoved: testModel.remove(index) | ||
2691 | 111 | text: label | ||
2692 | 112 | objectName: name | ||
2693 | 113 | } | ||
2694 | 114 | } | ||
2695 | 115 | } | ||
2696 | 116 | } | ||
2697 | 117 | } | ||
2698 | 118 | """) | ||
2705 | 119 | 57 | ||
2706 | 120 | def setUp(self): | 58 | def setUp(self): |
2707 | 121 | super().setUp() | 59 | super().setUp() |
2708 | 122 | 60 | ||
2709 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_header.qml' | |||
2710 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_header.qml 1970-01-01 00:00:00 +0000 | |||
2711 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_header.qml 2016-08-14 09:05:30 +0000 | |||
2712 | @@ -0,0 +1,48 @@ | |||
2713 | 1 | /* | ||
2714 | 2 | * Copyright 2016 Canonical Ltd. | ||
2715 | 3 | * | ||
2716 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2717 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2718 | 6 | * the Free Software Foundation; version 3. | ||
2719 | 7 | * | ||
2720 | 8 | * This program is distributed in the hope that it will be useful, | ||
2721 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2722 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2723 | 11 | * GNU Lesser General Public License for more details. | ||
2724 | 12 | * | ||
2725 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2726 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2727 | 15 | */ | ||
2728 | 16 | |||
2729 | 17 | import QtQuick 2.0 | ||
2730 | 18 | import Ubuntu.Components 1.0 | ||
2731 | 19 | |||
2732 | 20 | MainView { | ||
2733 | 21 | width: units.gu(48) | ||
2734 | 22 | height: units.gu(60) | ||
2735 | 23 | objectName: "mainView" | ||
2736 | 24 | useDeprecatedToolbar: false | ||
2737 | 25 | |||
2738 | 26 | PageStack { | ||
2739 | 27 | id: pageStack | ||
2740 | 28 | Component.onCompleted: push(page0) | ||
2741 | 29 | |||
2742 | 30 | Page { | ||
2743 | 31 | id: page0 | ||
2744 | 32 | title: "Page 0" | ||
2745 | 33 | visible: false | ||
2746 | 34 | |||
2747 | 35 | Button { | ||
2748 | 36 | objectName: "go_to_page1" | ||
2749 | 37 | text: "Go to page 1" | ||
2750 | 38 | onClicked: pageStack.push(page1) | ||
2751 | 39 | } | ||
2752 | 40 | } | ||
2753 | 41 | |||
2754 | 42 | Page { | ||
2755 | 43 | id: page1 | ||
2756 | 44 | title: "Page 1" | ||
2757 | 45 | visible: false | ||
2758 | 46 | } | ||
2759 | 47 | } | ||
2760 | 48 | } | ||
2761 | 0 | 49 | ||
2762 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_toolbar.qml' | |||
2763 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_toolbar.qml 1970-01-01 00:00:00 +0000 | |||
2764 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.GoBackTestCase.back_in_toolbar.qml 2016-08-14 09:05:30 +0000 | |||
2765 | @@ -0,0 +1,48 @@ | |||
2766 | 1 | /* | ||
2767 | 2 | * Copyright 2016 Canonical Ltd. | ||
2768 | 3 | * | ||
2769 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2770 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2771 | 6 | * the Free Software Foundation; version 3. | ||
2772 | 7 | * | ||
2773 | 8 | * This program is distributed in the hope that it will be useful, | ||
2774 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2775 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2776 | 11 | * GNU Lesser General Public License for more details. | ||
2777 | 12 | * | ||
2778 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2779 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2780 | 15 | */ | ||
2781 | 16 | |||
2782 | 17 | import QtQuick 2.0 | ||
2783 | 18 | import Ubuntu.Components 1.0 | ||
2784 | 19 | |||
2785 | 20 | MainView { | ||
2786 | 21 | width: units.gu(48) | ||
2787 | 22 | height: units.gu(60) | ||
2788 | 23 | objectName: "mainView" | ||
2789 | 24 | useDeprecatedToolbar: true | ||
2790 | 25 | |||
2791 | 26 | PageStack { | ||
2792 | 27 | id: pageStack | ||
2793 | 28 | Component.onCompleted: push(page0) | ||
2794 | 29 | |||
2795 | 30 | Page { | ||
2796 | 31 | id: page0 | ||
2797 | 32 | title: "Page 0" | ||
2798 | 33 | visible: false | ||
2799 | 34 | |||
2800 | 35 | Button { | ||
2801 | 36 | objectName: "go_to_page1" | ||
2802 | 37 | text: "Go to page 1" | ||
2803 | 38 | onClicked: pageStack.push(page1) | ||
2804 | 39 | } | ||
2805 | 40 | } | ||
2806 | 41 | |||
2807 | 42 | Page { | ||
2808 | 43 | id: page1 | ||
2809 | 44 | title: "Page 1" | ||
2810 | 45 | visible: false | ||
2811 | 46 | } | ||
2812 | 47 | } | ||
2813 | 48 | } | ||
2814 | 0 | 49 | ||
2815 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView10TestCase.qml' | |||
2816 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView10TestCase.qml 1970-01-01 00:00:00 +0000 | |||
2817 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView10TestCase.qml 2016-08-14 09:05:30 +0000 | |||
2818 | @@ -0,0 +1,24 @@ | |||
2819 | 1 | /* | ||
2820 | 2 | * Copyright 2016 Canonical Ltd. | ||
2821 | 3 | * | ||
2822 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2823 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2824 | 6 | * the Free Software Foundation; version 3. | ||
2825 | 7 | * | ||
2826 | 8 | * This program is distributed in the hope that it will be useful, | ||
2827 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2828 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2829 | 11 | * GNU Lesser General Public License for more details. | ||
2830 | 12 | * | ||
2831 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2832 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2833 | 15 | */ | ||
2834 | 16 | |||
2835 | 17 | import QtQuick 2.0 | ||
2836 | 18 | import Ubuntu.Components 1.0 | ||
2837 | 19 | |||
2838 | 20 | MainView { | ||
2839 | 21 | width: units.gu(48) | ||
2840 | 22 | height: units.gu(60) | ||
2841 | 23 | objectName: "mainView" | ||
2842 | 24 | } | ||
2843 | 0 | 25 | ||
2844 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView12TestCase.qml' | |||
2845 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView12TestCase.qml 1970-01-01 00:00:00 +0000 | |||
2846 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.MainView12TestCase.qml 2016-08-14 09:05:30 +0000 | |||
2847 | @@ -0,0 +1,24 @@ | |||
2848 | 1 | /* | ||
2849 | 2 | * Copyright 2016 Canonical Ltd. | ||
2850 | 3 | * | ||
2851 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2852 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2853 | 6 | * the Free Software Foundation; version 3. | ||
2854 | 7 | * | ||
2855 | 8 | * This program is distributed in the hope that it will be useful, | ||
2856 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2857 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2858 | 11 | * GNU Lesser General Public License for more details. | ||
2859 | 12 | * | ||
2860 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2861 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2862 | 15 | */ | ||
2863 | 16 | |||
2864 | 17 | import QtQuick 2.3 | ||
2865 | 18 | import Ubuntu.Components 1.2 | ||
2866 | 19 | |||
2867 | 20 | MainView { | ||
2868 | 21 | width: units.gu(48) | ||
2869 | 22 | height: units.gu(60) | ||
2870 | 23 | objectName: "mainView" | ||
2871 | 24 | } | ||
2872 | 0 | 25 | ||
2873 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.py' | |||
2874 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.py 2015-09-22 15:56:35 +0000 | |||
2875 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_main_view.py 2016-08-14 09:05:30 +0000 | |||
2876 | @@ -14,24 +14,19 @@ | |||
2877 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
2878 | 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/>. |
2879 | 16 | 16 | ||
2880 | 17 | import os | ||
2881 | 17 | from unittest import mock | 18 | from unittest import mock |
2882 | 18 | 19 | ||
2883 | 19 | import ubuntuuitoolkit | 20 | import ubuntuuitoolkit |
2884 | 20 | from ubuntuuitoolkit import tests | 21 | from ubuntuuitoolkit import tests |
2885 | 21 | 22 | ||
2886 | 22 | 23 | ||
2899 | 23 | class MainView10TestCase(tests.QMLStringAppTestCase): | 24 | class MainView10TestCase(tests.QMLFileAppTestCase): |
2900 | 24 | 25 | ||
2901 | 25 | test_qml = (""" | 26 | path = os.path.abspath(__file__) |
2902 | 26 | import QtQuick 2.0 | 27 | dir_path = os.path.dirname(path) |
2903 | 27 | import Ubuntu.Components 1.0 | 28 | test_qml_file_path = os.path.join( |
2904 | 28 | 29 | dir_path, 'test_main_view.MainView10TestCase.qml') | |
2893 | 29 | MainView { | ||
2894 | 30 | width: units.gu(48) | ||
2895 | 31 | height: units.gu(60) | ||
2896 | 32 | objectName: "mainView" | ||
2897 | 33 | } | ||
2898 | 34 | """) | ||
2905 | 35 | 30 | ||
2906 | 36 | def test_main_view_custom_proxy_object(self): | 31 | def test_main_view_custom_proxy_object(self): |
2907 | 37 | self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView) | 32 | self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView) |
2908 | @@ -75,18 +70,12 @@ | |||
2909 | 75 | str(error), 'The MainView has no Tabs.') | 70 | str(error), 'The MainView has no Tabs.') |
2910 | 76 | 71 | ||
2911 | 77 | 72 | ||
2924 | 78 | class MainView12TestCase(tests.QMLStringAppTestCase): | 73 | class MainView12TestCase(tests.QMLFileAppTestCase): |
2925 | 79 | 74 | ||
2926 | 80 | test_qml = (""" | 75 | path = os.path.abspath(__file__) |
2927 | 81 | import QtQuick 2.3 | 76 | dir_path = os.path.dirname(path) |
2928 | 82 | import Ubuntu.Components 1.2 | 77 | test_qml_file_path = os.path.join( |
2929 | 83 | 78 | dir_path, 'test_main_view.MainView12TestCase.qml') | |
2918 | 84 | MainView { | ||
2919 | 85 | width: units.gu(48) | ||
2920 | 86 | height: units.gu(60) | ||
2921 | 87 | objectName: "mainView" | ||
2922 | 88 | } | ||
2923 | 89 | """) | ||
2930 | 90 | 79 | ||
2931 | 91 | def test_main_view_custom_proxy_object(self): | 80 | def test_main_view_custom_proxy_object(self): |
2932 | 92 | self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView) | 81 | self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView) |
2933 | @@ -128,51 +117,20 @@ | |||
2934 | 128 | str(error), 'The MainView has no Toolbar.') | 117 | str(error), 'The MainView has no Toolbar.') |
2935 | 129 | 118 | ||
2936 | 130 | 119 | ||
2974 | 131 | TEST_GO_BACK_QML_FORMAT = (""" | 120 | class GoBackTestCase(tests.QMLFileAppTestCase): |
2975 | 132 | import QtQuick 2.0 | 121 | |
2976 | 133 | import Ubuntu.Components 1.0 | 122 | path = os.path.abspath(__file__) |
2977 | 134 | 123 | dir_path = os.path.dirname(path) | |
2978 | 135 | MainView {{ | 124 | toolbar_test_qml_file_path = os.path.join( |
2979 | 136 | width: units.gu(48) | 125 | dir_path, 'test_main_view.GoBackTestCase.back_in_toolbar.qml') |
2980 | 137 | height: units.gu(60) | 126 | header_test_qml_file_path = os.path.join( |
2981 | 138 | objectName: "mainView" | 127 | dir_path, 'test_main_view.GoBackTestCase.back_in_header.qml') |
2945 | 139 | useDeprecatedToolbar: {use_deprecated_toolbar} | ||
2946 | 140 | |||
2947 | 141 | PageStack {{ | ||
2948 | 142 | id: pageStack | ||
2949 | 143 | Component.onCompleted: push(page0) | ||
2950 | 144 | |||
2951 | 145 | Page {{ | ||
2952 | 146 | id: page0 | ||
2953 | 147 | title: "Page 0" | ||
2954 | 148 | visible: false | ||
2955 | 149 | |||
2956 | 150 | Button {{ | ||
2957 | 151 | objectName: "go_to_page1" | ||
2958 | 152 | text: "Go to page 1" | ||
2959 | 153 | onClicked: pageStack.push(page1) | ||
2960 | 154 | }} | ||
2961 | 155 | }} | ||
2962 | 156 | |||
2963 | 157 | Page {{ | ||
2964 | 158 | id: page1 | ||
2965 | 159 | title: "Page 1" | ||
2966 | 160 | visible: false | ||
2967 | 161 | }} | ||
2968 | 162 | }} | ||
2969 | 163 | }} | ||
2970 | 164 | """) | ||
2971 | 165 | |||
2972 | 166 | |||
2973 | 167 | class GoBackTestCase(tests.QMLStringAppTestCase): | ||
2982 | 168 | 128 | ||
2983 | 169 | scenarios = [ | 129 | scenarios = [ |
2990 | 170 | ('back in toolbar', dict( | 130 | ('back_in_toolbar', dict( |
2991 | 171 | test_qml=TEST_GO_BACK_QML_FORMAT.format( | 131 | test_qml_file_path=toolbar_test_qml_file_path)), |
2992 | 172 | use_deprecated_toolbar='true'))), | 132 | ('back_in_header', dict( |
2993 | 173 | ('back in header', dict( | 133 | test_qml_file_path=header_test_qml_file_path)) |
2988 | 174 | test_qml=TEST_GO_BACK_QML_FORMAT.format( | ||
2989 | 175 | use_deprecated_toolbar='false'))) | ||
2994 | 176 | ] | 134 | ] |
2995 | 177 | 135 | ||
2996 | 178 | def setUp(self): | 136 | def setUp(self): |
2997 | 179 | 137 | ||
2998 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorCustomDelegateTestCase.qml' | |||
2999 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorCustomDelegateTestCase.qml 1970-01-01 00:00:00 +0000 | |||
3000 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorCustomDelegateTestCase.qml 2016-08-14 09:05:30 +0000 | |||
3001 | @@ -0,0 +1,60 @@ | |||
3002 | 1 | /* | ||
3003 | 2 | * Copyright 2016 Canonical Ltd. | ||
3004 | 3 | * | ||
3005 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3006 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3007 | 6 | * the Free Software Foundation; version 3. | ||
3008 | 7 | * | ||
3009 | 8 | * This program is distributed in the hope that it will be useful, | ||
3010 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3011 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3012 | 11 | * GNU Lesser General Public License for more details. | ||
3013 | 12 | * | ||
3014 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3015 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3016 | 15 | */ | ||
3017 | 16 | |||
3018 | 17 | import QtQuick 2.0 | ||
3019 | 18 | import Ubuntu.Components 1.3 | ||
3020 | 19 | |||
3021 | 20 | MainView { | ||
3022 | 21 | width: units.gu(48) | ||
3023 | 22 | height: units.gu(60) | ||
3024 | 23 | objectName: "mainView" | ||
3025 | 24 | |||
3026 | 25 | Page{ | ||
3027 | 26 | |||
3028 | 27 | Column { | ||
3029 | 28 | anchors.left: parent.left | ||
3030 | 29 | anchors.right: parent.right | ||
3031 | 30 | anchors.fill: parent | ||
3032 | 31 | |||
3033 | 32 | spacing: units.gu(3) | ||
3034 | 33 | |||
3035 | 34 | Component { | ||
3036 | 35 | id: valueSelectorDelegate | ||
3037 | 36 | OptionSelectorDelegate { | ||
3038 | 37 | text: label | ||
3039 | 38 | objectName: name | ||
3040 | 39 | } | ||
3041 | 40 | } | ||
3042 | 41 | |||
3043 | 42 | ListModel { | ||
3044 | 43 | id: valueModel | ||
3045 | 44 | ListElement { name: "one"; label: "Value 1" } | ||
3046 | 45 | ListElement { name: "two"; label: "Value 2" } | ||
3047 | 46 | ListElement { name: "three"; label: "Value 3" } | ||
3048 | 47 | ListElement { name: "four"; label: "Value 4" } | ||
3049 | 48 | ListElement { name: "five"; label: "Value 5" } | ||
3050 | 49 | } | ||
3051 | 50 | |||
3052 | 51 | OptionSelector { | ||
3053 | 52 | id: valueSelector | ||
3054 | 53 | objectName: "test_option_selector_collapsed" | ||
3055 | 54 | text: "Collapsed" | ||
3056 | 55 | delegate: valueSelectorDelegate | ||
3057 | 56 | model: valueModel | ||
3058 | 57 | } | ||
3059 | 58 | } | ||
3060 | 59 | } | ||
3061 | 60 | } | ||
3062 | 0 | 61 | ||
3063 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorTestCase.qml' | |||
3064 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorTestCase.qml 1970-01-01 00:00:00 +0000 | |||
3065 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.OptionSelectorTestCase.qml 2016-08-14 09:05:30 +0000 | |||
3066 | @@ -0,0 +1,42 @@ | |||
3067 | 1 | /* | ||
3068 | 2 | * Copyright 2016 Canonical Ltd. | ||
3069 | 3 | * | ||
3070 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3071 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3072 | 6 | * the Free Software Foundation; version 3. | ||
3073 | 7 | * | ||
3074 | 8 | * This program is distributed in the hope that it will be useful, | ||
3075 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3076 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3077 | 11 | * GNU Lesser General Public License for more details. | ||
3078 | 12 | * | ||
3079 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3080 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3081 | 15 | */ | ||
3082 | 16 | |||
3083 | 17 | import QtQuick 2.0 | ||
3084 | 18 | import Ubuntu.Components 1.3 | ||
3085 | 19 | |||
3086 | 20 | MainView { | ||
3087 | 21 | width: units.gu(48) | ||
3088 | 22 | height: units.gu(120) | ||
3089 | 23 | objectName: "mainView" | ||
3090 | 24 | |||
3091 | 25 | Column { | ||
3092 | 26 | anchors.fill: parent | ||
3093 | 27 | anchors.left: parent.left | ||
3094 | 28 | anchors.right: parent.right | ||
3095 | 29 | spacing: units.gu(3) | ||
3096 | 30 | |||
3097 | 31 | OptionSelector { | ||
3098 | 32 | objectName: "option_selector" | ||
3099 | 33 | text: i18n.tr("option_selector") | ||
3100 | 34 | expanded: true | ||
3101 | 35 | model: [i18n.tr("Red"), | ||
3102 | 36 | i18n.tr("Blue"), | ||
3103 | 37 | i18n.tr("Green"), | ||
3104 | 38 | i18n.tr("Yellow"), | ||
3105 | 39 | i18n.tr("Black")] | ||
3106 | 40 | } | ||
3107 | 41 | } | ||
3108 | 42 | } | ||
3109 | 0 | 43 | ||
3110 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.py' | |||
3111 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.py 2015-04-14 21:02:06 +0000 | |||
3112 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_optionselector.py 2016-08-14 09:05:30 +0000 | |||
3113 | @@ -14,58 +14,18 @@ | |||
3114 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
3115 | 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/>. |
3116 | 16 | 16 | ||
3117 | 17 | import os | ||
3118 | 17 | import ubuntuuitoolkit | 18 | import ubuntuuitoolkit |
3119 | 18 | from ubuntuuitoolkit import tests | 19 | from ubuntuuitoolkit import tests |
3120 | 19 | 20 | ||
3121 | 20 | 21 | ||
3170 | 21 | class OptionSelectorCustomDelegateTestCase(tests.QMLStringAppTestCase): | 22 | class OptionSelectorCustomDelegateTestCase(tests.QMLFileAppTestCase): |
3171 | 22 | 23 | ||
3172 | 23 | test_qml = (""" | 24 | path = os.path.abspath(__file__) |
3173 | 24 | import QtQuick 2.0 | 25 | dir_path = os.path.dirname(path) |
3174 | 25 | import Ubuntu.Components 1.0 | 26 | test_qml_file_path = os.path.join( |
3175 | 26 | 27 | dir_path, | |
3176 | 27 | MainView { | 28 | 'test_optionselector.OptionSelectorCustomDelegateTestCase.qml') |
3129 | 28 | width: units.gu(48) | ||
3130 | 29 | height: units.gu(60) | ||
3131 | 30 | objectName: "mainView" | ||
3132 | 31 | |||
3133 | 32 | Page{ | ||
3134 | 33 | |||
3135 | 34 | Column { | ||
3136 | 35 | anchors.left: parent.left | ||
3137 | 36 | anchors.right: parent.right | ||
3138 | 37 | anchors.fill: parent | ||
3139 | 38 | |||
3140 | 39 | spacing: units.gu(3) | ||
3141 | 40 | |||
3142 | 41 | Component { | ||
3143 | 42 | id: valueSelectorDelegate | ||
3144 | 43 | OptionSelectorDelegate { | ||
3145 | 44 | text: label | ||
3146 | 45 | objectName: name | ||
3147 | 46 | } | ||
3148 | 47 | } | ||
3149 | 48 | |||
3150 | 49 | ListModel { | ||
3151 | 50 | id: valueModel | ||
3152 | 51 | ListElement { name: "one"; label: "Value 1" } | ||
3153 | 52 | ListElement { name: "two"; label: "Value 2" } | ||
3154 | 53 | ListElement { name: "three"; label: "Value 3" } | ||
3155 | 54 | ListElement { name: "four"; label: "Value 4" } | ||
3156 | 55 | ListElement { name: "five"; label: "Value 5" } | ||
3157 | 56 | } | ||
3158 | 57 | |||
3159 | 58 | OptionSelector { | ||
3160 | 59 | id: valueSelector | ||
3161 | 60 | objectName: "test_option_selector_collapsed" | ||
3162 | 61 | text: "Collapsed" | ||
3163 | 62 | delegate: valueSelectorDelegate | ||
3164 | 63 | model: valueModel | ||
3165 | 64 | } | ||
3166 | 65 | } | ||
3167 | 66 | } | ||
3168 | 67 | } | ||
3169 | 68 | """) | ||
3177 | 69 | 29 | ||
3178 | 70 | def setUp(self): | 30 | def setUp(self): |
3179 | 71 | super().setUp() | 31 | super().setUp() |
3180 | @@ -119,36 +79,12 @@ | |||
3181 | 119 | self.assertEqual(2, self.option_selector.selectedIndex) | 79 | self.assertEqual(2, self.option_selector.selectedIndex) |
3182 | 120 | 80 | ||
3183 | 121 | 81 | ||
3214 | 122 | class OptionSelectorTestCase(tests.QMLStringAppTestCase): | 82 | class OptionSelectorTestCase(tests.QMLFileAppTestCase): |
3215 | 123 | 83 | ||
3216 | 124 | test_qml = (""" | 84 | path = os.path.abspath(__file__) |
3217 | 125 | import QtQuick 2.0 | 85 | dir_path = os.path.dirname(path) |
3218 | 126 | import Ubuntu.Components 1.0 | 86 | test_qml_file_path = os.path.join( |
3219 | 127 | 87 | dir_path, 'test_optionselector.OptionSelectorTestCase.qml') | |
3190 | 128 | MainView { | ||
3191 | 129 | width: units.gu(48) | ||
3192 | 130 | height: units.gu(120) | ||
3193 | 131 | objectName: "mainView" | ||
3194 | 132 | |||
3195 | 133 | Column { | ||
3196 | 134 | anchors.fill: parent | ||
3197 | 135 | anchors.left: parent.left | ||
3198 | 136 | anchors.right: parent.right | ||
3199 | 137 | spacing: units.gu(3) | ||
3200 | 138 | |||
3201 | 139 | OptionSelector { | ||
3202 | 140 | objectName: "option_selector" | ||
3203 | 141 | text: i18n.tr("option_selector") | ||
3204 | 142 | expanded: true | ||
3205 | 143 | model: [i18n.tr("Red"), | ||
3206 | 144 | i18n.tr("Blue"), | ||
3207 | 145 | i18n.tr("Green"), | ||
3208 | 146 | i18n.tr("Yellow"), | ||
3209 | 147 | i18n.tr("Black")] | ||
3210 | 148 | } | ||
3211 | 149 | } | ||
3212 | 150 | } | ||
3213 | 151 | """) | ||
3220 | 152 | 88 | ||
3221 | 153 | def setUp(self): | 89 | def setUp(self): |
3222 | 154 | super().setUp() | 90 | super().setUp() |
3223 | @@ -176,23 +112,23 @@ | |||
3224 | 176 | 112 | ||
3225 | 177 | def test_select_option(self): | 113 | def test_select_option(self): |
3226 | 178 | """select_text() must select the text in the OptionSelector""" | 114 | """select_text() must select the text in the OptionSelector""" |
3228 | 179 | self.option_selector.select_option('Label', text="Green") | 115 | self.option_selector.select_option('UCLabel', text="Green") |
3229 | 180 | self.assertEqual(2, self.option_selector.selectedIndex) | 116 | self.assertEqual(2, self.option_selector.selectedIndex) |
3230 | 181 | 117 | ||
3231 | 182 | def test_get_selected_text(self): | 118 | def test_get_selected_text(self): |
3232 | 183 | """get_selected_text() must return the text selected item""" | 119 | """get_selected_text() must return the text selected item""" |
3234 | 184 | self.option_selector.select_option('Label', text="Blue") | 120 | self.option_selector.select_option('UCLabel', text="Blue") |
3235 | 185 | self.assertEqual(1, self.option_selector.selectedIndex) | 121 | self.assertEqual(1, self.option_selector.selectedIndex) |
3236 | 186 | self.assertEqual( | 122 | self.assertEqual( |
3237 | 187 | self.option_selector.get_selected_text(), "Blue") | 123 | self.option_selector.get_selected_text(), "Blue") |
3238 | 188 | 124 | ||
3239 | 189 | def test_same_item_2_times(self): | 125 | def test_same_item_2_times(self): |
3240 | 190 | """Emulator must be able to select 2 items in a row""" | 126 | """Emulator must be able to select 2 items in a row""" |
3242 | 191 | self.option_selector.select_option('Label', text="Green") | 127 | self.option_selector.select_option('UCLabel', text="Green") |
3243 | 192 | self.assertEqual( | 128 | self.assertEqual( |
3244 | 193 | self.option_selector.get_selected_text(), "Green") | 129 | self.option_selector.get_selected_text(), "Green") |
3245 | 194 | self.assertEqual(2, self.option_selector.selectedIndex) | 130 | self.assertEqual(2, self.option_selector.selectedIndex) |
3247 | 195 | self.option_selector.select_option('Label', text="Green") | 131 | self.option_selector.select_option('UCLabel', text="Green") |
3248 | 196 | self.assertEqual( | 132 | self.assertEqual( |
3249 | 197 | self.option_selector.get_selected_text(), "Green") | 133 | self.option_selector.get_selected_text(), "Green") |
3250 | 198 | self.assertEqual(2, self.option_selector.selectedIndex) | 134 | self.assertEqual(2, self.option_selector.selectedIndex) |
3251 | 199 | 135 | ||
3252 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ActionSelectionPopoverTestCase.qml' | |||
3253 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ActionSelectionPopoverTestCase.qml 2015-10-01 12:26:23 +0000 | |||
3254 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ActionSelectionPopoverTestCase.qml 2016-08-14 09:05:30 +0000 | |||
3255 | @@ -48,11 +48,13 @@ | |||
3256 | 48 | Action { | 48 | Action { |
3257 | 49 | text: "Action two" | 49 | text: "Action two" |
3258 | 50 | objectName: "actionDisabled" | 50 | objectName: "actionDisabled" |
3259 | 51 | enabled: false | ||
3260 | 51 | onTriggered: label.text = "Disabled button clicked." | 52 | onTriggered: label.text = "Disabled button clicked." |
3261 | 52 | } | 53 | } |
3262 | 53 | Action { | 54 | Action { |
3263 | 54 | text: "Action three" | 55 | text: "Action three" |
3264 | 55 | objectName: "actionHidden" | 56 | objectName: "actionHidden" |
3265 | 57 | visible: false | ||
3266 | 56 | onTriggered: label.text = "Hidden button clicked." | 58 | onTriggered: label.text = "Hidden button clicked." |
3267 | 57 | } | 59 | } |
3268 | 58 | } | 60 | } |
3269 | 59 | 61 | ||
3270 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml' | |||
3271 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml 1970-01-01 00:00:00 +0000 | |||
3272 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.ComposerSheetTestCase.qml 2016-08-14 09:05:30 +0000 | |||
3273 | @@ -0,0 +1,52 @@ | |||
3274 | 1 | /* | ||
3275 | 2 | * Copyright 2016 Canonical Ltd. | ||
3276 | 3 | * | ||
3277 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3278 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3279 | 6 | * the Free Software Foundation; version 3. | ||
3280 | 7 | * | ||
3281 | 8 | * This program is distributed in the hope that it will be useful, | ||
3282 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3283 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3284 | 11 | * GNU Lesser General Public License for more details. | ||
3285 | 12 | * | ||
3286 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3287 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3288 | 15 | */ | ||
3289 | 16 | |||
3290 | 17 | import QtQuick 2.0 | ||
3291 | 18 | import Ubuntu.Components 1.0 | ||
3292 | 19 | import Ubuntu.Components.Popups 1.0 | ||
3293 | 20 | |||
3294 | 21 | MainView { | ||
3295 | 22 | width: units.gu(48) | ||
3296 | 23 | height: units.gu(60) | ||
3297 | 24 | objectName: "mainView" | ||
3298 | 25 | |||
3299 | 26 | Button { | ||
3300 | 27 | objectName: "openComposerSheetButton" | ||
3301 | 28 | text: "Open Composer Sheet" | ||
3302 | 29 | onClicked: PopupUtils.open(testComposerSheet); | ||
3303 | 30 | } | ||
3304 | 31 | |||
3305 | 32 | Label { | ||
3306 | 33 | id: "label" | ||
3307 | 34 | objectName: "actionLabel" | ||
3308 | 35 | anchors.centerIn: parent | ||
3309 | 36 | text: "No action taken." | ||
3310 | 37 | } | ||
3311 | 38 | |||
3312 | 39 | Component { | ||
3313 | 40 | id: testComposerSheet | ||
3314 | 41 | ComposerSheet { | ||
3315 | 42 | id: sheet | ||
3316 | 43 | objectName: "testComposerSheet" | ||
3317 | 44 | onCancelClicked: { | ||
3318 | 45 | label.text = "Cancel selected." | ||
3319 | 46 | } | ||
3320 | 47 | onConfirmClicked: { | ||
3321 | 48 | label.text = "Confirm selected." | ||
3322 | 49 | } | ||
3323 | 50 | } | ||
3324 | 51 | } | ||
3325 | 52 | } | ||
3326 | 0 | 53 | ||
3327 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py' | |||
3328 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-09-30 15:10:11 +0000 | |||
3329 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2016-08-14 09:05:30 +0000 | |||
3330 | @@ -23,6 +23,8 @@ | |||
3331 | 23 | 23 | ||
3332 | 24 | class ActionSelectionPopoverTestCase(tests.QMLFileAppTestCase): | 24 | class ActionSelectionPopoverTestCase(tests.QMLFileAppTestCase): |
3333 | 25 | 25 | ||
3334 | 26 | # FIXME: Currently we are only testing UITK 1.0 Popups, | ||
3335 | 27 | # we need to test 1.3 as well. See bug 1612582. | ||
3336 | 26 | path = os.path.abspath(__file__) | 28 | path = os.path.abspath(__file__) |
3337 | 27 | dir_path = os.path.dirname(path) | 29 | dir_path = os.path.dirname(path) |
3338 | 28 | test_qml_file_path = os.path.join( | 30 | test_qml_file_path = os.path.join( |
3339 | @@ -60,7 +62,7 @@ | |||
3340 | 60 | popover.click_action_button, 'actionTwo') | 62 | popover.click_action_button, 'actionTwo') |
3341 | 61 | self.assertEqual( | 63 | self.assertEqual( |
3342 | 62 | str(error), | 64 | str(error), |
3344 | 63 | 'Action with objectName "actionTwo" not found.') | 65 | 'Button for action with objectName "actionTwo" not found.') |
3345 | 64 | 66 | ||
3346 | 65 | def test_click_disabled_button_by_object_name(self): | 67 | def test_click_disabled_button_by_object_name(self): |
3347 | 66 | self._open_popover() | 68 | self._open_popover() |
3348 | @@ -72,7 +74,7 @@ | |||
3349 | 72 | popover.click_action_button, 'actionDisabled') | 74 | popover.click_action_button, 'actionDisabled') |
3350 | 73 | self.assertEqual( | 75 | self.assertEqual( |
3351 | 74 | str(error), | 76 | str(error), |
3353 | 75 | 'Action with objectName "actionDisabled" not found.') | 77 | 'Button for action with objectName "actionDisabled" not visible.') |
3354 | 76 | 78 | ||
3355 | 77 | def test_click_hidden_button_by_object_name(self): | 79 | def test_click_hidden_button_by_object_name(self): |
3356 | 78 | self._open_popover() | 80 | self._open_popover() |
3357 | @@ -83,7 +85,7 @@ | |||
3358 | 83 | popover.click_action_button, 'actionHidden') | 85 | popover.click_action_button, 'actionHidden') |
3359 | 84 | self.assertEqual( | 86 | self.assertEqual( |
3360 | 85 | str(error), | 87 | str(error), |
3362 | 86 | 'Action with objectName "actionHidden" not found.') | 88 | 'Button for action with objectName "actionHidden" not visible.') |
3363 | 87 | 89 | ||
3364 | 88 | def _open_popover(self): | 90 | def _open_popover(self): |
3365 | 89 | open_button = self.main_view.select_single( | 91 | open_button = self.main_view.select_single( |
3366 | @@ -110,46 +112,12 @@ | |||
3367 | 110 | str(error), 'The popover is not open.') | 112 | str(error), 'The popover is not open.') |
3368 | 111 | 113 | ||
3369 | 112 | 114 | ||
3410 | 113 | class ComposerSheetTestCase(tests.QMLStringAppTestCase): | 115 | class ComposerSheetTestCase(tests.QMLFileAppTestCase): |
3411 | 114 | 116 | ||
3412 | 115 | test_qml = (""" | 117 | path = os.path.abspath(__file__) |
3413 | 116 | import QtQuick 2.0 | 118 | dir_path = os.path.dirname(path) |
3414 | 117 | import Ubuntu.Components 1.0 | 119 | test_qml_file_path = os.path.join( |
3415 | 118 | import Ubuntu.Components.Popups 1.0 | 120 | dir_path, 'test_popups.ComposerSheetTestCase.qml') |
3376 | 119 | |||
3377 | 120 | MainView { | ||
3378 | 121 | width: units.gu(48) | ||
3379 | 122 | height: units.gu(60) | ||
3380 | 123 | objectName: "mainView" | ||
3381 | 124 | |||
3382 | 125 | Button { | ||
3383 | 126 | objectName: "openComposerSheetButton" | ||
3384 | 127 | text: "Open Composer Sheet" | ||
3385 | 128 | onClicked: PopupUtils.open(testComposerSheet); | ||
3386 | 129 | } | ||
3387 | 130 | |||
3388 | 131 | Label { | ||
3389 | 132 | id: "label" | ||
3390 | 133 | objectName: "actionLabel" | ||
3391 | 134 | anchors.centerIn: parent | ||
3392 | 135 | text: "No action taken." | ||
3393 | 136 | } | ||
3394 | 137 | |||
3395 | 138 | Component { | ||
3396 | 139 | id: testComposerSheet | ||
3397 | 140 | ComposerSheet { | ||
3398 | 141 | id: sheet | ||
3399 | 142 | objectName: "testComposerSheet" | ||
3400 | 143 | onCancelClicked: { | ||
3401 | 144 | label.text = "Cancel selected." | ||
3402 | 145 | } | ||
3403 | 146 | onConfirmClicked: { | ||
3404 | 147 | label.text = "Confirm selected." | ||
3405 | 148 | } | ||
3406 | 149 | } | ||
3407 | 150 | } | ||
3408 | 151 | } | ||
3409 | 152 | """) | ||
3416 | 153 | 121 | ||
3417 | 154 | def setUp(self): | 122 | def setUp(self): |
3418 | 155 | super().setUp() | 123 | super().setUp() |
3419 | 156 | 124 | ||
3420 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.QQuickListViewOutOfViewTestCase.qml' | |||
3421 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.QQuickListViewOutOfViewTestCase.qml 1970-01-01 00:00:00 +0000 | |||
3422 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.QQuickListViewOutOfViewTestCase.qml 2016-08-14 09:05:30 +0000 | |||
3423 | @@ -0,0 +1,62 @@ | |||
3424 | 1 | /* | ||
3425 | 2 | * Copyright 2016 Canonical Ltd. | ||
3426 | 3 | * | ||
3427 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3428 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3429 | 6 | * the Free Software Foundation; version 3. | ||
3430 | 7 | * | ||
3431 | 8 | * This program is distributed in the hope that it will be useful, | ||
3432 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3433 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3434 | 11 | * GNU Lesser General Public License for more details. | ||
3435 | 12 | * | ||
3436 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3437 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3438 | 15 | */ | ||
3439 | 16 | |||
3440 | 17 | import QtQuick 2.0 | ||
3441 | 18 | import Ubuntu.Components 1.0 | ||
3442 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
3443 | 20 | |||
3444 | 21 | MainView { | ||
3445 | 22 | width: units.gu(48) | ||
3446 | 23 | height: units.gu(20) | ||
3447 | 24 | objectName: "mainView" | ||
3448 | 25 | |||
3449 | 26 | Page { | ||
3450 | 27 | |||
3451 | 28 | Flickable { | ||
3452 | 29 | |||
3453 | 30 | Column { | ||
3454 | 31 | id: column | ||
3455 | 32 | width: units.gu(48) | ||
3456 | 33 | // The column height is greater than the main view height, so | ||
3457 | 34 | // the bottom of the list is out of view. | ||
3458 | 35 | height: units.gu(40) | ||
3459 | 36 | |||
3460 | 37 | Label { | ||
3461 | 38 | id: clickedLabel | ||
3462 | 39 | objectName: "clickedLabel" | ||
3463 | 40 | text: "No element clicked." | ||
3464 | 41 | } | ||
3465 | 42 | |||
3466 | 43 | ListView { | ||
3467 | 44 | id: testListView | ||
3468 | 45 | objectName: "testListView" | ||
3469 | 46 | anchors.left: parent.left | ||
3470 | 47 | anchors.right: parent.right | ||
3471 | 48 | height: column.height - clickedLabel.paintedHeight | ||
3472 | 49 | clip: true | ||
3473 | 50 | model: 20 | ||
3474 | 51 | |||
3475 | 52 | delegate: ListItem.Standard { | ||
3476 | 53 | objectName: "testListElement%1".arg(index) | ||
3477 | 54 | text: "test list element %1".arg(index) | ||
3478 | 55 | onClicked: clickedLabel.text = objectName | ||
3479 | 56 | height: units.gu(5) | ||
3480 | 57 | } | ||
3481 | 58 | } | ||
3482 | 59 | } | ||
3483 | 60 | } | ||
3484 | 61 | } | ||
3485 | 62 | } | ||
3486 | 0 | 63 | ||
3487 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py' | |||
3488 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py 2016-01-20 17:35:53 +0000 | |||
3489 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py 2016-08-14 09:05:30 +0000 | |||
3490 | @@ -150,57 +150,13 @@ | |||
3491 | 150 | str(error), 'List element with objectName "unexisting" not found.') | 150 | str(error), 'List element with objectName "unexisting" not found.') |
3492 | 151 | 151 | ||
3493 | 152 | 152 | ||
3495 | 153 | class QQuickListViewOutOfViewTestCase(tests.QMLStringAppTestCase): | 153 | class QQuickListViewOutOfViewTestCase(tests.QMLFileAppTestCase): |
3496 | 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.""" |
3497 | 155 | 155 | ||
3546 | 156 | test_qml = (""" | 156 | path = os.path.abspath(__file__) |
3547 | 157 | import QtQuick 2.0 | 157 | dir_path = os.path.dirname(path) |
3548 | 158 | import Ubuntu.Components 1.0 | 158 | test_qml_file_path = os.path.join( |
3549 | 159 | import Ubuntu.Components.ListItems 1.0 as ListItem | 159 | dir_path, 'test_qquicklistview.QQuickListViewOutOfViewTestCase.qml') |
3502 | 160 | |||
3503 | 161 | MainView { | ||
3504 | 162 | width: units.gu(48) | ||
3505 | 163 | height: units.gu(20) | ||
3506 | 164 | objectName: "mainView" | ||
3507 | 165 | |||
3508 | 166 | Page { | ||
3509 | 167 | |||
3510 | 168 | Flickable { | ||
3511 | 169 | |||
3512 | 170 | Column { | ||
3513 | 171 | id: column | ||
3514 | 172 | width: units.gu(48) | ||
3515 | 173 | // The column height is greater than the main view height, so | ||
3516 | 174 | // the bottom of the list is out of view. | ||
3517 | 175 | height: units.gu(40) | ||
3518 | 176 | |||
3519 | 177 | Label { | ||
3520 | 178 | id: clickedLabel | ||
3521 | 179 | objectName: "clickedLabel" | ||
3522 | 180 | text: "No element clicked." | ||
3523 | 181 | } | ||
3524 | 182 | |||
3525 | 183 | ListView { | ||
3526 | 184 | id: testListView | ||
3527 | 185 | objectName: "testListView" | ||
3528 | 186 | anchors.left: parent.left | ||
3529 | 187 | anchors.right: parent.right | ||
3530 | 188 | height: column.height - clickedLabel.paintedHeight | ||
3531 | 189 | clip: true | ||
3532 | 190 | model: 20 | ||
3533 | 191 | |||
3534 | 192 | delegate: ListItem.Standard { | ||
3535 | 193 | objectName: "testListElement%1".arg(index) | ||
3536 | 194 | text: "test list element %1".arg(index) | ||
3537 | 195 | onClicked: clickedLabel.text = objectName | ||
3538 | 196 | height: units.gu(5) | ||
3539 | 197 | } | ||
3540 | 198 | } | ||
3541 | 199 | } | ||
3542 | 200 | } | ||
3543 | 201 | } | ||
3544 | 202 | } | ||
3545 | 203 | """) | ||
3550 | 204 | 160 | ||
3551 | 205 | def setUp(self): | 161 | def setUp(self): |
3552 | 206 | super().setUp() | 162 | super().setUp() |
3553 | 207 | 163 | ||
3554 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.TextAreaTestCase.qml' | |||
3555 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.TextAreaTestCase.qml 1970-01-01 00:00:00 +0000 | |||
3556 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.TextAreaTestCase.qml 2016-08-14 09:05:30 +0000 | |||
3557 | @@ -0,0 +1,30 @@ | |||
3558 | 1 | /* | ||
3559 | 2 | * Copyright 2016 Canonical Ltd. | ||
3560 | 3 | * | ||
3561 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3562 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3563 | 6 | * the Free Software Foundation; version 3. | ||
3564 | 7 | * | ||
3565 | 8 | * This program is distributed in the hope that it will be useful, | ||
3566 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3567 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3568 | 11 | * GNU Lesser General Public License for more details. | ||
3569 | 12 | * | ||
3570 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3571 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3572 | 15 | */ | ||
3573 | 16 | |||
3574 | 17 | import QtQuick 2.0 | ||
3575 | 18 | import Ubuntu.Components 1.0 | ||
3576 | 19 | |||
3577 | 20 | MainView { | ||
3578 | 21 | width: units.gu(48) | ||
3579 | 22 | height: units.gu(60) | ||
3580 | 23 | objectName: "mainView" | ||
3581 | 24 | |||
3582 | 25 | Item { | ||
3583 | 26 | TextArea { | ||
3584 | 27 | objectName: "simple_text_area" | ||
3585 | 28 | } | ||
3586 | 29 | } | ||
3587 | 30 | } | ||
3588 | 0 | 31 | ||
3589 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py' | |||
3590 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2015-06-17 15:06:48 +0000 | |||
3591 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2016-08-14 09:05:30 +0000 | |||
3592 | @@ -14,30 +14,19 @@ | |||
3593 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
3594 | 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/>. |
3595 | 16 | 16 | ||
3596 | 17 | import os | ||
3597 | 17 | from testtools.matchers import GreaterThan | 18 | from testtools.matchers import GreaterThan |
3598 | 18 | 19 | ||
3599 | 19 | import ubuntuuitoolkit | 20 | import ubuntuuitoolkit |
3600 | 20 | from ubuntuuitoolkit import tests | 21 | from ubuntuuitoolkit import tests |
3601 | 21 | 22 | ||
3602 | 22 | 23 | ||
3621 | 23 | class TextAreaTestCase(tests.QMLStringAppTestCase): | 24 | class TextAreaTestCase(tests.QMLFileAppTestCase): |
3622 | 24 | 25 | ||
3623 | 25 | test_qml = (""" | 26 | path = os.path.abspath(__file__) |
3624 | 26 | import QtQuick 2.0 | 27 | dir_path = os.path.dirname(path) |
3625 | 27 | import Ubuntu.Components 1.0 | 28 | test_qml_file_path = os.path.join( |
3626 | 28 | 29 | dir_path, 'test_textarea.TextAreaTestCase.qml') | |
3609 | 29 | MainView { | ||
3610 | 30 | width: units.gu(48) | ||
3611 | 31 | height: units.gu(60) | ||
3612 | 32 | objectName: "mainView" | ||
3613 | 33 | |||
3614 | 34 | Item { | ||
3615 | 35 | TextArea { | ||
3616 | 36 | objectName: "simple_text_area" | ||
3617 | 37 | } | ||
3618 | 38 | } | ||
3619 | 39 | } | ||
3620 | 40 | """) | ||
3627 | 41 | 30 | ||
3628 | 42 | def setUp(self): | 31 | def setUp(self): |
3629 | 43 | super().setUp() | 32 | super().setUp() |
3630 | 44 | 33 | ||
3631 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.ToolbarTestCase.qml' | |||
3632 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.ToolbarTestCase.qml 1970-01-01 00:00:00 +0000 | |||
3633 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.ToolbarTestCase.qml 2016-08-14 09:05:30 +0000 | |||
3634 | @@ -0,0 +1,49 @@ | |||
3635 | 1 | /* | ||
3636 | 2 | * Copyright 2016 Canonical Ltd. | ||
3637 | 3 | * | ||
3638 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3639 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3640 | 6 | * the Free Software Foundation; version 3. | ||
3641 | 7 | * | ||
3642 | 8 | * This program is distributed in the hope that it will be useful, | ||
3643 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3644 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3645 | 11 | * GNU Lesser General Public License for more details. | ||
3646 | 12 | * | ||
3647 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3648 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3649 | 15 | */ | ||
3650 | 16 | |||
3651 | 17 | import QtQuick 2.0 | ||
3652 | 18 | import Ubuntu.Components 1.0 | ||
3653 | 19 | |||
3654 | 20 | MainView { | ||
3655 | 21 | width: units.gu(50) | ||
3656 | 22 | height: units.gu(50) | ||
3657 | 23 | objectName: "mainView" | ||
3658 | 24 | |||
3659 | 25 | // Make sure that for these tests the toolbar starts closed. | ||
3660 | 26 | Component.onCompleted: { | ||
3661 | 27 | __propagated.toolbar.close(); | ||
3662 | 28 | } | ||
3663 | 29 | |||
3664 | 30 | Page { | ||
3665 | 31 | |||
3666 | 32 | Label { | ||
3667 | 33 | id: "label" | ||
3668 | 34 | objectName: "clicked_label" | ||
3669 | 35 | anchors.centerIn: parent | ||
3670 | 36 | text: "Button not clicked." | ||
3671 | 37 | } | ||
3672 | 38 | |||
3673 | 39 | tools: ToolbarItems { | ||
3674 | 40 | ToolbarButton { | ||
3675 | 41 | objectName: "buttonName" | ||
3676 | 42 | action: Action { | ||
3677 | 43 | text: "buttonText" | ||
3678 | 44 | onTriggered: label.text = "Button clicked." | ||
3679 | 45 | } | ||
3680 | 46 | } | ||
3681 | 47 | } | ||
3682 | 48 | } | ||
3683 | 49 | } | ||
3684 | 0 | 50 | ||
3685 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.py' | |||
3686 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.py 2015-04-14 21:02:06 +0000 | |||
3687 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_toolbar.py 2016-08-14 09:05:30 +0000 | |||
3688 | @@ -14,49 +14,19 @@ | |||
3689 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
3690 | 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/>. |
3691 | 16 | 16 | ||
3692 | 17 | import os | ||
3693 | 17 | from unittest import mock | 18 | from unittest import mock |
3694 | 18 | 19 | ||
3695 | 19 | import ubuntuuitoolkit | 20 | import ubuntuuitoolkit |
3696 | 20 | from ubuntuuitoolkit import tests | 21 | from ubuntuuitoolkit import tests |
3697 | 21 | 22 | ||
3698 | 22 | 23 | ||
3736 | 23 | class ToolbarTestCase(tests.QMLStringAppTestCase): | 24 | class ToolbarTestCase(tests.QMLFileAppTestCase): |
3737 | 24 | 25 | ||
3738 | 25 | test_qml = (""" | 26 | path = os.path.abspath(__file__) |
3739 | 26 | import QtQuick 2.0 | 27 | dir_path = os.path.dirname(path) |
3740 | 27 | import Ubuntu.Components 1.0 | 28 | test_qml_file_path = os.path.join( |
3741 | 28 | 29 | dir_path, 'test_toolbar.ToolbarTestCase.qml') | |
3705 | 29 | MainView { | ||
3706 | 30 | width: units.gu(50) | ||
3707 | 31 | height: units.gu(50) | ||
3708 | 32 | objectName: "mainView" | ||
3709 | 33 | |||
3710 | 34 | // Make sure that for these tests the toolbar starts closed. | ||
3711 | 35 | Component.onCompleted: { | ||
3712 | 36 | __propagated.toolbar.close(); | ||
3713 | 37 | } | ||
3714 | 38 | |||
3715 | 39 | Page { | ||
3716 | 40 | |||
3717 | 41 | Label { | ||
3718 | 42 | id: "label" | ||
3719 | 43 | objectName: "clicked_label" | ||
3720 | 44 | anchors.centerIn: parent | ||
3721 | 45 | text: "Button not clicked." | ||
3722 | 46 | } | ||
3723 | 47 | |||
3724 | 48 | tools: ToolbarItems { | ||
3725 | 49 | ToolbarButton { | ||
3726 | 50 | objectName: "buttonName" | ||
3727 | 51 | action: Action { | ||
3728 | 52 | text: "buttonText" | ||
3729 | 53 | onTriggered: label.text = "Button clicked." | ||
3730 | 54 | } | ||
3731 | 55 | } | ||
3732 | 56 | } | ||
3733 | 57 | } | ||
3734 | 58 | } | ||
3735 | 59 | """) | ||
3742 | 60 | 30 | ||
3743 | 61 | def setUp(self): | 31 | def setUp(self): |
3744 | 62 | super().setUp() | 32 | super().setUp() |
3745 | 63 | 33 | ||
3746 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py' | |||
3747 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2015-10-04 13:20:26 +0000 | |||
3748 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2016-08-14 09:05:30 +0000 | |||
3749 | @@ -35,7 +35,6 @@ | |||
3750 | 35 | def setUp(self): | 35 | def setUp(self): |
3751 | 36 | self.test_source_path = self._get_test_source_path() | 36 | self.test_source_path = self._get_test_source_path() |
3752 | 37 | self.test_qml_file_path = self._get_test_qml_file_path() | 37 | self.test_qml_file_path = self._get_test_qml_file_path() |
3753 | 38 | self.desktop_file_path = self._get_desktop_file_path() | ||
3754 | 39 | 38 | ||
3755 | 40 | if self.should_simulate_device(): | 39 | if self.should_simulate_device(): |
3756 | 41 | # Hide the Unity7 launcher because it takes space that might be | 40 | # Hide the Unity7 launcher because it takes space that might be |
3757 | @@ -102,25 +101,6 @@ | |||
3758 | 102 | return '/usr/lib/{}/qt5/examples//ubuntu-ui-toolkit/examples/' \ | 101 | return '/usr/lib/{}/qt5/examples//ubuntu-ui-toolkit/examples/' \ |
3759 | 103 | 'ubuntu-ui-toolkit-gallery'.format(host_multiarch) | 102 | 'ubuntu-ui-toolkit-gallery'.format(host_multiarch) |
3760 | 104 | 103 | ||
3761 | 105 | def _get_desktop_file_path(self): | ||
3762 | 106 | desktop_file_path = os.path.join( | ||
3763 | 107 | self.test_source_path, | ||
3764 | 108 | 'ubuntu-ui-toolkit-gallery.desktop') | ||
3765 | 109 | if self._application_source_exists(): | ||
3766 | 110 | local_desktop_file_dir = ( | ||
3767 | 111 | ubuntuuitoolkit.tests.get_local_desktop_file_directory()) | ||
3768 | 112 | if not os.path.exists(local_desktop_file_dir): | ||
3769 | 113 | os.makedirs(local_desktop_file_dir) | ||
3770 | 114 | local_desktop_file_path = os.path.join( | ||
3771 | 115 | local_desktop_file_dir, 'ubuntu-ui-toolkit-gallery.desktop') | ||
3772 | 116 | shutil.copy(desktop_file_path, local_desktop_file_path) | ||
3773 | 117 | # We can't delete the desktop file before we close the application, | ||
3774 | 118 | # so we save it on an attribute to be deleted on tear down. | ||
3775 | 119 | self.local_desktop_file_path = local_desktop_file_path | ||
3776 | 120 | return local_desktop_file_path | ||
3777 | 121 | else: | ||
3778 | 122 | return desktop_file_path | ||
3779 | 123 | |||
3780 | 124 | def open_page(self, page): | 104 | def open_page(self, page): |
3781 | 125 | """Open a page of the widget gallery. | 105 | """Open a page of the widget gallery. |
3782 | 126 | 106 | ||
3783 | 127 | 107 | ||
3784 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py' | |||
3785 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2015-04-14 21:02:06 +0000 | |||
3786 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2016-08-14 09:05:30 +0000 | |||
3787 | @@ -37,7 +37,8 @@ | |||
3788 | 37 | self.assertEqual( | 37 | self.assertEqual( |
3789 | 38 | collapsed_option_selector.get_selected_text(), 'Value 1') | 38 | collapsed_option_selector.get_selected_text(), 'Value 1') |
3790 | 39 | 39 | ||
3792 | 40 | collapsed_option_selector.select_option('Label', text='Value 4') | 40 | collapsed_option_selector.select_option( |
3793 | 41 | 'UCLabel', text='Once upon a time there was a story nobody told.') | ||
3794 | 41 | self.assertEqual(collapsed_option_selector.get_selected_index(), 3) | 42 | self.assertEqual(collapsed_option_selector.get_selected_index(), 3) |
3795 | 42 | 43 | ||
3796 | 43 | def test_select_option_from_expanded_optionselector(self): | 44 | def test_select_option_from_expanded_optionselector(self): |
3797 | @@ -48,7 +49,8 @@ | |||
3798 | 48 | self.assertEqual( | 49 | self.assertEqual( |
3799 | 49 | expanded_option_selector.get_selected_text(), 'Value 1') | 50 | expanded_option_selector.get_selected_text(), 'Value 1') |
3800 | 50 | 51 | ||
3802 | 51 | expanded_option_selector.select_option('Label', text='Value 4') | 52 | expanded_option_selector.select_option( |
3803 | 53 | 'UCLabel', text='Once upon a time there was a story nobody told.') | ||
3804 | 52 | self.assertEqual(expanded_option_selector.get_selected_index(), 3) | 54 | self.assertEqual(expanded_option_selector.get_selected_index(), 3) |
3805 | 53 | 55 | ||
3806 | 54 | def test_select_option_from_optionselector_with_custom_model(self): | 56 | def test_select_option_from_optionselector_with_custom_model(self): |
3807 | @@ -61,6 +63,6 @@ | |||
3808 | 61 | option_selector_with_custom_model.get_selected_index(), 0) | 63 | option_selector_with_custom_model.get_selected_index(), 0) |
3809 | 62 | 64 | ||
3810 | 63 | option_selector_with_custom_model.select_option( | 65 | option_selector_with_custom_model.select_option( |
3812 | 64 | 'Label', text='Name 4') | 66 | 'UCLabel', text='Name 4') |
3813 | 65 | self.assertEqual( | 67 | self.assertEqual( |
3814 | 66 | option_selector_with_custom_model.get_selected_index(), 3) | 68 | option_selector_with_custom_model.get_selected_index(), 3) |
3815 | 67 | 69 | ||
3816 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py' | |||
3817 | --- tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py 2015-04-14 21:02:06 +0000 | |||
3818 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py 2016-08-14 09:05:30 +0000 | |||
3819 | @@ -37,6 +37,18 @@ | |||
3820 | 37 | self.assertThat(textfield.text, Eventually(Equals("Yes"))) | 37 | self.assertThat(textfield.text, Eventually(Equals("Yes"))) |
3821 | 38 | 38 | ||
3822 | 39 | 39 | ||
3823 | 40 | class LauncherWindowTestCase(tests.QMLFileAppTestCase): | ||
3824 | 41 | path = os.path.abspath(__file__) | ||
3825 | 42 | dir_path = os.path.dirname(path) | ||
3826 | 43 | test_qml_file_path = os.path.join( | ||
3827 | 44 | dir_path, 'test_launcher.window.qml') | ||
3828 | 45 | |||
3829 | 46 | def test_window_root_item(self): | ||
3830 | 47 | label = self.main_view.select_single(objectName="label") | ||
3831 | 48 | self.assertThat(label.text, | ||
3832 | 49 | Eventually(Equals("Lorem ipsum dolor sit amet"))) | ||
3833 | 50 | |||
3834 | 51 | |||
3835 | 40 | class LauncherQtTestTestCase(tests.QMLFileAppTestCase): | 52 | class LauncherQtTestTestCase(tests.QMLFileAppTestCase): |
3836 | 41 | path = os.path.abspath(__file__) | 53 | path = os.path.abspath(__file__) |
3837 | 42 | dir_path = os.path.dirname(path) | 54 | dir_path = os.path.dirname(path) |
3838 | 43 | 55 | ||
3839 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_launcher.testcase.qml' | |||
3840 | --- tests/autopilot/ubuntuuitoolkit/tests/test_launcher.testcase.qml 2015-03-03 13:20:06 +0000 | |||
3841 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_launcher.testcase.qml 2016-08-14 09:05:30 +0000 | |||
3842 | @@ -17,7 +17,7 @@ | |||
3843 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
3844 | 18 | import QtTest 1.0 | 18 | import QtTest 1.0 |
3845 | 19 | import Ubuntu.Components 1.1 | 19 | import Ubuntu.Components 1.1 |
3847 | 20 | import Ubuntu.Test 1.0 | 20 | import Ubuntu.Test 1.0 // UbuntuTestCase |
3848 | 21 | 21 | ||
3849 | 22 | MainView { | 22 | MainView { |
3850 | 23 | width: units.gu(48) | 23 | width: units.gu(48) |
3851 | 24 | 24 | ||
3852 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml' | |||
3853 | --- tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml 1970-01-01 00:00:00 +0000 | |||
3854 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml 2016-08-14 09:05:30 +0000 | |||
3855 | @@ -0,0 +1,43 @@ | |||
3856 | 1 | /* | ||
3857 | 2 | * Copyright 2014-2016 Canonical Ltd. | ||
3858 | 3 | * | ||
3859 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3860 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3861 | 6 | * the Free Software Foundation; version 3. | ||
3862 | 7 | * | ||
3863 | 8 | * This program is distributed in the hope that it will be useful, | ||
3864 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3865 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3866 | 11 | * GNU Lesser General Public License for more details. | ||
3867 | 12 | * | ||
3868 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3869 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3870 | 15 | */ | ||
3871 | 16 | |||
3872 | 17 | import QtQuick 2.4 | ||
3873 | 18 | import QtQuick.Window 2.2 // Not Ubuntu.Test | ||
3874 | 19 | import Ubuntu.Components 1.3 | ||
3875 | 20 | |||
3876 | 21 | Window { | ||
3877 | 22 | title: "Hello World" | ||
3878 | 23 | minimumWidth: units.gu(30) | ||
3879 | 24 | minimumHeight: units.gu(50) | ||
3880 | 25 | maximumWidth: units.gu(90) | ||
3881 | 26 | maximumHeight: units.gu(120) | ||
3882 | 27 | MainView { | ||
3883 | 28 | objectName: "mainView" | ||
3884 | 29 | |||
3885 | 30 | Page { | ||
3886 | 31 | title: "Launcher/Window" | ||
3887 | 32 | |||
3888 | 33 | Column { | ||
3889 | 34 | Label { | ||
3890 | 35 | objectName: "label" | ||
3891 | 36 | text: "Lorem ipsum dolor sit amet" | ||
3892 | 37 | width: units.gu(25) | ||
3893 | 38 | height: units.gu(25) | ||
3894 | 39 | } | ||
3895 | 40 | } | ||
3896 | 41 | } | ||
3897 | 42 | } | ||
3898 | 43 | } | ||
3899 | 0 | 44 | ||
3900 | === removed file 'tests/unit/README' | |||
3901 | --- tests/unit/README 2013-06-26 22:44:07 +0000 | |||
3902 | +++ tests/unit/README 1970-01-01 00:00:00 +0000 | |||
3903 | @@ -1,4 +0,0 @@ | |||
3904 | 1 | == How to execute a single qml test == | ||
3905 | 2 | |||
3906 | 3 | When current path is tests/unit/tst_components: | ||
3907 | 4 | QML2_IMPORT_PATH=../../../modules:$QML2_IMPORT_PATH UBUNTU_UI_TOOLKIT_THEMES_PATH=../../../modules qmltestrunner -input tst_yourtest.qml -import "../../../modules" | ||
3908 | 5 | 0 | ||
3909 | === added file 'tests/unit/bottomedge/ExternalContent.qml' | |||
3910 | --- tests/unit/bottomedge/ExternalContent.qml 1970-01-01 00:00:00 +0000 | |||
3911 | +++ tests/unit/bottomedge/ExternalContent.qml 2016-08-14 09:05:30 +0000 | |||
3912 | @@ -0,0 +1,27 @@ | |||
3913 | 1 | /* | ||
3914 | 2 | * Copyright 2016 Canonical Ltd. | ||
3915 | 3 | * | ||
3916 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3917 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3918 | 6 | * the Free Software Foundation; version 3. | ||
3919 | 7 | * | ||
3920 | 8 | * This program is distributed in the hope that it will be useful, | ||
3921 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3922 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3923 | 11 | * GNU Lesser General Public License for more details. | ||
3924 | 12 | * | ||
3925 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3926 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3927 | 15 | * | ||
3928 | 16 | */ | ||
3929 | 17 | |||
3930 | 18 | import QtQuick 2.4 | ||
3931 | 19 | import Ubuntu.Components 1.3 | ||
3932 | 20 | |||
3933 | 21 | Rectangle { | ||
3934 | 22 | objectName: "external" | ||
3935 | 23 | width: parent ? parent.width : 0 | ||
3936 | 24 | height: parent ? parent.height : 0 | ||
3937 | 25 | color: UbuntuColors.silk | ||
3938 | 26 | } | ||
3939 | 27 | |||
3940 | 0 | 28 | ||
3941 | === added file 'tests/unit/bottomedge/PreloadContentUrl.qml' | |||
3942 | --- tests/unit/bottomedge/PreloadContentUrl.qml 1970-01-01 00:00:00 +0000 | |||
3943 | +++ tests/unit/bottomedge/PreloadContentUrl.qml 2016-08-14 09:05:30 +0000 | |||
3944 | @@ -0,0 +1,35 @@ | |||
3945 | 1 | /* | ||
3946 | 2 | * Copyright 2016 Canonical Ltd. | ||
3947 | 3 | * | ||
3948 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3949 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3950 | 6 | * the Free Software Foundation; version 3. | ||
3951 | 7 | * | ||
3952 | 8 | * This program is distributed in the hope that it will be useful, | ||
3953 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3954 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3955 | 11 | * GNU Lesser General Public License for more details. | ||
3956 | 12 | * | ||
3957 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3958 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3959 | 15 | * | ||
3960 | 16 | */ | ||
3961 | 17 | |||
3962 | 18 | import QtQuick 2.4 | ||
3963 | 19 | import Ubuntu.Components 1.3 | ||
3964 | 20 | |||
3965 | 21 | Item { | ||
3966 | 22 | id: holder | ||
3967 | 23 | width: units.gu(40) | ||
3968 | 24 | height: units.gu(71) | ||
3969 | 25 | |||
3970 | 26 | BottomEdge { | ||
3971 | 27 | id: bottomEdge | ||
3972 | 28 | height: parent.height | ||
3973 | 29 | hint.text: "Test" | ||
3974 | 30 | objectName: "testItem" | ||
3975 | 31 | preloadContent: true | ||
3976 | 32 | contentUrl: Qt.resolvedUrl("ExternalContent.qml") | ||
3977 | 33 | } | ||
3978 | 34 | } | ||
3979 | 35 | |||
3980 | 0 | 36 | ||
3981 | === modified file 'tests/unit/bottomedge/bottomedge.pro' | |||
3982 | --- tests/unit/bottomedge/bottomedge.pro 2016-05-31 09:02:35 +0000 | |||
3983 | +++ tests/unit/bottomedge/bottomedge.pro 2016-08-14 09:05:30 +0000 | |||
3984 | @@ -24,4 +24,6 @@ | |||
3985 | 24 | UncoveredByRegion.qml \ | 24 | UncoveredByRegion.qml \ |
3986 | 25 | OverriddenHintTrigger.qml \ | 25 | OverriddenHintTrigger.qml \ |
3987 | 26 | PreloadedContent.qml \ | 26 | PreloadedContent.qml \ |
3989 | 27 | BottomEdgeWithAction.qml | 27 | BottomEdgeWithAction.qml \ |
3990 | 28 | PreloadContentUrl.qml \ | ||
3991 | 29 | ExternalContent.qml | ||
3992 | 28 | 30 | ||
3993 | === modified file 'tests/unit/bottomedge/tst_bottomedge.cpp' | |||
3994 | --- tests/unit/bottomedge/tst_bottomedge.cpp 2016-07-25 23:24:46 +0000 | |||
3995 | +++ tests/unit/bottomedge/tst_bottomedge.cpp 2016-08-14 09:05:30 +0000 | |||
3996 | @@ -941,6 +941,16 @@ | |||
3997 | 941 | QCOMPARE(regionObjects[i++], QString("default")); | 941 | QCOMPARE(regionObjects[i++], QString("default")); |
3998 | 942 | } | 942 | } |
3999 | 943 | 943 | ||
4000 | 944 | void test_preload_content_url() | ||
4001 | 945 | { | ||
4002 | 946 | QScopedPointer<BottomEdgeTestCase> test(new BottomEdgeTestCase("PreloadContentUrl.qml")); | ||
4003 | 947 | UCBottomEdge *bottomEdge = test->testItem(); | ||
4004 | 948 | |||
4005 | 949 | // commit so the contentItem is set | ||
4006 | 950 | bottomEdge->commit(); | ||
4007 | 951 | QTRY_VERIFY(bottomEdge->contentItem()); | ||
4008 | 952 | } | ||
4009 | 953 | |||
4010 | 944 | void test_reset_preload_content() | 954 | void test_reset_preload_content() |
4011 | 945 | { | 955 | { |
4012 | 946 | QScopedPointer<BottomEdgeTestCase> test(new BottomEdgeTestCase("PreloadedContent.qml")); | 956 | QScopedPointer<BottomEdgeTestCase> test(new BottomEdgeTestCase("PreloadedContent.qml")); |
4013 | 947 | 957 | ||
4014 | === added file 'tests/unit/subtheming/GroupPropertyValueHints.qml' | |||
4015 | --- tests/unit/subtheming/GroupPropertyValueHints.qml 1970-01-01 00:00:00 +0000 | |||
4016 | +++ tests/unit/subtheming/GroupPropertyValueHints.qml 2016-08-14 09:05:30 +0000 | |||
4017 | @@ -0,0 +1,33 @@ | |||
4018 | 1 | /* | ||
4019 | 2 | * Copyright 2016 Canonical Ltd. | ||
4020 | 3 | * | ||
4021 | 4 | * This program is free software; you can redistribute it and/or modify | ||
4022 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
4023 | 6 | * the Free Software Foundation; version 3. | ||
4024 | 7 | * | ||
4025 | 8 | * This program is distributed in the hope that it will be useful, | ||
4026 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4027 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4028 | 11 | * GNU Lesser General Public License for more details. | ||
4029 | 12 | * | ||
4030 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4031 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4032 | 15 | */ | ||
4033 | 16 | |||
4034 | 17 | import QtQuick 2.4 | ||
4035 | 18 | import Ubuntu.Components 1.3 | ||
4036 | 19 | |||
4037 | 20 | Item { | ||
4038 | 21 | width: units.gu(40) | ||
4039 | 22 | height: units.gu(71) | ||
4040 | 23 | |||
4041 | 24 | HintedButton { | ||
4042 | 25 | objectName: "Button" | ||
4043 | 26 | id: button | ||
4044 | 27 | gradient: UbuntuColors.greyGradient | ||
4045 | 28 | StyleHints { | ||
4046 | 29 | ignoreUnknownProperties: false | ||
4047 | 30 | gradientProxy.topColor: "orange" | ||
4048 | 31 | } | ||
4049 | 32 | } | ||
4050 | 33 | } | ||
4051 | 0 | 34 | ||
4052 | === added file 'tests/unit/subtheming/StyleHintsInvalidGroupedProperty.qml' | |||
4053 | --- tests/unit/subtheming/StyleHintsInvalidGroupedProperty.qml 1970-01-01 00:00:00 +0000 | |||
4054 | +++ tests/unit/subtheming/StyleHintsInvalidGroupedProperty.qml 2016-08-14 09:05:30 +0000 | |||
4055 | @@ -0,0 +1,30 @@ | |||
4056 | 1 | /* | ||
4057 | 2 | * Copyright 2016 Canonical Ltd. | ||
4058 | 3 | * | ||
4059 | 4 | * This program is free software; you can redistribute it and/or modify | ||
4060 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
4061 | 6 | * the Free Software Foundation; version 3. | ||
4062 | 7 | * | ||
4063 | 8 | * This program is distributed in the hope that it will be useful, | ||
4064 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4065 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4066 | 11 | * GNU Lesser General Public License for more details. | ||
4067 | 12 | * | ||
4068 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4069 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4070 | 15 | */ | ||
4071 | 16 | |||
4072 | 17 | import QtQuick 2.4 | ||
4073 | 18 | import Ubuntu.Components 1.3 | ||
4074 | 19 | |||
4075 | 20 | Item { | ||
4076 | 21 | width: units.gu(40) | ||
4077 | 22 | height: units.gu(71) | ||
4078 | 23 | |||
4079 | 24 | Button { | ||
4080 | 25 | StyleHints { | ||
4081 | 26 | ignoreUnknownProperties: false | ||
4082 | 27 | gradientProxy.invalidProperty: 10 | ||
4083 | 28 | } | ||
4084 | 29 | } | ||
4085 | 30 | } | ||
4086 | 0 | 31 | ||
4087 | === modified file 'tests/unit/subtheming/subtheming.pro' | |||
4088 | --- tests/unit/subtheming/subtheming.pro 2016-05-31 09:02:35 +0000 | |||
4089 | +++ tests/unit/subtheming/subtheming.pro 2016-08-14 09:05:30 +0000 | |||
4090 | @@ -37,9 +37,11 @@ | |||
4091 | 37 | StyleHintsWithObject.qml \ | 37 | StyleHintsWithObject.qml \ |
4092 | 38 | StyleHintsElsewhere.qml \ | 38 | StyleHintsElsewhere.qml \ |
4093 | 39 | StyleHintsInvalidProperty.qml \ | 39 | StyleHintsInvalidProperty.qml \ |
4094 | 40 | StyleHintsInvalidGroupedProperty.qml \ | ||
4095 | 40 | PropertyBindingHints.qml \ | 41 | PropertyBindingHints.qml \ |
4096 | 41 | MoreStyleHints.qml \ | 42 | MoreStyleHints.qml \ |
4097 | 42 | GroupPropertyBindingHints.qml \ | 43 | GroupPropertyBindingHints.qml \ |
4098 | 44 | GroupPropertyValueHints.qml \ | ||
4099 | 43 | OverrideStyleHints.qml \ | 45 | OverrideStyleHints.qml \ |
4100 | 44 | HintedButton.qml \ | 46 | HintedButton.qml \ |
4101 | 45 | OtherVersion.qml \ | 47 | OtherVersion.qml \ |
4102 | 46 | 48 | ||
4103 | === modified file 'tests/unit/subtheming/tst_subtheming.cpp' | |||
4104 | --- tests/unit/subtheming/tst_subtheming.cpp 2016-07-25 23:24:46 +0000 | |||
4105 | +++ tests/unit/subtheming/tst_subtheming.cpp 2016-08-14 09:05:30 +0000 | |||
4106 | @@ -831,6 +831,9 @@ | |||
4107 | 831 | << "StyleHintsElsewhere.qml" << 24 << 5 << "QML StyleHints: StyleHints must be declared in a StyledItem or a derivate of it."; | 831 | << "StyleHintsElsewhere.qml" << 24 << 5 << "QML StyleHints: StyleHints must be declared in a StyledItem or a derivate of it."; |
4108 | 832 | QTest::newRow("Invalid property") | 832 | QTest::newRow("Invalid property") |
4109 | 833 | << "StyleHintsInvalidProperty.qml" << 25 << 9 << "QML StyleHints: Style 'ButtonStyle' has no property called 'invalidProperty'."; | 833 | << "StyleHintsInvalidProperty.qml" << 25 << 9 << "QML StyleHints: Style 'ButtonStyle' has no property called 'invalidProperty'."; |
4110 | 834 | QTest::newRow("Invalid grouped property") | ||
4111 | 835 | << "StyleHintsInvalidGroupedProperty.qml" << 25 << 9 << "QML StyleHints: Style 'ButtonStyle' has no property called 'gradientProxy.invalidProperty'."; | ||
4112 | 836 | |||
4113 | 834 | } | 837 | } |
4114 | 835 | void test_stylehints_errors() | 838 | void test_stylehints_errors() |
4115 | 836 | { | 839 | { |
4116 | @@ -881,8 +884,11 @@ | |||
4117 | 881 | 884 | ||
4118 | 882 | QTest::newRow("Same document") | 885 | QTest::newRow("Same document") |
4119 | 883 | << "MoreStyleHints.qml" << "defaultColor" << QColor("brown") << QColor("brown") << "minimumWidth" << units.gu(20); | 886 | << "MoreStyleHints.qml" << "defaultColor" << QColor("brown") << QColor("brown") << "minimumWidth" << units.gu(20); |
4121 | 884 | QTest::newRow("Different document") | 887 | QTest::newRow("Different document, binding") |
4122 | 885 | << "GroupPropertyBindingHints.qml" << "gradientProxy.topColor" << QColor("blue") << QColor("tan") << "minimumWidth" << units.gu(20); | 888 | << "GroupPropertyBindingHints.qml" << "gradientProxy.topColor" << QColor("blue") << QColor("tan") << "minimumWidth" << units.gu(20); |
4123 | 889 | // regression test for bug #1602836. | ||
4124 | 890 | QTest::newRow("Different document, value") | ||
4125 | 891 | << "GroupPropertyValueHints.qml" << "gradientProxy.topColor" << QColor("orange") << QColor("orange") << "minimumWidth" << units.gu(20); | ||
4126 | 886 | } | 892 | } |
4127 | 887 | void test_stylehints_multiple() | 893 | void test_stylehints_multiple() |
4128 | 888 | { | 894 | { |
4129 | 889 | 895 | ||
4130 | === modified file 'tests/unit/units/dpr1/tst_units.cpp' | |||
4131 | --- tests/unit/units/dpr1/tst_units.cpp 2016-07-07 15:33:34 +0000 | |||
4132 | +++ tests/unit/units/dpr1/tst_units.cpp 2016-08-14 09:05:30 +0000 | |||
4133 | @@ -28,7 +28,7 @@ | |||
4134 | 28 | private Q_SLOTS: | 28 | private Q_SLOTS: |
4135 | 29 | 29 | ||
4136 | 30 | void defaultGridUnit() { | 30 | void defaultGridUnit() { |
4138 | 31 | qputenv("GRID_UNIT_PX", ""); | 31 | qunsetenv("GRID_UNIT_PX"); |
4139 | 32 | UCUnits units; | 32 | UCUnits units; |
4140 | 33 | QCOMPARE(units.gridUnit(), 8.0f); | 33 | QCOMPARE(units.gridUnit(), 8.0f); |
4141 | 34 | } | 34 | } |
4142 | @@ -46,7 +46,7 @@ | |||
4143 | 46 | qputenv("GRID_UNIT_PX", gridUnit); | 46 | qputenv("GRID_UNIT_PX", gridUnit); |
4144 | 47 | UCUnits units; | 47 | UCUnits units; |
4145 | 48 | QCOMPARE(units.gridUnit(), 11.0); | 48 | QCOMPARE(units.gridUnit(), 11.0); |
4147 | 49 | qputenv("GRID_UNIT_PX", ""); | 49 | qunsetenv("GRID_UNIT_PX"); |
4148 | 50 | } | 50 | } |
4149 | 51 | 51 | ||
4150 | 52 | void dpGridUnitDefault() { | 52 | void dpGridUnitDefault() { |
4151 | 53 | 53 | ||
4152 | === modified file 'tests/unit/units/dpr2/tst_units_dpr2.cpp' | |||
4153 | --- tests/unit/units/dpr2/tst_units_dpr2.cpp 2016-07-07 15:33:34 +0000 | |||
4154 | +++ tests/unit/units/dpr2/tst_units_dpr2.cpp 2016-08-14 09:05:30 +0000 | |||
4155 | @@ -135,6 +135,8 @@ | |||
4156 | 135 | int main(int argc, char *argv[]) | 135 | int main(int argc, char *argv[]) |
4157 | 136 | { | 136 | { |
4158 | 137 | qputenv("QT_DEVICE_PIXEL_RATIO", "2"); | 137 | qputenv("QT_DEVICE_PIXEL_RATIO", "2"); |
4159 | 138 | qputenv("QT_SCALE_FACTOR", "2"); | ||
4160 | 139 | qunsetenv("GRID_UNIT_PX"); | ||
4161 | 138 | 140 | ||
4162 | 139 | QGuiApplication app(argc, argv); | 141 | QGuiApplication app(argc, argv); |
4163 | 140 | app.setAttribute(Qt::AA_Use96Dpi, true); | 142 | app.setAttribute(Qt::AA_Use96Dpi, true); |
4164 | 141 | 143 | ||
4165 | === modified file 'tests/unit/units/dpr3/tst_units_dpr3.cpp' | |||
4166 | --- tests/unit/units/dpr3/tst_units_dpr3.cpp 2016-07-07 15:33:34 +0000 | |||
4167 | +++ tests/unit/units/dpr3/tst_units_dpr3.cpp 2016-08-14 09:05:30 +0000 | |||
4168 | @@ -80,6 +80,8 @@ | |||
4169 | 80 | int main(int argc, char *argv[]) | 80 | int main(int argc, char *argv[]) |
4170 | 81 | { | 81 | { |
4171 | 82 | qputenv("QT_DEVICE_PIXEL_RATIO", "3"); | 82 | qputenv("QT_DEVICE_PIXEL_RATIO", "3"); |
4172 | 83 | qputenv("QT_SCALE_FACTOR", "3"); | ||
4173 | 84 | qunsetenv("GRID_UNIT_PX"); | ||
4174 | 83 | 85 | ||
4175 | 84 | QGuiApplication app(argc, argv); | 86 | QGuiApplication app(argc, argv); |
4176 | 85 | app.setAttribute(Qt::AA_Use96Dpi, true); | 87 | app.setAttribute(Qt::AA_Use96Dpi, true); |
4177 | 86 | 88 | ||
4178 | === modified file 'tests/unit/visual/tst_actionbar.13.qml' | |||
4179 | --- tests/unit/visual/tst_actionbar.13.qml 2016-06-15 13:46:51 +0000 | |||
4180 | +++ tests/unit/visual/tst_actionbar.13.qml 2016-08-14 09:05:30 +0000 | |||
4181 | @@ -1,5 +1,5 @@ | |||
4182 | 1 | /* | 1 | /* |
4184 | 2 | * Copyright 2015 Canonical Ltd. | 2 | * Copyright 2016 Canonical Ltd. |
4185 | 3 | * | 3 | * |
4186 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
4187 | 5 | * it under the terms of the GNU Lesser General Public License as published by | 5 | * it under the terms of the GNU Lesser General Public License as published by |
4188 | @@ -15,38 +15,71 @@ | |||
4189 | 15 | */ | 15 | */ |
4190 | 16 | 16 | ||
4191 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
4192 | 18 | import QtQuick.Layouts 1.1 | ||
4193 | 18 | import Ubuntu.Test 1.0 | 19 | import Ubuntu.Test 1.0 |
4194 | 19 | import Ubuntu.Components 1.3 | 20 | import Ubuntu.Components 1.3 |
4195 | 20 | 21 | ||
4196 | 21 | Item { | 22 | Item { |
4197 | 22 | id: root | 23 | id: root |
4200 | 23 | width: 400 | 24 | width: units.gu(50) |
4201 | 24 | height: 600 | 25 | height: units.gu(60) |
4202 | 25 | 26 | ||
4203 | 26 | property list<Action> actionList: [ | 27 | property list<Action> actionList: [ |
4204 | 27 | Action { | 28 | Action { |
4205 | 28 | iconName: "alarm-clock" | 29 | iconName: "alarm-clock" |
4206 | 29 | text: "Tick tock" | 30 | text: "Tick tock" |
4207 | 31 | onTriggered: print("tock") | ||
4208 | 30 | }, | 32 | }, |
4209 | 31 | Action { | 33 | Action { |
4210 | 32 | iconName: "appointment" | 34 | iconName: "appointment" |
4211 | 33 | text: "Date" | 35 | text: "Date" |
4212 | 36 | onTriggered: print("date") | ||
4213 | 34 | }, | 37 | }, |
4214 | 35 | Action { | 38 | Action { |
4215 | 36 | iconName: "attachment" | 39 | iconName: "attachment" |
4216 | 37 | text: "Attach" | 40 | text: "Attach" |
4217 | 41 | onTriggered: print("attach") | ||
4218 | 38 | }, | 42 | }, |
4219 | 39 | Action { | 43 | Action { |
4220 | 40 | iconName: "contact" | 44 | iconName: "contact" |
4221 | 41 | text: "Contact" | 45 | text: "Contact" |
4222 | 46 | onTriggered: print("contact") | ||
4223 | 42 | }, | 47 | }, |
4224 | 43 | Action { | 48 | Action { |
4225 | 44 | iconName: "like" | 49 | iconName: "like" |
4226 | 45 | text: "Like" | 50 | text: "Like" |
4227 | 51 | onTriggered: print("+1") | ||
4228 | 46 | }, | 52 | }, |
4229 | 47 | Action { | 53 | Action { |
4230 | 48 | iconName: "lock" | 54 | iconName: "lock" |
4231 | 49 | text: "Lock" | 55 | text: "Lock" |
4232 | 56 | onTriggered: print("lock") | ||
4233 | 57 | }, | ||
4234 | 58 | Action { | ||
4235 | 59 | iconName: "camcorder" | ||
4236 | 60 | text: "Camera" | ||
4237 | 61 | onTriggered: print("cam") | ||
4238 | 62 | }, | ||
4239 | 63 | Action { | ||
4240 | 64 | iconName: "location" | ||
4241 | 65 | text: "Location" | ||
4242 | 66 | onTriggered: print("loc") | ||
4243 | 67 | enabled: false | ||
4244 | 68 | }, | ||
4245 | 69 | Action { | ||
4246 | 70 | iconName: "message" | ||
4247 | 71 | text: "Message" | ||
4248 | 72 | onTriggered: print("msg") | ||
4249 | 73 | }, | ||
4250 | 74 | Action { | ||
4251 | 75 | iconName: "livetv" | ||
4252 | 76 | text: "Television" | ||
4253 | 77 | onTriggered: print("tv") | ||
4254 | 78 | }, | ||
4255 | 79 | Action { | ||
4256 | 80 | iconName: "lock-broken" | ||
4257 | 81 | text: "Unlock" | ||
4258 | 82 | onTriggered: print("unlock") | ||
4259 | 50 | } | 83 | } |
4260 | 51 | ] | 84 | ] |
4261 | 52 | 85 | ||
4262 | @@ -54,10 +87,12 @@ | |||
4263 | 54 | Action { | 87 | Action { |
4264 | 55 | iconName: "share" | 88 | iconName: "share" |
4265 | 56 | text: "Share" | 89 | text: "Share" |
4266 | 90 | onTriggered: print("share") | ||
4267 | 57 | }, | 91 | }, |
4268 | 58 | Action { | 92 | Action { |
4269 | 59 | iconName: "starred" | 93 | iconName: "starred" |
4270 | 60 | text: "Favorite" | 94 | text: "Favorite" |
4271 | 95 | onTriggered: print("fav") | ||
4272 | 61 | } | 96 | } |
4273 | 62 | ] | 97 | ] |
4274 | 63 | 98 | ||
4275 | @@ -70,13 +105,12 @@ | |||
4276 | 70 | } | 105 | } |
4277 | 71 | height: childrenRect.height | 106 | height: childrenRect.height |
4278 | 72 | 107 | ||
4280 | 73 | Item { | 108 | RowLayout { |
4281 | 74 | width: parent.width | 109 | width: parent.width |
4282 | 75 | height: childrenRect.height | 110 | height: childrenRect.height |
4283 | 76 | 111 | ||
4284 | 77 | Label { | 112 | Label { |
4285 | 78 | anchors { | 113 | anchors { |
4286 | 79 | left: parent.left | ||
4287 | 80 | verticalCenter: shortBar.verticalCenter | 114 | verticalCenter: shortBar.verticalCenter |
4288 | 81 | } | 115 | } |
4289 | 82 | text: "" + shortBar.numberOfSlots + " slot(s):" | 116 | text: "" + shortBar.numberOfSlots + " slot(s):" |
4290 | @@ -85,18 +119,17 @@ | |||
4291 | 85 | ActionBar { | 119 | ActionBar { |
4292 | 86 | // no numberOfSlots specified. Using default value. | 120 | // no numberOfSlots specified. Using default value. |
4293 | 87 | id: shortBar | 121 | id: shortBar |
4295 | 88 | anchors.right: parent.right | 122 | Layout.fillWidth: true |
4296 | 89 | actions: root.shortActionList | 123 | actions: root.shortActionList |
4297 | 90 | } | 124 | } |
4298 | 91 | } | 125 | } |
4299 | 92 | 126 | ||
4301 | 93 | Item { | 127 | RowLayout { |
4302 | 94 | width: parent.width | 128 | width: parent.width |
4303 | 95 | height: childrenRect.height | 129 | height: childrenRect.height |
4304 | 96 | 130 | ||
4305 | 97 | Label { | 131 | Label { |
4306 | 98 | anchors { | 132 | anchors { |
4307 | 99 | left: parent.left | ||
4308 | 100 | verticalCenter: bar.verticalCenter | 133 | verticalCenter: bar.verticalCenter |
4309 | 101 | } | 134 | } |
4310 | 102 | text: "" + bar.numberOfSlots + " slot(s):" | 135 | text: "" + bar.numberOfSlots + " slot(s):" |
4311 | @@ -104,9 +137,36 @@ | |||
4312 | 104 | 137 | ||
4313 | 105 | ActionBar { | 138 | ActionBar { |
4314 | 106 | id: bar | 139 | id: bar |
4318 | 107 | anchors.right: parent.right | 140 | Layout.fillWidth: true |
4319 | 108 | numberOfSlots: numberOfActionsSlider.value.toFixed(0) | 141 | numberOfSlots: numberOfActionsSlider.value.toFixed(0) |
4320 | 109 | actions: root.actionList | 142 | actions: root.actionList |
4321 | 143 | } | ||
4322 | 144 | } | ||
4323 | 145 | |||
4324 | 146 | RowLayout { | ||
4325 | 147 | width: parent.width | ||
4326 | 148 | height: childrenRect.height | ||
4327 | 149 | Label { | ||
4328 | 150 | anchors { | ||
4329 | 151 | verticalCenter: coloredBar.verticalCenter | ||
4330 | 152 | } | ||
4331 | 153 | text: "colored:" | ||
4332 | 154 | } | ||
4333 | 155 | ActionBar { | ||
4334 | 156 | id: coloredBar | ||
4335 | 157 | Layout.fillWidth: true | ||
4336 | 158 | numberOfSlots: numberOfActionsSlider.value.toFixed(0) | ||
4337 | 159 | actions: root.actionList | ||
4338 | 160 | StyleHints { | ||
4339 | 161 | ignoreUnknownProperties: false | ||
4340 | 162 | backgroundColor: UbuntuColors.blue | ||
4341 | 163 | buttons { | ||
4342 | 164 | foregroundColor: "white" | ||
4343 | 165 | disabledForegroundColor: UbuntuColors.silk | ||
4344 | 166 | pressedBackgroundColor: UbuntuColors.ash | ||
4345 | 167 | disabledBackgroundColor: UbuntuColors.slate | ||
4346 | 168 | } | ||
4347 | 169 | } | ||
4348 | 110 | } | 170 | } |
4349 | 111 | } | 171 | } |
4350 | 112 | 172 | ||
4351 | @@ -122,20 +182,19 @@ | |||
4352 | 122 | live: true | 182 | live: true |
4353 | 123 | } | 183 | } |
4354 | 124 | 184 | ||
4356 | 125 | Item { | 185 | RowLayout { |
4357 | 126 | width: parent.width | 186 | width: parent.width |
4358 | 127 | height: childrenRect.height | 187 | height: childrenRect.height |
4359 | 128 | 188 | ||
4360 | 129 | Label { | 189 | Label { |
4361 | 130 | anchors { | 190 | anchors { |
4362 | 131 | left: parent.left | ||
4363 | 132 | verticalCenter: customDelegateBar.verticalCenter | 191 | verticalCenter: customDelegateBar.verticalCenter |
4364 | 133 | } | 192 | } |
4365 | 134 | text: "Custom delegate" | 193 | text: "Custom delegate" |
4366 | 135 | } | 194 | } |
4367 | 136 | ActionBar { | 195 | ActionBar { |
4368 | 137 | id: customDelegateBar | 196 | id: customDelegateBar |
4370 | 138 | anchors.right: parent.right | 197 | Layout.fillWidth: true |
4371 | 139 | actions: root.shortActionList | 198 | actions: root.shortActionList |
4372 | 140 | delegate: Button { | 199 | delegate: Button { |
4373 | 141 | action: modelData | 200 | action: modelData |
4374 | @@ -146,23 +205,25 @@ | |||
4375 | 146 | } | 205 | } |
4376 | 147 | } | 206 | } |
4377 | 148 | 207 | ||
4379 | 149 | Item { | 208 | RowLayout { |
4380 | 150 | width: parent.width | 209 | width: parent.width |
4381 | 151 | height: childrenRect.height | 210 | height: childrenRect.height |
4382 | 152 | Label { | 211 | Label { |
4383 | 153 | anchors { | 212 | anchors { |
4384 | 154 | left: parent.left | ||
4385 | 155 | verticalCenter: greenButtonsBar.verticalCenter | 213 | verticalCenter: greenButtonsBar.verticalCenter |
4386 | 156 | } | 214 | } |
4387 | 157 | text: "Custom delegate 2" | 215 | text: "Custom delegate 2" |
4388 | 158 | } | 216 | } |
4389 | 159 | ActionBar { | 217 | ActionBar { |
4390 | 218 | // Note: The same result (green buttons) can be accomplished | ||
4391 | 219 | // by setting the foregroundColor in the style. | ||
4392 | 160 | id: greenButtonsBar | 220 | id: greenButtonsBar |
4394 | 161 | anchors.right: parent.right | 221 | Layout.fillWidth: true |
4395 | 162 | actions: root.actionList | 222 | actions: root.actionList |
4396 | 163 | delegate: AbstractButton { | 223 | delegate: AbstractButton { |
4397 | 164 | styleName: "IconButtonStyle" | 224 | styleName: "IconButtonStyle" |
4398 | 165 | action: modelData | 225 | action: modelData |
4399 | 226 | height: greenButtonsBar.height | ||
4400 | 166 | StyleHints { | 227 | StyleHints { |
4401 | 167 | foregroundColor: UbuntuColors.green | 228 | foregroundColor: UbuntuColors.green |
4402 | 168 | } | 229 | } |
4403 | 169 | 230 | ||
4404 | === added file 'tests/unit/visual/tst_adaptivepagelayout_param.13.qml' | |||
4405 | --- tests/unit/visual/tst_adaptivepagelayout_param.13.qml 1970-01-01 00:00:00 +0000 | |||
4406 | +++ tests/unit/visual/tst_adaptivepagelayout_param.13.qml 2016-08-14 09:05:30 +0000 | |||
4407 | @@ -0,0 +1,62 @@ | |||
4408 | 1 | /* | ||
4409 | 2 | * Copyright 2016 Canonical Ltd. | ||
4410 | 3 | * | ||
4411 | 4 | * This program is free software; you can redistribute it and/or modify | ||
4412 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
4413 | 6 | * the Free Software Foundation; version 3. | ||
4414 | 7 | * | ||
4415 | 8 | * This program is distributed in the hope that it will be useful, | ||
4416 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4417 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4418 | 11 | * GNU Lesser General Public License for more details. | ||
4419 | 12 | * | ||
4420 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4421 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4422 | 15 | */ | ||
4423 | 16 | |||
4424 | 17 | import QtQuick 2.4 | ||
4425 | 18 | import QtTest 1.0 | ||
4426 | 19 | import Ubuntu.Test 1.3 | ||
4427 | 20 | import Ubuntu.Components 1.3 | ||
4428 | 21 | |||
4429 | 22 | AdaptivePageLayout { | ||
4430 | 23 | id: apl | ||
4431 | 24 | width: units.gu(80) | ||
4432 | 25 | height: units.gu(71) | ||
4433 | 26 | asynchronous: false | ||
4434 | 27 | |||
4435 | 28 | primaryPage: Page { | ||
4436 | 29 | header: PageHeader { | ||
4437 | 30 | title: "Test" | ||
4438 | 31 | } | ||
4439 | 32 | } | ||
4440 | 33 | |||
4441 | 34 | Component { | ||
4442 | 35 | id: testPage | ||
4443 | 36 | Page { | ||
4444 | 37 | objectName: "test_page" | ||
4445 | 38 | header: PageHeader { | ||
4446 | 39 | title: "NextPage" | ||
4447 | 40 | } | ||
4448 | 41 | property QtObject model : QtObject { objectName: "test" } | ||
4449 | 42 | } | ||
4450 | 43 | } | ||
4451 | 44 | |||
4452 | 45 | UbuntuTestCase { | ||
4453 | 46 | when: windowShown | ||
4454 | 47 | |||
4455 | 48 | function findPageFromLayout(apl, objectName) { | ||
4456 | 49 | var body = findChild(apl, "body"); | ||
4457 | 50 | verify(body); | ||
4458 | 51 | return findChild(body, objectName); | ||
4459 | 52 | } | ||
4460 | 53 | |||
4461 | 54 | function test_parameters_bug1604780() { | ||
4462 | 55 | apl.addPageToCurrentColumn(apl.primaryPage, testPage, {model: null}); | ||
4463 | 56 | var page = findPageFromLayout(apl, "test_page"); | ||
4464 | 57 | verify(page); | ||
4465 | 58 | compare(page.model, null); | ||
4466 | 59 | } | ||
4467 | 60 | } | ||
4468 | 61 | } | ||
4469 | 62 | |||
4470 | 0 | 63 | ||
4471 | === modified file 'tests/unit/visual/tst_combobutton.13.qml' | |||
4472 | --- tests/unit/visual/tst_combobutton.13.qml 2016-06-15 13:46:51 +0000 | |||
4473 | +++ tests/unit/visual/tst_combobutton.13.qml 2016-08-14 09:05:30 +0000 | |||
4474 | @@ -139,7 +139,7 @@ | |||
4475 | 139 | rectCombo.expanded = true; | 139 | rectCombo.expanded = true; |
4476 | 140 | waitForRendering(rectCombo); | 140 | waitForRendering(rectCombo); |
4477 | 141 | var comboListPanel = findChild(rectCombo, "combobutton_combopanel"); | 141 | var comboListPanel = findChild(rectCombo, "combobutton_combopanel"); |
4479 | 142 | tryCompareFunction(function() { return comboListPanel.opacity}, 1.0); | 142 | tryCompareFunction(function() { return comboListPanel.visible}, true); |
4480 | 143 | } | 143 | } |
4481 | 144 | 144 | ||
4482 | 145 | function test_expandRectComboThroughClick() { | 145 | function test_expandRectComboThroughClick() { |
4483 | @@ -148,7 +148,7 @@ | |||
4484 | 148 | waitForRendering(rectCombo); | 148 | waitForRendering(rectCombo); |
4485 | 149 | compare(rectCombo.expanded, true, "combo is not expanded"); | 149 | compare(rectCombo.expanded, true, "combo is not expanded"); |
4486 | 150 | var comboListPanel = findChild(rectCombo, "combobutton_combopanel"); | 150 | var comboListPanel = findChild(rectCombo, "combobutton_combopanel"); |
4488 | 151 | tryCompareFunction(function() { return comboListPanel.opacity}, 1.0); | 151 | tryCompareFunction(function() { return comboListPanel.visible}, true); |
4489 | 152 | } | 152 | } |
4490 | 153 | 153 | ||
4491 | 154 | function test_autoCollapse() { | 154 | function test_autoCollapse() { |
4492 | @@ -157,12 +157,12 @@ | |||
4493 | 157 | mouseClick(dropDown, dropDown.width / 2, dropDown.height / 2); | 157 | mouseClick(dropDown, dropDown.width / 2, dropDown.height / 2); |
4494 | 158 | waitForRendering(rectCombo); | 158 | waitForRendering(rectCombo); |
4495 | 159 | compare(rectCombo.expanded, true, "combo is not expanded"); | 159 | compare(rectCombo.expanded, true, "combo is not expanded"); |
4497 | 160 | tryCompareFunction(function() { return comboListPanel.opacity}, 1.0); | 160 | tryCompareFunction(function() { return comboListPanel.visible}, true); |
4498 | 161 | 161 | ||
4499 | 162 | mouseClick(rectCombo, rectCombo.width / 2, rectCombo.collapsedHeight / 2); | 162 | mouseClick(rectCombo, rectCombo.width / 2, rectCombo.collapsedHeight / 2); |
4500 | 163 | waitForRendering(rectCombo); | 163 | waitForRendering(rectCombo); |
4501 | 164 | compare(rectCombo.expanded, false, "combo is not collapsed"); | 164 | compare(rectCombo.expanded, false, "combo is not collapsed"); |
4503 | 165 | tryCompareFunction(function() { return comboListPanel.opacity}, 0.0); | 165 | tryCompareFunction(function() { return comboListPanel.visible}, false); |
4504 | 166 | } | 166 | } |
4505 | 167 | 167 | ||
4506 | 168 | function test_flickRectCombo() { | 168 | function test_flickRectCombo() { |
4507 | @@ -174,7 +174,7 @@ | |||
4508 | 174 | var comboList = findChild(rectCombo, "combobutton_combolist"); | 174 | var comboList = findChild(rectCombo, "combobutton_combolist"); |
4509 | 175 | mouseClick(dropDown, dropDown.width / 2, dropDown.height / 2); | 175 | mouseClick(dropDown, dropDown.width / 2, dropDown.height / 2); |
4510 | 176 | waitForRendering(rectCombo); | 176 | waitForRendering(rectCombo); |
4512 | 177 | tryCompareFunction(function() { return comboListPanel.opacity}, 1.0); | 177 | tryCompareFunction(function() { return comboListPanel.visible}, true); |
4513 | 178 | verify(comboList.height > rectCombo.expandedHeight); | 178 | verify(comboList.height > rectCombo.expandedHeight); |
4514 | 179 | // comboList flicker is the combolist parent's parent | 179 | // comboList flicker is the combolist parent's parent |
4515 | 180 | var comboListFlicker = findChild(rectCombo, "combobutton_contentflicker"); | 180 | var comboListFlicker = findChild(rectCombo, "combobutton_contentflicker"); |
4516 | @@ -196,10 +196,11 @@ | |||
4517 | 196 | var comboList = findChild(columnCombo, "combobutton_combolist"); | 196 | var comboList = findChild(columnCombo, "combobutton_combolist"); |
4518 | 197 | columnCombo.expanded = true; | 197 | columnCombo.expanded = true; |
4519 | 198 | waitForRendering(columnCombo); | 198 | waitForRendering(columnCombo); |
4521 | 199 | tryCompareFunction(function() { return comboListPanel.opacity}, 1.0); | 199 | tryCompareFunction(function() { return comboListPanel.visible}, true); |
4522 | 200 | var comboListFlicker = findChild(columnCombo, "combobutton_contentflicker"); | 200 | var comboListFlicker = findChild(columnCombo, "combobutton_contentflicker"); |
4523 | 201 | waitForRendering(comboListFlicker); | ||
4524 | 201 | compare(comboListFlicker.interactive, false, "combo list holder must not be interactive"); | 202 | compare(comboListFlicker.interactive, false, "combo list holder must not be interactive"); |
4526 | 202 | compare(comboListFlicker.height, columnCombo.comboListHeight, "combo list height differs from the holder height"); | 203 | tryCompare(comboListFlicker, 'height', columnCombo.comboListHeight, 500, "combo list height differs from the holder height"); |
4527 | 203 | } | 204 | } |
4528 | 204 | 205 | ||
4529 | 205 | function test_emptyComboExpanded() { | 206 | function test_emptyComboExpanded() { |
4530 | @@ -208,7 +209,7 @@ | |||
4531 | 208 | combo.expanded = true; | 209 | combo.expanded = true; |
4532 | 209 | waitForRendering(combo); | 210 | waitForRendering(combo); |
4533 | 210 | waitForRendering(comboListPanel); | 211 | waitForRendering(comboListPanel); |
4535 | 211 | tryCompareFunction(function() { return comboListPanel.opacity}, 0.0, 1000); | 212 | tryCompareFunction(function() { return comboListPanel.visible}, false, 1000); |
4536 | 212 | } | 213 | } |
4537 | 213 | 214 | ||
4538 | 214 | function test_longCombo() { | 215 | function test_longCombo() { |
4539 | @@ -217,7 +218,7 @@ | |||
4540 | 217 | longCombo.expanded = true; | 218 | longCombo.expanded = true; |
4541 | 218 | waitForRendering(longCombo); | 219 | waitForRendering(longCombo); |
4542 | 219 | waitForRendering(comboListPanel); | 220 | waitForRendering(comboListPanel); |
4544 | 220 | tryCompareFunction(function() { return comboListPanel.opacity}, 1.0); | 221 | tryCompareFunction(function() { return comboListPanel.visible}, true); |
4545 | 221 | verify(comboListPanel.height < longCombo.expandedHeight); | 222 | verify(comboListPanel.height < longCombo.expandedHeight); |
4546 | 222 | } | 223 | } |
4547 | 223 | 224 | ||
4548 | @@ -227,9 +228,21 @@ | |||
4549 | 227 | listCombo.expanded = true; | 228 | listCombo.expanded = true; |
4550 | 228 | waitForRendering(listCombo); | 229 | waitForRendering(listCombo); |
4551 | 229 | waitForRendering(comboListPanel); | 230 | waitForRendering(comboListPanel); |
4553 | 230 | tryCompareFunction(function() { return comboListPanel.opacity}, 1.0); | 231 | tryCompareFunction(function() { return comboListPanel.visible}, true); |
4554 | 231 | 232 | ||
4555 | 232 | compare(list.height, comboList.height, "list and comboList height differs"); | 233 | compare(list.height, comboList.height, "list and comboList height differs"); |
4556 | 233 | } | 234 | } |
4557 | 235 | |||
4558 | 236 | function test_expand_via_keyboard() { | ||
4559 | 237 | rectCombo.forceActiveFocus(); | ||
4560 | 238 | waitForRendering(rectCombo); | ||
4561 | 239 | tryCompare(rectCombo, 'expanded', false, 500, "ComboBox not expanded after focus"); | ||
4562 | 240 | keyClick(Qt.Key_Space); | ||
4563 | 241 | waitForRendering(rectCombo); | ||
4564 | 242 | verify(rectCombo.expanded, true, "ComboBox was expanded via the Space key"); | ||
4565 | 243 | keyClick(Qt.Key_Space); | ||
4566 | 244 | waitForRendering(rectCombo); | ||
4567 | 245 | tryCompare(rectCombo, 'expanded', false, 500, "ComboBox was collapsed via the Space key"); | ||
4568 | 246 | } | ||
4569 | 234 | } | 247 | } |
4570 | 235 | } | 248 | } |
4571 | 236 | 249 | ||
4572 | === modified file 'tests/unit/visual/tst_focus.13.qml' | |||
4573 | --- tests/unit/visual/tst_focus.13.qml 2016-06-15 13:46:51 +0000 | |||
4574 | +++ tests/unit/visual/tst_focus.13.qml 2016-08-14 09:05:30 +0000 | |||
4575 | @@ -279,6 +279,8 @@ | |||
4576 | 279 | {tag: "ActionBar", from: 'actionBarShare_button', to: picker, key: Qt.Key_Tab}, | 279 | {tag: "ActionBar", from: 'actionBarShare_button', to: picker, key: Qt.Key_Tab}, |
4577 | 280 | {tag: "ActionBar(back)", from: picker, to: 'actionBarShare_button', key: Qt.Key_Backtab}, | 280 | {tag: "ActionBar(back)", from: picker, to: 'actionBarShare_button', key: Qt.Key_Backtab}, |
4578 | 281 | */ | 281 | */ |
4579 | 282 | {tag: "ComboButton", from: pickerPanel, to: comboButton, key: Qt.Key_Tab}, | ||
4580 | 283 | {tag: "ComboButton(back)", from: comboButton, to: pickerPanel, key: Qt.Key_Backtab}, | ||
4581 | 282 | // Left click/ tap | 284 | // Left click/ tap |
4582 | 283 | {tag: "TextField(click)", from: dummy, to: textField, key: Qt.LeftButton}, | 285 | {tag: "TextField(click)", from: dummy, to: textField, key: Qt.LeftButton}, |
4583 | 284 | {tag: "TextArea(click)", from: dummy, to: textArea, key: Qt.LeftButton}, | 286 | {tag: "TextArea(click)", from: dummy, to: textArea, key: Qt.LeftButton}, |
4584 | @@ -370,10 +372,11 @@ | |||
4585 | 370 | 372 | ||
4586 | 371 | var center = centerOf(dropdownButton); | 373 | var center = centerOf(dropdownButton); |
4587 | 372 | mouseClick(dropdownButton, center.x, center.y); | 374 | mouseClick(dropdownButton, center.x, center.y); |
4588 | 375 | waitForRendering(dropdownButton); | ||
4589 | 373 | waitForRendering(comboButton); | 376 | waitForRendering(comboButton); |
4590 | 374 | // FIXME: lp#1368390: Buttons shouldn't grab input focus on click | 377 | // FIXME: lp#1368390: Buttons shouldn't grab input focus on click |
4593 | 375 | compare(dropdownButton.focus, true, "Dropdown button hasn't got focused!"); | 378 | compare(dropdownButton.activeFocus, false, "Dropdown button hasn't got focused!"); |
4594 | 376 | compare(comboButton.focus, true, "ComboButton hasn't been focused!"); | 379 | compare(comboButton.activeFocus, true, "ComboButton hasn't been focused!"); |
4595 | 377 | comboButton.expanded = false; | 380 | comboButton.expanded = false; |
4596 | 378 | waitForRendering(comboButton); | 381 | waitForRendering(comboButton); |
4597 | 379 | } | 382 | } |
4598 | @@ -448,6 +451,9 @@ | |||
4599 | 448 | {tag: "ListItem/Enter", key: Qt.Key_Enter, item: listItem, signalName: 'onClicked'}, | 451 | {tag: "ListItem/Enter", key: Qt.Key_Enter, item: listItem, signalName: 'onClicked'}, |
4600 | 449 | {tag: "ListItem/Return", key: Qt.Key_Return, item: listItem, signalName: 'onClicked'}, | 452 | {tag: "ListItem/Return", key: Qt.Key_Return, item: listItem, signalName: 'onClicked'}, |
4601 | 450 | {tag: "ListItem/Space", key: Qt.Key_Space, item: listItem, signalName: 'onClicked'}, | 453 | {tag: "ListItem/Space", key: Qt.Key_Space, item: listItem, signalName: 'onClicked'}, |
4602 | 454 | {tag: "ComboButton/Enter", key: Qt.Key_Enter, item: button , signalName: 'onTriggered'}, | ||
4603 | 455 | {tag: "ComboButton/Return", key: Qt.Key_Return, item: button, signalName: 'onTriggered'}, | ||
4604 | 456 | {tag: "ComboButton/Space", key: Qt.Key_Space, item: button, signalName: 'onTriggered'}, | ||
4605 | 451 | ]; | 457 | ]; |
4606 | 452 | } | 458 | } |
4607 | 453 | function test_trigger_via_keyboard(data) { | 459 | function test_trigger_via_keyboard(data) { |
4608 | 454 | 460 | ||
4609 | === modified file 'tests/unit/visual/tst_listitem.12.qml' | |||
4610 | --- tests/unit/visual/tst_listitem.12.qml 2016-06-15 13:46:51 +0000 | |||
4611 | +++ tests/unit/visual/tst_listitem.12.qml 2016-08-14 09:05:30 +0000 | |||
4612 | @@ -245,7 +245,7 @@ | |||
4613 | 245 | 245 | ||
4614 | 246 | function test_0_defaults() { | 246 | function test_0_defaults() { |
4615 | 247 | verify(defaults.contentItem !== null, "Defaults is null"); | 247 | verify(defaults.contentItem !== null, "Defaults is null"); |
4617 | 248 | compare(defaults.color, "#000000", "Transparent by default"); | 248 | compare(defaults.color.toString(), Qt.rgba(0.0, 0.0, 0.0, 0.0).toString(), "Transparent by default"); |
4618 | 249 | compare(defaults.highlightColor, theme.palette.selected.background, "theme.palette.selected.background color by default") | 249 | compare(defaults.highlightColor, theme.palette.selected.background, "theme.palette.selected.background color by default") |
4619 | 250 | compare(defaults.highlighted, false, "Not highlighted by default"); | 250 | compare(defaults.highlighted, false, "Not highlighted by default"); |
4620 | 251 | compare(defaults.divider.visible, true, "divider is visible by default"); | 251 | compare(defaults.divider.visible, true, "divider is visible by default"); |
4621 | 252 | 252 | ||
4622 | === modified file 'tests/unit/visual/tst_listitem.13.qml' | |||
4623 | --- tests/unit/visual/tst_listitem.13.qml 2016-06-15 13:46:51 +0000 | |||
4624 | +++ tests/unit/visual/tst_listitem.13.qml 2016-08-14 09:05:30 +0000 | |||
4625 | @@ -245,7 +245,7 @@ | |||
4626 | 245 | 245 | ||
4627 | 246 | function test_0_defaults() { | 246 | function test_0_defaults() { |
4628 | 247 | verify(defaults.contentItem !== null, "Defaults is null"); | 247 | verify(defaults.contentItem !== null, "Defaults is null"); |
4630 | 248 | compare(defaults.color, "#000000", "Transparent by default"); | 248 | compare(defaults.color.toString(), Qt.rgba(0.0, 0.0, 0.0, 0.0).toString(), "Transparent by default"); |
4631 | 249 | compare(defaults.highlightColor, theme.palette.selected.background, "theme.palette.selected.background color by default") | 249 | compare(defaults.highlightColor, theme.palette.selected.background, "theme.palette.selected.background color by default") |
4632 | 250 | compare(defaults.highlighted, false, "Not highlighted by default"); | 250 | compare(defaults.highlighted, false, "Not highlighted by default"); |
4633 | 251 | compare(defaults.divider.visible, true, "divider is visible by default"); | 251 | compare(defaults.divider.visible, true, "divider is visible by default"); |
4634 | 252 | 252 | ||
4635 | === modified file 'tests/unit/visual/tst_listitem_focus.13.qml' | |||
4636 | --- tests/unit/visual/tst_listitem_focus.13.qml 2016-06-15 13:46:51 +0000 | |||
4637 | +++ tests/unit/visual/tst_listitem_focus.13.qml 2016-08-14 09:05:30 +0000 | |||
4638 | @@ -27,27 +27,125 @@ | |||
4639 | 27 | 27 | ||
4640 | 28 | property Item activeFocusItem: Window.activeFocusItem | 28 | property Item activeFocusItem: Window.activeFocusItem |
4641 | 29 | 29 | ||
4642 | 30 | PageHeader { | ||
4643 | 31 | id: header | ||
4644 | 32 | title: "ListItem focus test" | ||
4645 | 33 | extension: Sections { | ||
4646 | 34 | id: directionSections | ||
4647 | 35 | width: parent.width | ||
4648 | 36 | selectedIndex: -1 | ||
4649 | 37 | function setupListView(showContent, orientation, reverseDirection) { | ||
4650 | 38 | testCase.cleanup(); | ||
4651 | 39 | var test = testCase.loadTest(listView); | ||
4652 | 40 | test.orientation = orientation; | ||
4653 | 41 | if (reverseDirection) { | ||
4654 | 42 | if (orientation === ListView.Horizontal) { | ||
4655 | 43 | test.layoutDirection = Qt.RightToLeft; | ||
4656 | 44 | } else { | ||
4657 | 45 | test.verticalLayoutDirection = ListView.BottomToTop; | ||
4658 | 46 | } | ||
4659 | 47 | } | ||
4660 | 48 | if (showContent) { | ||
4661 | 49 | test.delegate = listItemWithContent; | ||
4662 | 50 | } else { | ||
4663 | 51 | test.delegate = simpleListItem; | ||
4664 | 52 | } | ||
4665 | 53 | } | ||
4666 | 54 | |||
4667 | 55 | actions: [ | ||
4668 | 56 | Action { | ||
4669 | 57 | text: "TopToBottom" | ||
4670 | 58 | onTriggered: directionSections.setupListView(switchContentAction.showContent, | ||
4671 | 59 | ListView.Vertical, false); | ||
4672 | 60 | }, | ||
4673 | 61 | Action { | ||
4674 | 62 | text: "LeftToRight" | ||
4675 | 63 | onTriggered: directionSections.setupListView(switchContentAction.showContent, | ||
4676 | 64 | ListView.Horizontal, false); | ||
4677 | 65 | }, | ||
4678 | 66 | Action { | ||
4679 | 67 | text: "BottomToTop" | ||
4680 | 68 | onTriggered: directionSections.setupListView(switchContentAction.showContent, | ||
4681 | 69 | ListView.Vertical, true); | ||
4682 | 70 | }, | ||
4683 | 71 | Action { | ||
4684 | 72 | text: "RightToLeft" | ||
4685 | 73 | onTriggered: directionSections.setupListView(switchContentAction.showContent, | ||
4686 | 74 | ListView.Horizontal, true); | ||
4687 | 75 | } | ||
4688 | 76 | |||
4689 | 77 | ] | ||
4690 | 78 | } | ||
4691 | 79 | trailingActionBar.actions: [ | ||
4692 | 80 | Action { | ||
4693 | 81 | id: switchContentAction | ||
4694 | 82 | property bool showContent: false | ||
4695 | 83 | iconName: showContent ? "select" : "select-none" | ||
4696 | 84 | onTriggered: { | ||
4697 | 85 | showContent = !showContent; | ||
4698 | 86 | if (directionSections.selectedIndex >= 0) { | ||
4699 | 87 | directionSections.actions[directionSections.selectedIndex].trigger(); | ||
4700 | 88 | } | ||
4701 | 89 | } | ||
4702 | 90 | } | ||
4703 | 91 | ] | ||
4704 | 92 | } | ||
4705 | 93 | |||
4706 | 30 | Rectangle { | 94 | Rectangle { |
4709 | 31 | id: topItem | 95 | id: topFocusItem |
4710 | 32 | objectName: "topItem" | 96 | objectName: "topFocusItem" |
4711 | 33 | activeFocusOnTab: true | 97 | activeFocusOnTab: true |
4713 | 34 | width: parent.width | 98 | anchors { |
4714 | 99 | left: parent.left | ||
4715 | 100 | right: parent.right | ||
4716 | 101 | top: header.bottom | ||
4717 | 102 | } | ||
4718 | 35 | height: units.gu(2) | 103 | height: units.gu(2) |
4719 | 104 | border { | ||
4720 | 105 | width: units.dp(3) | ||
4721 | 106 | color: topFocusItem.activeFocus ? UbuntuColors.orange : UbuntuColors.silk | ||
4722 | 107 | } | ||
4723 | 36 | } | 108 | } |
4724 | 37 | |||
4725 | 38 | Loader { | 109 | Loader { |
4726 | 39 | id: testLoader | 110 | id: testLoader |
4727 | 40 | anchors { | 111 | anchors { |
4730 | 41 | fill: parent | 112 | left: parent.left |
4731 | 42 | topMargin: topItem.height | 113 | right: parent.right |
4732 | 114 | top: topFocusItem.bottom | ||
4733 | 115 | bottom: bottomFocusItem.top | ||
4734 | 116 | } | ||
4735 | 117 | clip: true | ||
4736 | 118 | } | ||
4737 | 119 | Rectangle { | ||
4738 | 120 | id: bottomFocusItem | ||
4739 | 121 | objectName: "bottomFocusItem" | ||
4740 | 122 | activeFocusOnTab: true | ||
4741 | 123 | anchors { | ||
4742 | 124 | left: parent.left | ||
4743 | 125 | right: parent.right | ||
4744 | 126 | bottom: parent.bottom | ||
4745 | 127 | } | ||
4746 | 128 | height: units.gu(2) | ||
4747 | 129 | border { | ||
4748 | 130 | width: units.dp(3) | ||
4749 | 131 | color: bottomFocusItem.activeFocus ? UbuntuColors.orange : UbuntuColors.silk | ||
4750 | 43 | } | 132 | } |
4751 | 44 | } | 133 | } |
4752 | 45 | 134 | ||
4753 | 46 | Component { | 135 | Component { |
4754 | 47 | id: simpleListItem | 136 | id: simpleListItem |
4755 | 48 | ListItem { | 137 | ListItem { |
4756 | 138 | id: listItem | ||
4757 | 49 | objectName: "simple" + index | 139 | objectName: "simple" + index |
4758 | 50 | property int itemIndex: index | 140 | property int itemIndex: index |
4759 | 141 | Label { | ||
4760 | 142 | anchors { | ||
4761 | 143 | left: parent.left | ||
4762 | 144 | leftMargin: units.gu(2) | ||
4763 | 145 | verticalCenter: parent.verticalCenter | ||
4764 | 146 | } | ||
4765 | 147 | text: listItem.objectName | ||
4766 | 148 | } | ||
4767 | 51 | } | 149 | } |
4768 | 52 | } | 150 | } |
4769 | 53 | 151 | ||
4770 | @@ -61,7 +159,7 @@ | |||
4771 | 61 | spacing: units.gu(1) | 159 | spacing: units.gu(1) |
4772 | 62 | CheckBox { objectName: "checkbox" + listItem.itemIndex } | 160 | CheckBox { objectName: "checkbox" + listItem.itemIndex } |
4773 | 63 | Switch { objectName: "switch" + listItem.itemIndex } | 161 | Switch { objectName: "switch" + listItem.itemIndex } |
4775 | 64 | Button { objectName: "button" + listItem.itemIndex; text: "test" } | 162 | Button { objectName: "button" + listItem.itemIndex; text: "test " + itemIndex } |
4776 | 65 | } | 163 | } |
4777 | 66 | leadingActions: ListItemActions { | 164 | leadingActions: ListItemActions { |
4778 | 67 | actions: Action { | 165 | actions: Action { |
4779 | @@ -100,6 +198,7 @@ | |||
4780 | 100 | } | 198 | } |
4781 | 101 | 199 | ||
4782 | 102 | ListItemTestCase13 { | 200 | ListItemTestCase13 { |
4783 | 201 | id: testCase | ||
4784 | 103 | name: "ListItemFocus" | 202 | name: "ListItemFocus" |
4785 | 104 | when: windowShown | 203 | when: windowShown |
4786 | 105 | 204 | ||
4787 | @@ -114,7 +213,7 @@ | |||
4788 | 114 | wait(200); | 213 | wait(200); |
4789 | 115 | } | 214 | } |
4790 | 116 | function init() { | 215 | function init() { |
4792 | 117 | topItem.forceActiveFocus(Qt.TabFocusReason); | 216 | topFocusItem.forceActiveFocus(Qt.TabFocusReason); |
4793 | 118 | } | 217 | } |
4794 | 119 | 218 | ||
4795 | 120 | function initTestCase() { | 219 | function initTestCase() { |
4796 | @@ -124,10 +223,10 @@ | |||
4797 | 124 | // Tab/Backtab focuses the First ListItem in a ListView | 223 | // Tab/Backtab focuses the First ListItem in a ListView |
4798 | 125 | function test_focusing_listview_focuses_first_item_data() { | 224 | function test_focusing_listview_focuses_first_item_data() { |
4799 | 126 | return [ | 225 | return [ |
4804 | 127 | {tag: "Tab, no content", preFocus: topItem, delegate: simpleListItem, key: Qt.Key_Tab, focusItem: "simple0"}, | 226 | {tag: "Tab, no content", preFocus: topFocusItem, delegate: simpleListItem, key: Qt.Key_Tab, focusItem: "simple0"}, |
4805 | 128 | {tag: "Tab, with content", preFocus: topItem, delegate: listItemWithContent, key: Qt.Key_Tab, focusItem: "withContent0"}, | 227 | {tag: "Tab, with content", preFocus: topFocusItem, delegate: listItemWithContent, key: Qt.Key_Tab, focusItem: "withContent0"}, |
4806 | 129 | {tag: "Backtab, no content", preFocus: topItem, delegate: simpleListItem, key: Qt.Key_Backtab, focusItem: "simple0"}, | 228 | {tag: "Backtab, no content", preFocus: bottomFocusItem, delegate: simpleListItem, key: Qt.Key_Backtab, focusItem: "simple0"}, |
4807 | 130 | {tag: "Backtab, with content", preFocus: topItem, delegate: listItemWithContent, key: Qt.Key_Backtab, focusItem: "withContent0"}, | 229 | {tag: "Backtab, with content", preFocus: bottomFocusItem, delegate: listItemWithContent, key: Qt.Key_Backtab, focusItem: "withContent0"}, |
4808 | 131 | ]; | 230 | ]; |
4809 | 132 | } | 231 | } |
4810 | 133 | function test_focusing_listview_focuses_first_item(data) { | 232 | function test_focusing_listview_focuses_first_item(data) { |
4811 | @@ -155,6 +254,15 @@ | |||
4812 | 155 | keyTimes: 3, | 254 | keyTimes: 3, |
4813 | 156 | focusItems: ["simple1", "simple2", "simple3"] | 255 | focusItems: ["simple1", "simple2", "simple3"] |
4814 | 157 | }, | 256 | }, |
4815 | 257 | { tag: "BottomToTop up, no content, bottom to top direction, from beginning", | ||
4816 | 258 | delegate: simpleListItem, | ||
4817 | 259 | orientation: ListView.Vertical, | ||
4818 | 260 | direction: ListView.BottomToTop, | ||
4819 | 261 | initialIndex: 0, | ||
4820 | 262 | key: Qt.Key_Up, | ||
4821 | 263 | keyTimes: 3, | ||
4822 | 264 | focusItems: ["simple1", "simple2", "simple3"] | ||
4823 | 265 | }, | ||
4824 | 158 | { | 266 | { |
4825 | 159 | tag: "Down, no contents, near end", | 267 | tag: "Down, no contents, near end", |
4826 | 160 | delegate: simpleListItem, | 268 | delegate: simpleListItem, |
4827 | @@ -165,6 +273,17 @@ | |||
4828 | 165 | // Don't navigate beyond the last item: | 273 | // Don't navigate beyond the last item: |
4829 | 166 | focusItems: ["simple"+(n-2), "simple"+(n-1), "simple"+(n-1)] | 274 | focusItems: ["simple"+(n-2), "simple"+(n-1), "simple"+(n-1)] |
4830 | 167 | }, | 275 | }, |
4831 | 276 | { | ||
4832 | 277 | tag: "BottomToTop up, no contents, near end", | ||
4833 | 278 | delegate: simpleListItem, | ||
4834 | 279 | orientation: ListView.Vertical, | ||
4835 | 280 | direction: ListView.BottomToTop, | ||
4836 | 281 | initialIndex: n - 3, | ||
4837 | 282 | key: Qt.Key_Up, | ||
4838 | 283 | keyTimes: 3, | ||
4839 | 284 | // Don't navigate beyond the last item: | ||
4840 | 285 | focusItems: ["simple"+(n-2), "simple"+(n-1), "simple"+(n-1)] | ||
4841 | 286 | }, | ||
4842 | 168 | { tag: "Up, no content, near beginning", | 287 | { tag: "Up, no content, near beginning", |
4843 | 169 | delegate: simpleListItem, | 288 | delegate: simpleListItem, |
4844 | 170 | orientation: ListView.Vertical, | 289 | orientation: ListView.Vertical, |
4845 | @@ -173,6 +292,15 @@ | |||
4846 | 173 | keyTimes: 3, | 292 | keyTimes: 3, |
4847 | 174 | focusItems: ["simple1", "simple0", "simple0"] | 293 | focusItems: ["simple1", "simple0", "simple0"] |
4848 | 175 | }, | 294 | }, |
4849 | 295 | { tag: "BottomToTop down, no content, near beginning", | ||
4850 | 296 | delegate: simpleListItem, | ||
4851 | 297 | orientation: ListView.Vertical, | ||
4852 | 298 | direction: ListView.BottomToTop, | ||
4853 | 299 | initialIndex: 2, | ||
4854 | 300 | key: Qt.Key_Down, | ||
4855 | 301 | keyTimes: 3, | ||
4856 | 302 | focusItems: ["simple1", "simple0", "simple0"] | ||
4857 | 303 | }, | ||
4858 | 176 | { | 304 | { |
4859 | 177 | tag: "Up, no contents, from end", | 305 | tag: "Up, no contents, from end", |
4860 | 178 | delegate: simpleListItem, | 306 | delegate: simpleListItem, |
4861 | @@ -182,6 +310,16 @@ | |||
4862 | 182 | keyTimes: 3, | 310 | keyTimes: 3, |
4863 | 183 | focusItems: ["simple"+(n-2), "simple"+(n-3), "simple"+(n-4)] | 311 | focusItems: ["simple"+(n-2), "simple"+(n-3), "simple"+(n-4)] |
4864 | 184 | }, | 312 | }, |
4865 | 313 | { | ||
4866 | 314 | tag: "BottomToTop down, no contents, from end", | ||
4867 | 315 | delegate: simpleListItem, | ||
4868 | 316 | orientation: ListView.Vertical, | ||
4869 | 317 | direction: ListView.BottomToTop, | ||
4870 | 318 | initialIndex: n - 1, | ||
4871 | 319 | key: Qt.Key_Down, | ||
4872 | 320 | keyTimes: 3, | ||
4873 | 321 | focusItems: ["simple"+(n-2), "simple"+(n-3), "simple"+(n-4)] | ||
4874 | 322 | }, | ||
4875 | 185 | { tag: "Left, no content, near beginning", | 323 | { tag: "Left, no content, near beginning", |
4876 | 186 | delegate: simpleListItem, | 324 | delegate: simpleListItem, |
4877 | 187 | orientation: ListView.Horizontal, | 325 | orientation: ListView.Horizontal, |
4878 | @@ -190,6 +328,15 @@ | |||
4879 | 190 | keyTimes: 3, | 328 | keyTimes: 3, |
4880 | 191 | focusItems: ["simple1", "simple0", "simple0"] | 329 | focusItems: ["simple1", "simple0", "simple0"] |
4881 | 192 | }, | 330 | }, |
4882 | 331 | { tag: "RightToLeft right, no content, near beginning", | ||
4883 | 332 | delegate: simpleListItem, | ||
4884 | 333 | orientation: ListView.Horizontal, | ||
4885 | 334 | direction: Qt.RightToLeft, | ||
4886 | 335 | initialIndex: 2, | ||
4887 | 336 | key: Qt.Key_Right, | ||
4888 | 337 | keyTimes: 3, | ||
4889 | 338 | focusItems: ["simple1", "simple0", "simple0"] | ||
4890 | 339 | }, | ||
4891 | 193 | { tag: "Left, no content, from end", | 340 | { tag: "Left, no content, from end", |
4892 | 194 | delegate: simpleListItem, | 341 | delegate: simpleListItem, |
4893 | 195 | orientation: ListView.Horizontal, | 342 | orientation: ListView.Horizontal, |
4894 | @@ -198,6 +345,15 @@ | |||
4895 | 198 | keyTimes: 3, | 345 | keyTimes: 3, |
4896 | 199 | focusItems: ["simple"+(n-2), "simple"+(n-3), "simple"+(n-4)] | 346 | focusItems: ["simple"+(n-2), "simple"+(n-3), "simple"+(n-4)] |
4897 | 200 | }, | 347 | }, |
4898 | 348 | { tag: "RightToLeft right, no content, from end", | ||
4899 | 349 | delegate: simpleListItem, | ||
4900 | 350 | orientation: ListView.Horizontal, | ||
4901 | 351 | direction: Qt.RightToLeft, | ||
4902 | 352 | initialIndex: n - 1, | ||
4903 | 353 | key: Qt.Key_Right, | ||
4904 | 354 | keyTimes: 3, | ||
4905 | 355 | focusItems: ["simple"+(n-2), "simple"+(n-3), "simple"+(n-4)] | ||
4906 | 356 | }, | ||
4907 | 201 | { tag: "Right, no content, from beginning", | 357 | { tag: "Right, no content, from beginning", |
4908 | 202 | delegate: simpleListItem, | 358 | delegate: simpleListItem, |
4909 | 203 | orientation: ListView.Horizontal, | 359 | orientation: ListView.Horizontal, |
4910 | @@ -206,6 +362,15 @@ | |||
4911 | 206 | keyTimes: 5, | 362 | keyTimes: 5, |
4912 | 207 | focusItems: ["simple1", "simple2", "simple3", "simple4", "simple5"] | 363 | focusItems: ["simple1", "simple2", "simple3", "simple4", "simple5"] |
4913 | 208 | }, | 364 | }, |
4914 | 365 | { tag: "RightToLeft left, no content, from beginning", | ||
4915 | 366 | delegate: simpleListItem, | ||
4916 | 367 | orientation: ListView.Horizontal, | ||
4917 | 368 | direction: Qt.RightToLeft, | ||
4918 | 369 | initialIndex: 0, | ||
4919 | 370 | key: Qt.Key_Left, | ||
4920 | 371 | keyTimes: 5, | ||
4921 | 372 | focusItems: ["simple1", "simple2", "simple3", "simple4", "simple5"] | ||
4922 | 373 | }, | ||
4923 | 209 | { tag: "Right, no content, near end", | 374 | { tag: "Right, no content, near end", |
4924 | 210 | delegate: simpleListItem, | 375 | delegate: simpleListItem, |
4925 | 211 | orientation: ListView.Horizontal, | 376 | orientation: ListView.Horizontal, |
4926 | @@ -214,6 +379,15 @@ | |||
4927 | 214 | keyTimes: 2, | 379 | keyTimes: 2, |
4928 | 215 | focusItems: ["simple"+(n-2), "simple"+(n-1), "simple"+(n-1)] | 380 | focusItems: ["simple"+(n-2), "simple"+(n-1), "simple"+(n-1)] |
4929 | 216 | }, | 381 | }, |
4930 | 382 | { tag: "RightToLeft left, no content, near end", | ||
4931 | 383 | delegate: simpleListItem, | ||
4932 | 384 | orientation: ListView.Horizontal, | ||
4933 | 385 | direction: Qt.RightToLeft, | ||
4934 | 386 | initialIndex: n - 3, | ||
4935 | 387 | key: Qt.Key_Left, | ||
4936 | 388 | keyTimes: 2, | ||
4937 | 389 | focusItems: ["simple"+(n-2), "simple"+(n-1), "simple"+(n-1)] | ||
4938 | 390 | }, | ||
4939 | 217 | { tag: "Down, with content, from beginning", | 391 | { tag: "Down, with content, from beginning", |
4940 | 218 | delegate: listItemWithContent, | 392 | delegate: listItemWithContent, |
4941 | 219 | orientation: ListView.Vertical, | 393 | orientation: ListView.Vertical, |
4942 | @@ -222,6 +396,15 @@ | |||
4943 | 222 | keyTimes: 3, | 396 | keyTimes: 3, |
4944 | 223 | focusItems: ["withContent1", "withContent2", "withContent3"] | 397 | focusItems: ["withContent1", "withContent2", "withContent3"] |
4945 | 224 | }, | 398 | }, |
4946 | 399 | { tag: "BottomToTop up, with content, from beginning", | ||
4947 | 400 | delegate: listItemWithContent, | ||
4948 | 401 | orientation: ListView.Vertical, | ||
4949 | 402 | direction: ListView.BottomToTop, | ||
4950 | 403 | initialIndex: 0, | ||
4951 | 404 | key: Qt.Key_Up, | ||
4952 | 405 | keyTimes: 3, | ||
4953 | 406 | focusItems: ["withContent1", "withContent2", "withContent3"] | ||
4954 | 407 | }, | ||
4955 | 225 | { tag: "Down, with content, near end", | 408 | { tag: "Down, with content, near end", |
4956 | 226 | delegate: listItemWithContent, | 409 | delegate: listItemWithContent, |
4957 | 227 | orientation: ListView.Vertical, | 410 | orientation: ListView.Vertical, |
4958 | @@ -230,6 +413,15 @@ | |||
4959 | 230 | keyTimes: 3, | 413 | keyTimes: 3, |
4960 | 231 | focusItems: ["withContent"+(n-2), "withContent"+(n-1), "withContent"+(n-1)] | 414 | focusItems: ["withContent"+(n-2), "withContent"+(n-1), "withContent"+(n-1)] |
4961 | 232 | }, | 415 | }, |
4962 | 416 | { tag: "BottomToTop up, with content, near end", | ||
4963 | 417 | delegate: listItemWithContent, | ||
4964 | 418 | orientation: ListView.Vertical, | ||
4965 | 419 | direction: ListView.BottomToTop, | ||
4966 | 420 | initialIndex: n - 3, | ||
4967 | 421 | key: Qt.Key_Up, | ||
4968 | 422 | keyTimes: 3, | ||
4969 | 423 | focusItems: ["withContent"+(n-2), "withContent"+(n-1), "withContent"+(n-1)] | ||
4970 | 424 | }, | ||
4971 | 233 | { tag: "Up, with content, near beginning", | 425 | { tag: "Up, with content, near beginning", |
4972 | 234 | delegate: listItemWithContent, | 426 | delegate: listItemWithContent, |
4973 | 235 | orientation: ListView.Vertical, | 427 | orientation: ListView.Vertical, |
4974 | @@ -238,6 +430,15 @@ | |||
4975 | 238 | keyTimes: 3, | 430 | keyTimes: 3, |
4976 | 239 | focusItems: ["withContent1", "withContent0", "withContent0"] | 431 | focusItems: ["withContent1", "withContent0", "withContent0"] |
4977 | 240 | }, | 432 | }, |
4978 | 433 | { tag: "BottomToTop down, with content, near beginning", | ||
4979 | 434 | delegate: listItemWithContent, | ||
4980 | 435 | orientation: ListView.Vertical, | ||
4981 | 436 | direction: ListView.BottomToTop, | ||
4982 | 437 | initialIndex: 2, | ||
4983 | 438 | key: Qt.Key_Down, | ||
4984 | 439 | keyTimes: 3, | ||
4985 | 440 | focusItems: ["withContent1", "withContent0", "withContent0"] | ||
4986 | 441 | }, | ||
4987 | 241 | { tag: "Up, with content, from end", | 442 | { tag: "Up, with content, from end", |
4988 | 242 | delegate: listItemWithContent, | 443 | delegate: listItemWithContent, |
4989 | 243 | orientation: ListView.Vertical, | 444 | orientation: ListView.Vertical, |
4990 | @@ -245,6 +446,15 @@ | |||
4991 | 245 | key: Qt.Key_Up, | 446 | key: Qt.Key_Up, |
4992 | 246 | keyTimes: 2, | 447 | keyTimes: 2, |
4993 | 247 | focusItems: ["withContent"+(n-2), "withContent"+(n-3)] | 448 | focusItems: ["withContent"+(n-2), "withContent"+(n-3)] |
4994 | 449 | }, | ||
4995 | 450 | { tag: "BottomToTop down, with content, from end", | ||
4996 | 451 | delegate: listItemWithContent, | ||
4997 | 452 | orientation: ListView.Vertical, | ||
4998 | 453 | direction: ListView.BottomToTop, | ||
4999 | 454 | initialIndex: n - 1, | ||
5000 | 455 | key: Qt.Key_Down, |
The diff has been truncated for viewing.