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