Merge lp:~bzoltan/ubuntu-ui-toolkit/landing-2015-10-06 into lp:ubuntu-ui-toolkit
- landing-2015-10-06
- Merge into trunk
Proposed by
Zoltan Balogh
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Zoltan Balogh | ||||
Approved revision: | 1677 | ||||
Merged at revision: | 1237 | ||||
Proposed branch: | lp:~bzoltan/ubuntu-ui-toolkit/landing-2015-10-06 | ||||
Merge into: | lp:ubuntu-ui-toolkit | ||||
Diff against target: |
679 lines (+209/-198) 10 files modified
debian/changelog (+13/-0) src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+52/-30) src/Ubuntu/Components/plugin/ucstyleditembase.cpp (+5/-8) src/Ubuntu/Components/plugin/ucstyleditembase_p.h (+1/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py (+1/-0) tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py (+5/-3) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py (+1/-10) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_ubuntulistview.py (+2/-11) tests/unit_x11/tst_components/tst_adaptivepagelayout.qml (+127/-108) tests/unit_x11/tst_subtheming/tst_subtheming.cpp (+2/-28) |
||||
To merge this branch: | bzr merge lp:~bzoltan/ubuntu-ui-toolkit/landing-2015-10-06 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu SDK team | Pending | ||
Review via email: mp+273506@code.launchpad.net |
Commit message
Fix Ubuntu System Setting application and the UITK AP tests
Description of the change
Fix Ubuntu System Setting application and the UITK AP tests
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2015-10-02 16:32:27 +0000 | |||
3 | +++ debian/changelog 2015-10-06 09:05:14 +0000 | |||
4 | @@ -1,3 +1,16 @@ | |||
5 | 1 | ubuntu-ui-toolkit (1.3.1676+15.10.20151006.1-0ubuntu1) UNRELEASED; urgency=medium | ||
6 | 2 | |||
7 | 3 | [ Zsombor Egri ] | ||
8 | 4 | * StyledItem does no longer fall back to 1.2 style loading on mixed import | ||
9 | 5 | versions. | ||
10 | 6 | * Make primaryPage and primaryPageSource replaceable after component | ||
11 | 7 | completion. Fixes LP: #1500934 | ||
12 | 8 | |||
13 | 9 | [ Christian Dywan ] | ||
14 | 10 | * Merge open_page and _open_page in GalleryTestCase. | ||
15 | 11 | |||
16 | 12 | -- Zoltán Balogh <zoltan@bakter.hu> Tue, 06 Oct 2015 12:01:56 +0300 | ||
17 | 13 | |||
18 | 1 | ubuntu-ui-toolkit (1.3.1672+15.10.20151002.1-0ubuntu1) wily; urgency=medium | 14 | ubuntu-ui-toolkit (1.3.1672+15.10.20151002.1-0ubuntu1) wily; urgency=medium |
19 | 2 | 15 | ||
20 | 3 | [ Tim Peeters ] | 16 | [ Tim Peeters ] |
21 | 4 | 17 | ||
22 | === modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml' | |||
23 | --- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-09-30 09:46:03 +0000 | |||
24 | +++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-06 09:05:14 +0000 | |||
25 | @@ -42,13 +42,11 @@ | |||
26 | 42 | add the page to the leftmost column of the view. | 42 | add the page to the leftmost column of the view. |
27 | 43 | 43 | ||
28 | 44 | The primary page, the very first page must be specified either through the | 44 | The primary page, the very first page must be specified either through the |
36 | 45 | \l primaryPage or \l primaryPageSource properties. The properties cannot be | 45 | \l primaryPage or \l primaryPageSource properties. \l primaryPage can only |
37 | 46 | changed after component completion. \l primaryPage can only hold a Page instance, | 46 | hold a Page instance, \l primaryPageSource can either be a Component or a |
38 | 47 | \l primaryPageSource can either be a Component or a url to a document defining | 47 | url to a document defining a Page. \l primaryPageSource has precedence over |
39 | 48 | a Page. This page cannot be removed from the view. \l primaryPageSource has | 48 | \l primaryPage, and when set it will report the loaded Page through \l primaryPage |
40 | 49 | precedence over \l primaryPage and will create the Page asynchronously. The | 49 | property, and will replace any value set into that property. |
34 | 50 | page instance will be reported through \l primaryPage property and will replace | ||
35 | 51 | any previous value set to that property. | ||
41 | 52 | 50 | ||
42 | 53 | \qml | 51 | \qml |
43 | 54 | import QtQuick 2.4 | 52 | import QtQuick 2.4 |
44 | @@ -188,17 +186,18 @@ | |||
45 | 188 | /*! | 186 | /*! |
46 | 189 | The property holds the first Page which will be added to the view. If the | 187 | The property holds the first Page which will be added to the view. If the |
47 | 190 | view has more than one column, the page will be added to the leftmost column. | 188 | view has more than one column, the page will be added to the leftmost column. |
50 | 191 | The property can hold only a Page instance. The property cannot be changed after | 189 | The property can only hold a Page instance. When changed runtime (not by the |
51 | 192 | component completion. | 190 | AdaptivePageLayout component itself), the \l primaryPageSource property |
52 | 191 | will be reset. | ||
53 | 193 | */ | 192 | */ |
54 | 194 | property Page primaryPage | 193 | property Page primaryPage |
55 | 195 | 194 | ||
56 | 196 | /*! | 195 | /*! |
57 | 197 | The property specifies the source of the primaryPage in case the primary | 196 | The property specifies the source of the primaryPage in case the primary |
58 | 198 | page is created from a Component or loaded from an external document. It | 197 | page is created from a Component or loaded from an external document. It |
62 | 199 | has precedence over \l primaryPage and cannot be changed after component | 198 | has precedence over \l primaryPage. The page specified in this way will |
63 | 200 | completion. The page specified in this way will be cerated asynchronously | 199 | be cerated asynchronously and the instance will be reported through |
64 | 201 | and the instance will be reported through \l primaryPage property. | 200 | \l primaryPage property. |
65 | 202 | */ | 201 | */ |
66 | 203 | property var primaryPageSource | 202 | property var primaryPageSource |
67 | 204 | 203 | ||
68 | @@ -322,12 +321,7 @@ | |||
69 | 322 | pages will be removed. | 321 | pages will be removed. |
70 | 323 | */ | 322 | */ |
71 | 324 | function removePages(page) { | 323 | function removePages(page) { |
78 | 325 | var nodeToRemove = d.getWrapper(page); | 324 | d.removeAllPages(page, page != layout.primaryPage); |
73 | 326 | var removedNodes = d.tree.chop(nodeToRemove, page != layout.primaryPage); | ||
74 | 327 | for (var i = removedNodes.length-1; i >= 0; i--) { | ||
75 | 328 | var node = removedNodes[i]; | ||
76 | 329 | d.updatePageForColumn(node.column); | ||
77 | 330 | } | ||
79 | 331 | } | 325 | } |
80 | 332 | 326 | ||
81 | 333 | /* | 327 | /* |
82 | @@ -345,26 +339,34 @@ | |||
83 | 345 | d.createPrimaryPage(primaryPageSource); | 339 | d.createPrimaryPage(primaryPageSource); |
84 | 346 | } else if (primaryPage) { | 340 | } else if (primaryPage) { |
85 | 347 | d.createPrimaryPage(primaryPage); | 341 | d.createPrimaryPage(primaryPage); |
86 | 348 | } else { | ||
87 | 349 | console.warn("No primary page set. No pages can be added without a primary page."); | ||
88 | 350 | } | 342 | } |
89 | 351 | d.completed = true; | 343 | d.completed = true; |
90 | 352 | } | 344 | } |
91 | 353 | onPrimaryPageChanged: { | 345 | onPrimaryPageChanged: { |
95 | 354 | if (d.completed && !d.internalUpdate) { | 346 | if (!d.completed || d.internalUpdate) { |
93 | 355 | console.warn("Cannot change primaryPage after completion."); | ||
94 | 356 | d.internalPropertyUpdate("primaryPage", d.lastPrimaryPage); | ||
96 | 357 | return; | 347 | return; |
97 | 358 | } | 348 | } |
99 | 359 | d.lastPrimaryPage = primaryPage; | 349 | // reset the primaryPageSource |
100 | 350 | d.internalPropertyUpdate("primaryPageSource", undefined); | ||
101 | 351 | // clear the layout | ||
102 | 352 | d.purgeLayout(); | ||
103 | 353 | // add the new page if valid | ||
104 | 354 | if (primaryPage !== null) { | ||
105 | 355 | d.createPrimaryPage(primaryPage); | ||
106 | 356 | } | ||
107 | 360 | } | 357 | } |
108 | 361 | onPrimaryPageSourceChanged: { | 358 | onPrimaryPageSourceChanged: { |
112 | 362 | if (d.completed && !d.internalUpdate) { | 359 | if (!d.completed || d.internalUpdate) { |
110 | 363 | console.warn("Cannot change primaryPageSource after completion."); | ||
111 | 364 | d.internalPropertyUpdate("primaryPageSource", d.lastPrimaryPageSource); | ||
113 | 365 | return; | 360 | return; |
114 | 366 | } | 361 | } |
116 | 367 | d.lastPrimaryPageSource = primaryPageSource; | 362 | // remove all pages first |
117 | 363 | d.purgeLayout(); | ||
118 | 364 | // create the new primary page if a valid component is specified | ||
119 | 365 | if (primaryPageSource) { | ||
120 | 366 | d.createPrimaryPage(primaryPageSource); | ||
121 | 367 | } else { | ||
122 | 368 | d.internalPropertyUpdate("primaryPage", null); | ||
123 | 369 | } | ||
124 | 368 | } | 370 | } |
125 | 369 | 371 | ||
126 | 370 | onLayoutsChanged: { | 372 | onLayoutsChanged: { |
127 | @@ -389,8 +391,7 @@ | |||
128 | 389 | (activeLayout ? activeLayout.data.length : 1) | 391 | (activeLayout ? activeLayout.data.length : 1) |
129 | 390 | property PageColumnsLayout activeLayout: null | 392 | property PageColumnsLayout activeLayout: null |
130 | 391 | property list<PageColumnsLayout> prevLayouts | 393 | property list<PageColumnsLayout> prevLayouts |
133 | 392 | property Page lastPrimaryPage | 394 | property Page prevPrimaryPage |
132 | 393 | property var lastPrimaryPageSource | ||
134 | 394 | 395 | ||
135 | 395 | /*! internal */ | 396 | /*! internal */ |
136 | 396 | onColumnsChanged: { | 397 | onColumnsChanged: { |
137 | @@ -416,10 +417,20 @@ | |||
138 | 416 | wrapper.incubator.onStatusChanged = function (status) { | 417 | wrapper.incubator.onStatusChanged = function (status) { |
139 | 417 | if (status == Component.Ready) { | 418 | if (status == Component.Ready) { |
140 | 418 | internalPropertyUpdate("primaryPage", wrapper.incubator.object); | 419 | internalPropertyUpdate("primaryPage", wrapper.incubator.object); |
141 | 420 | prevPrimaryPage = wrapper.incubator.object; | ||
142 | 419 | } | 421 | } |
143 | 420 | } | 422 | } |
144 | 421 | } else { | 423 | } else { |
145 | 422 | finalizeAddingPage(wrapper); | 424 | finalizeAddingPage(wrapper); |
146 | 425 | prevPrimaryPage = wrapper.object; | ||
147 | 426 | } | ||
148 | 427 | } | ||
149 | 428 | |||
150 | 429 | // remove all pages, including primaryPage | ||
151 | 430 | function purgeLayout() { | ||
152 | 431 | if (prevPrimaryPage) { | ||
153 | 432 | removeAllPages(prevPrimaryPage, true); | ||
154 | 433 | prevPrimaryPage = null; | ||
155 | 423 | } | 434 | } |
156 | 424 | } | 435 | } |
157 | 425 | 436 | ||
158 | @@ -514,6 +525,17 @@ | |||
159 | 514 | return newWrapper.incubator; | 525 | return newWrapper.incubator; |
160 | 515 | } | 526 | } |
161 | 516 | 527 | ||
162 | 528 | // removes all pages from the layout, and may include the page itself | ||
163 | 529 | function removeAllPages(page, inclusive) { | ||
164 | 530 | inclusive = typeof inclusive !== 'undefined' ? inclusive : true; | ||
165 | 531 | var nodeToRemove = d.getWrapper(page); | ||
166 | 532 | var removedNodes = d.tree.chop(nodeToRemove, inclusive); | ||
167 | 533 | for (var i = removedNodes.length-1; i >= 0; i--) { | ||
168 | 534 | var node = removedNodes[i]; | ||
169 | 535 | updatePageForColumn(node.column); | ||
170 | 536 | } | ||
171 | 537 | } | ||
172 | 538 | |||
173 | 517 | // update the page for the specified column | 539 | // update the page for the specified column |
174 | 518 | function updatePageForColumn(column) { | 540 | function updatePageForColumn(column) { |
175 | 519 | var effectiveColumn = MathUtils.clamp(column, 0, d.columns - 1); | 541 | var effectiveColumn = MathUtils.clamp(column, 0, d.columns - 1); |
176 | 520 | 542 | ||
177 | === modified file 'src/Ubuntu/Components/plugin/ucstyleditembase.cpp' | |||
178 | --- src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-09-28 07:06:36 +0000 | |||
179 | +++ src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-10-06 09:05:14 +0000 | |||
180 | @@ -28,6 +28,7 @@ | |||
181 | 28 | UCStyledItemBasePrivate::UCStyledItemBasePrivate() | 28 | UCStyledItemBasePrivate::UCStyledItemBasePrivate() |
182 | 29 | : styleComponent(Q_NULLPTR) | 29 | : styleComponent(Q_NULLPTR) |
183 | 30 | , styleItem(Q_NULLPTR) | 30 | , styleItem(Q_NULLPTR) |
184 | 31 | , styleVersion(LATEST_UITK_VERSION) | ||
185 | 31 | , activeFocusOnPress(false) | 32 | , activeFocusOnPress(false) |
186 | 32 | , wasStyleLoaded(false) | 33 | , wasStyleLoaded(false) |
187 | 33 | { | 34 | { |
188 | @@ -307,7 +308,7 @@ | |||
189 | 307 | // either styleComponent or styleName is valid | 308 | // either styleComponent or styleName is valid |
190 | 308 | QQmlComponent *component = styleComponent; | 309 | QQmlComponent *component = styleComponent; |
191 | 309 | if (!component) { | 310 | if (!component) { |
193 | 310 | component = getTheme()->createStyleComponent(styleDocument + ".qml", q); | 311 | component = getTheme()->createStyleComponent(styleDocument + ".qml", q, styleVersion); |
194 | 311 | } | 312 | } |
195 | 312 | if (!component) { | 313 | if (!component) { |
196 | 313 | return false; | 314 | return false; |
197 | @@ -473,13 +474,9 @@ | |||
198 | 473 | QQmlPropertyData *pdata = QQmlPropertyCache::property(qmlEngine(this), this, QStringLiteral("theme"), cdata, l); | 474 | QQmlPropertyData *pdata = QQmlPropertyCache::property(qmlEngine(this), this, QStringLiteral("theme"), cdata, l); |
199 | 474 | // FIXME MainView internal styler uses theme property, meaning imports13 will be true, | 475 | // FIXME MainView internal styler uses theme property, meaning imports13 will be true, |
200 | 475 | // therefore we must check the type of the property as well in case anyone else overrides it | 476 | // therefore we must check the type of the property as well in case anyone else overrides it |
208 | 476 | bool imports13 = data->propertyCache->isAllowedInRevision(pdata) && (property("theme").type() != QVariant::String); | 477 | d->styleVersion = data->propertyCache->isAllowedInRevision(pdata) && (property("theme").type() != QVariant::String) |
209 | 477 | if (!imports13) { | 478 | ? BUILD_VERSION(1, 3) |
210 | 478 | // load 1.2 theme | 479 | : BUILD_VERSION(1, 2); |
204 | 479 | UCTheme *theme = d->getTheme(); | ||
205 | 480 | // FIXME: override the global theme version to be used when creating new themes! | ||
206 | 481 | theme->setVersion(BUILD_VERSION(1, 2)); | ||
207 | 482 | } | ||
211 | 483 | // no animation at this time | 480 | // no animation at this time |
212 | 484 | // prepare style context if not been done yet | 481 | // prepare style context if not been done yet |
213 | 485 | d->postStyleChanged(); | 482 | d->postStyleChanged(); |
214 | 486 | 483 | ||
215 | === modified file 'src/Ubuntu/Components/plugin/ucstyleditembase_p.h' | |||
216 | --- src/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-09-21 11:40:22 +0000 | |||
217 | +++ src/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-10-06 09:05:14 +0000 | |||
218 | @@ -64,6 +64,7 @@ | |||
219 | 64 | QString styleDocument; | 64 | QString styleDocument; |
220 | 65 | QQmlComponent *styleComponent; | 65 | QQmlComponent *styleComponent; |
221 | 66 | QQuickItem *styleItem; | 66 | QQuickItem *styleItem; |
222 | 67 | quint16 styleVersion; | ||
223 | 67 | bool activeFocusOnPress:1; | 68 | bool activeFocusOnPress:1; |
224 | 68 | bool wasStyleLoaded:1; | 69 | bool wasStyleLoaded:1; |
225 | 69 | 70 | ||
226 | 70 | 71 | ||
227 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py' | |||
228 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2015-05-05 17:20:27 +0000 | |||
229 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2015-10-06 09:05:14 +0000 | |||
230 | @@ -53,6 +53,7 @@ | |||
231 | 53 | element = self._find_element(object_name, direction) | 53 | element = self._find_element(object_name, direction) |
232 | 54 | self.swipe_child_into_view(element) | 54 | self.swipe_child_into_view(element) |
233 | 55 | self.pointing_device.click_object(element) | 55 | self.pointing_device.click_object(element) |
234 | 56 | return element | ||
235 | 56 | 57 | ||
236 | 57 | @autopilot_logging.log_action(logger.info) | 58 | @autopilot_logging.log_action(logger.info) |
237 | 58 | def _find_element(self, object_name, direction=None): | 59 | def _find_element(self, object_name, direction=None): |
238 | 59 | 60 | ||
239 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py' | |||
240 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2015-09-29 18:31:46 +0000 | |||
241 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2015-10-06 09:05:14 +0000 | |||
242 | @@ -129,9 +129,11 @@ | |||
243 | 129 | 129 | ||
244 | 130 | """ | 130 | """ |
245 | 131 | list_view = self.main_view.select_single(objectName="widgetList") | 131 | list_view = self.main_view.select_single(objectName="widgetList") |
249 | 132 | list_view.click_element(page) | 132 | element = list_view.click_element(page) |
250 | 133 | element = self.main_view.select_single('Standard', objectName=page) | 133 | # Do not check the ListItem's highlight |
251 | 134 | element.selected.wait_for(True) | 134 | # the actual highlight is implemented in the UbuntuListView |
252 | 135 | self.checkPageHeader(element.text) | ||
253 | 136 | return element | ||
254 | 135 | 137 | ||
255 | 136 | def tearDown(self): | 138 | def tearDown(self): |
256 | 137 | super().tearDown() | 139 | super().tearDown() |
257 | 138 | 140 | ||
258 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py' | |||
259 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2015-09-23 10:53:59 +0000 | |||
260 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2015-10-06 09:05:14 +0000 | |||
261 | @@ -109,13 +109,4 @@ | |||
262 | 109 | 109 | ||
263 | 110 | def test_open_page(self): | 110 | def test_open_page(self): |
264 | 111 | self.open_page(self.element_name) | 111 | self.open_page(self.element_name) |
275 | 112 | element = self.main_view.select_single( | 112 | self.main_view.wait_select_single(objectName=self.template_name) |
266 | 113 | 'Standard', objectName=self.element_name) | ||
267 | 114 | self.checkPageHeader(element.text) | ||
268 | 115 | if self.template_name == 'textinputsTemplate': | ||
269 | 116 | page_type = 'TextInputs' | ||
270 | 117 | else: | ||
271 | 118 | page_type = 'Template' | ||
272 | 119 | self.main_view.wait_select_single( | ||
273 | 120 | page_type, objectName=self.template_name) | ||
274 | 121 | # TODO check that the template is visible. --elopio - 2013-11-28 | ||
276 | 122 | 113 | ||
277 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_ubuntulistview.py' | |||
278 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_ubuntulistview.py 2015-09-29 18:31:46 +0000 | |||
279 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_ubuntulistview.py 2015-10-06 09:05:14 +0000 | |||
280 | @@ -16,24 +16,15 @@ | |||
281 | 16 | 16 | ||
282 | 17 | """Tests for the Ubuntu UI Toolkit Gallery - UbuntuListView component.""" | 17 | """Tests for the Ubuntu UI Toolkit Gallery - UbuntuListView component.""" |
283 | 18 | 18 | ||
284 | 19 | import ubuntuuitoolkit | ||
285 | 20 | from ubuntuuitoolkit.tests.gallery import GalleryTestCase | 19 | from ubuntuuitoolkit.tests.gallery import GalleryTestCase |
286 | 21 | 20 | ||
287 | 22 | 21 | ||
288 | 23 | class UbuntuListViewTestCase(GalleryTestCase): | 22 | class UbuntuListViewTestCase(GalleryTestCase): |
289 | 24 | 23 | ||
290 | 25 | def _open_page(self): | 24 | def _open_page(self): |
300 | 26 | list_view = self.main_view.wait_select_single(objectName="widgetList") | 25 | super().open_page('ubuntuListViewElement') |
292 | 27 | list_view.click_element("ubuntuListViewElement") | ||
293 | 28 | element = self.main_view.select_single( | ||
294 | 29 | objectName="ubuntuListViewElement") | ||
295 | 30 | # Do not check the ListItem's highlight | ||
296 | 31 | # the actual highlight is implemented in the UbuntuListView | ||
297 | 32 | self.checkPageHeader(element.text) | ||
298 | 33 | self.main_view.wait_select_single( | ||
299 | 34 | "Template", objectName="ubuntuListViewTemplate") | ||
301 | 35 | self.listView = self.main_view.select_single( | 26 | self.listView = self.main_view.select_single( |
303 | 36 | ubuntuuitoolkit.UbuntuListView11, objectName="ubuntuListView") | 27 | objectName="ubuntuListView") |
304 | 37 | 28 | ||
305 | 38 | def test_pull_to_refresh_enabled(self): | 29 | def test_pull_to_refresh_enabled(self): |
306 | 39 | self._open_page() | 30 | self._open_page() |
307 | 40 | 31 | ||
308 | === modified file 'tests/unit_x11/tst_components/tst_adaptivepagelayout.qml' | |||
309 | --- tests/unit_x11/tst_components/tst_adaptivepagelayout.qml 2015-09-29 10:37:46 +0000 | |||
310 | +++ tests/unit_x11/tst_components/tst_adaptivepagelayout.qml 2015-10-06 09:05:14 +0000 | |||
311 | @@ -27,83 +27,79 @@ | |||
312 | 27 | // 2 on desktop, 1 on phone. | 27 | // 2 on desktop, 1 on phone. |
313 | 28 | property int columns: width >= units.gu(80) ? 2 : 1 | 28 | property int columns: width >= units.gu(80) ? 2 : 1 |
314 | 29 | 29 | ||
355 | 30 | AdaptivePageLayout { | 30 | Column { |
356 | 31 | id: layout | 31 | anchors.fill: parent |
357 | 32 | width: parent.width | 32 | AdaptivePageLayout { |
358 | 33 | height: parent.height | 33 | id: layout |
359 | 34 | 34 | width: parent.width | |
360 | 35 | primaryPage: page1 | 35 | height: parent.height / 2 |
361 | 36 | 36 | ||
362 | 37 | Page { | 37 | primaryPage: page1 |
363 | 38 | id: page1 | 38 | |
364 | 39 | title: "Page1" | 39 | Page { |
365 | 40 | 40 | id: page1 | |
366 | 41 | Column { | 41 | objectName: title |
367 | 42 | anchors.centerIn: parent | 42 | title: "Page1" |
368 | 43 | width: childrenRect.width | 43 | |
369 | 44 | Button { | 44 | Column { |
370 | 45 | text: "Page 2 left" | 45 | anchors.centerIn: parent |
371 | 46 | onTriggered: layout.addPageToCurrentColumn(page1, page2) | 46 | width: childrenRect.width |
372 | 47 | } | 47 | Button { |
373 | 48 | Button { | 48 | text: "Page 2 left" |
374 | 49 | text: "Page 3 right" | 49 | onTriggered: layout.addPageToCurrentColumn(page1, page2) |
375 | 50 | onTriggered: layout.addPageToNextColumn(page1, page3); | 50 | } |
376 | 51 | } | 51 | Button { |
377 | 52 | } | 52 | text: "Page 3 right" |
378 | 53 | } | 53 | onTriggered: layout.addPageToNextColumn(page1, page3); |
379 | 54 | Page { | 54 | } |
380 | 55 | id: page2 | 55 | } |
381 | 56 | title: "Page2" | 56 | } |
382 | 57 | } | 57 | Page { |
383 | 58 | Page { | 58 | id: page2 |
384 | 59 | id: page3 | 59 | objectName: title |
385 | 60 | title: "Page3" | 60 | title: "Page2" |
386 | 61 | } | 61 | } |
387 | 62 | Page { | 62 | Page { |
388 | 63 | id: page4 | 63 | id: page3 |
389 | 64 | title: "Page4" | 64 | objectName: title |
390 | 65 | } | 65 | title: "Page3" |
391 | 66 | } | 66 | } |
392 | 67 | 67 | Page { | |
393 | 68 | AdaptivePageLayout { | 68 | id: page4 |
394 | 69 | id: defaults | 69 | objectName: title |
395 | 70 | title: "Page4" | ||
396 | 71 | } | ||
397 | 72 | } | ||
398 | 73 | AdaptivePageLayout { | ||
399 | 74 | id: defaults | ||
400 | 75 | width: parent.width | ||
401 | 76 | height: parent.height / 2 | ||
402 | 77 | Page { | ||
403 | 78 | id: otherPage1 | ||
404 | 79 | objectName: title | ||
405 | 80 | title: "Page1" | ||
406 | 81 | } | ||
407 | 82 | Page { | ||
408 | 83 | id: otherPage2 | ||
409 | 84 | objectName: title | ||
410 | 85 | title: "Page2" | ||
411 | 86 | } | ||
412 | 87 | Page { | ||
413 | 88 | id: otherPage3 | ||
414 | 89 | objectName: title | ||
415 | 90 | title: "Page3" | ||
416 | 91 | } | ||
417 | 92 | } | ||
418 | 70 | } | 93 | } |
419 | 71 | 94 | ||
420 | 72 | Component { | 95 | Component { |
421 | 73 | id: pageComponent | 96 | id: pageComponent |
422 | 74 | Page { | 97 | Page { |
423 | 98 | objectName: title | ||
424 | 75 | title: "DynamicPage" | 99 | title: "DynamicPage" |
425 | 76 | } | 100 | } |
426 | 77 | } | 101 | } |
427 | 78 | 102 | ||
428 | 79 | Component { | ||
429 | 80 | id: aplComponent | ||
430 | 81 | AdaptivePageLayout { | ||
431 | 82 | width: units.gu(40) | ||
432 | 83 | height: units.gu(50) | ||
433 | 84 | primaryPageSource: pageComponent | ||
434 | 85 | } | ||
435 | 86 | } | ||
436 | 87 | |||
437 | 88 | Component { | ||
438 | 89 | id: aplDocument | ||
439 | 90 | AdaptivePageLayout { | ||
440 | 91 | width: units.gu(40) | ||
441 | 92 | height: units.gu(50) | ||
442 | 93 | primaryPageSource: Qt.resolvedUrl("MyExternalPage.qml") | ||
443 | 94 | } | ||
444 | 95 | } | ||
445 | 96 | |||
446 | 97 | Component { | ||
447 | 98 | id: aplPrecedence | ||
448 | 99 | AdaptivePageLayout { | ||
449 | 100 | width: units.gu(40) | ||
450 | 101 | height: units.gu(50) | ||
451 | 102 | primaryPage: page1 | ||
452 | 103 | primaryPageSource: Qt.resolvedUrl("MyExternalPage.qml") | ||
453 | 104 | } | ||
454 | 105 | } | ||
455 | 106 | |||
456 | 107 | UbuntuTestCase { | 103 | UbuntuTestCase { |
457 | 108 | id: testCase | 104 | id: testCase |
458 | 109 | when: windowShown | 105 | when: windowShown |
459 | @@ -115,6 +111,10 @@ | |||
460 | 115 | target: testCase | 111 | target: testCase |
461 | 116 | signalName: "pageLoaded" | 112 | signalName: "pageLoaded" |
462 | 117 | } | 113 | } |
463 | 114 | SignalSpy { | ||
464 | 115 | id: primaryPageSpy | ||
465 | 116 | signalName: "primaryPageChanged" | ||
466 | 117 | } | ||
467 | 118 | 118 | ||
468 | 119 | function resize_single_column() { | 119 | function resize_single_column() { |
469 | 120 | layout.width = units.gu(40); | 120 | layout.width = units.gu(40); |
470 | @@ -135,29 +135,38 @@ | |||
471 | 135 | return apl.__d.getWrapper(page); | 135 | return apl.__d.getWrapper(page); |
472 | 136 | } | 136 | } |
473 | 137 | 137 | ||
474 | 138 | function findPageFromLayout(apl, objectName) { | ||
475 | 139 | var body = findChild(apl, "body"); | ||
476 | 140 | verify(body); | ||
477 | 141 | return findChild(body, objectName); | ||
478 | 142 | } | ||
479 | 143 | |||
480 | 138 | function cleanup() { | 144 | function cleanup() { |
481 | 139 | page1.title = "Page1"; | 145 | page1.title = "Page1"; |
482 | 140 | page2.title = "Page2"; | 146 | page2.title = "Page2"; |
483 | 141 | page3.title = "Page3"; | 147 | page3.title = "Page3"; |
484 | 142 | page4.title = "Page4"; | 148 | page4.title = "Page4"; |
485 | 143 | loadedSpy.clear(); | 149 | loadedSpy.clear(); |
486 | 150 | primaryPageSpy.clear(); | ||
487 | 151 | primaryPageSpy.target = null; | ||
488 | 144 | resize_multiple_columns(); | 152 | resize_multiple_columns(); |
490 | 145 | layout.removePages(page1); | 153 | layout.removePages(layout.primaryPage); |
491 | 154 | defaults.primaryPage = null; | ||
492 | 155 | wait(200); | ||
493 | 146 | } | 156 | } |
494 | 147 | 157 | ||
495 | 148 | function initTestCase() { | 158 | function initTestCase() { |
496 | 149 | compare(defaults.primaryPage, null, "primaryPage not null by default"); | 159 | compare(defaults.primaryPage, null, "primaryPage not null by default"); |
497 | 150 | compare(defaults.primaryPageSource, undefined, "primaryPageSource not set by default"); | 160 | compare(defaults.primaryPageSource, undefined, "primaryPageSource not set by default"); |
498 | 151 | compare(defaults.layouts.length, 0, "no layouts by default"); | 161 | compare(defaults.layouts.length, 0, "no layouts by default"); |
500 | 152 | compare(defaults.columns, 1, "1 column as default"); | 162 | compare(defaults.columns, columns, columns + " column(s) as default"); |
501 | 153 | } | 163 | } |
502 | 154 | 164 | ||
503 | 155 | function test_change_primaryPage() { | 165 | function test_change_primaryPage() { |
509 | 156 | // this prints the warning but still changes the primary page, | 166 | defaults.primaryPage = otherPage1; |
510 | 157 | // so the test must be executed last not to mess up the other tests. | 167 | defaults.addPageToCurrentColumn(defaults.primaryPage, otherPage2); |
511 | 158 | ignoreWarning("Cannot change primaryPage after completion."); | 168 | defaults.primaryPage = otherPage3; |
512 | 159 | layout.primaryPage = page3; | 169 | verify(!findPageFromLayout(defaults, "Page2"), "Page2 still in the view!"); |
508 | 160 | verify(layout.primaryPage != page3, "primaryPage value was changed"); | ||
513 | 161 | } | 170 | } |
514 | 162 | 171 | ||
515 | 163 | function test_add_page_when_source_page_not_in_stack() { | 172 | function test_add_page_when_source_page_not_in_stack() { |
516 | @@ -333,10 +342,10 @@ | |||
517 | 333 | } | 342 | } |
518 | 334 | 343 | ||
519 | 335 | var testPage = testHolder.pageWrapper.object; | 344 | var testPage = testHolder.pageWrapper.object; |
521 | 336 | var prevPageActive = false | 345 | var prevPageActive = false; |
522 | 337 | var incubator = data.nextColumn | 346 | var incubator = data.nextColumn |
523 | 338 | ? layout.addPageToNextColumn(data.sourcePage, data.page) | 347 | ? layout.addPageToNextColumn(data.sourcePage, data.page) |
525 | 339 | : layout.addPageToCurrentColumn(data.sourcePage, data.page);; | 348 | : layout.addPageToCurrentColumn(data.sourcePage, data.page); |
526 | 340 | verify(incubator); | 349 | verify(incubator); |
527 | 341 | compare(testHolder.pageWrapper.object, testPage); | 350 | compare(testHolder.pageWrapper.object, testPage); |
528 | 342 | incubator.onStatusChanged = function (status) { | 351 | incubator.onStatusChanged = function (status) { |
529 | @@ -351,48 +360,58 @@ | |||
530 | 351 | 360 | ||
531 | 352 | function test_primaryPageSource_bug1499179_data() { | 361 | function test_primaryPageSource_bug1499179_data() { |
532 | 353 | return [ | 362 | return [ |
535 | 354 | {tag: "Component", test: aplComponent}, | 363 | {tag: "Component", test: pageComponent}, |
536 | 355 | {tag: "Document", test: aplDocument}, | 364 | {tag: "Document", test: Qt.resolvedUrl("MyExternalPage.qml")}, |
537 | 356 | ]; | 365 | ]; |
538 | 357 | } | 366 | } |
539 | 358 | function test_primaryPageSource_bug1499179(data) { | 367 | function test_primaryPageSource_bug1499179(data) { |
545 | 359 | var apl = data.test.createObject(root); | 368 | primaryPageSpy.target = defaults; |
546 | 360 | verify(apl); | 369 | defaults.primaryPageSource = data.test; |
547 | 361 | tryCompareFunction(function () { return apl.primaryPage != null }, true, 1500); | 370 | primaryPageSpy.wait(); |
543 | 362 | apl.visible = false; | ||
544 | 363 | apl = null; | ||
548 | 364 | } | 371 | } |
549 | 365 | 372 | ||
551 | 366 | function test_primaryPageSource_not_set_twice_data() { | 373 | function test_change_primaryPageSource_data() { |
552 | 367 | return [ | 374 | return [ |
555 | 368 | {tag: "Component", test: aplComponent, nextValue: null}, | 375 | {tag: "Component", test: pageComponent, nextValue: Qt.resolvedUrl("MyExternalPage.qml")}, |
556 | 369 | {tag: "Document", test: aplDocument, nextValue: null}, | 376 | {tag: "Document", test: Qt.resolvedUrl("MyExternalPage.qml"), nextValue: pageComponent}, |
557 | 370 | ]; | 377 | ]; |
558 | 371 | } | 378 | } |
573 | 372 | function test_primaryPageSource_not_set_twice(data) { | 379 | function test_change_primaryPageSource(data) { |
574 | 373 | var apl = data.test.createObject(root); | 380 | primaryPageSpy.target = defaults; |
575 | 374 | verify(apl); | 381 | verify(defaults.primaryPage == null); |
576 | 375 | tryCompareFunction(function () { return apl.primaryPage != null }, true, 1500); | 382 | verify(defaults.primaryPageSource == undefined); |
577 | 376 | ignoreWarning("Cannot change primaryPageSource after completion."); | 383 | defaults.primaryPageSource = data.test; |
578 | 377 | apl.primaryPageSource = data.nextValue; | 384 | primaryPageSpy.wait(400); |
579 | 378 | verify(apl.primaryPageSource != data.nextValue, "property value changed!"); | 385 | // add some pages |
580 | 379 | apl.visible = false; | 386 | defaults.addPageToCurrentColumn(defaults.primaryPage, otherPage2); |
581 | 380 | apl = null; | 387 | // then replace the primaryPageSource |
582 | 381 | } | 388 | primaryPageSpy.clear(); |
583 | 382 | 389 | defaults.primaryPageSource = data.nextValue; | |
584 | 383 | SignalSpy { | 390 | primaryPageSpy.wait(400); |
585 | 384 | id: primaryPageSpy | 391 | // look after page2 |
586 | 385 | signalName: "primaryPageChanged" | 392 | verify(!findPageFromLayout(defaults, "Page2"), "Page2 still in the view!"); |
587 | 386 | } | 393 | } |
588 | 387 | 394 | ||
589 | 388 | function test_primaryPageSource_precedence_over_primaryPage() { | 395 | function test_primaryPageSource_precedence_over_primaryPage() { |
597 | 389 | var apl = aplPrecedence.createObject(root); | 396 | primaryPageSpy.target = defaults; |
598 | 390 | primaryPageSpy.target = apl; | 397 | defaults.primaryPage = otherPage1; |
599 | 391 | verify(apl); | 398 | primaryPageSpy.wait(400); |
600 | 392 | primaryPageSpy.wait(); | 399 | // now set a value to primaryPageSource |
601 | 393 | verify(apl.primaryPage.title != page1.title, "primaryPage has not been overloaded by primaryPageSource"); | 400 | primaryPageSpy.clear(); |
602 | 394 | apl.visible = false; | 401 | defaults.primaryPageSource = pageComponent; |
603 | 395 | apl = null; | 402 | primaryPageSpy.wait(400); |
604 | 403 | } | ||
605 | 404 | |||
606 | 405 | function test_primaryPage_change_clears_primaryPageSource() { | ||
607 | 406 | primaryPageSpy.target = defaults; | ||
608 | 407 | defaults.primaryPageSource = pageComponent; | ||
609 | 408 | primaryPageSpy.wait(400); | ||
610 | 409 | compare(defaults.primaryPage.title, "DynamicPage", "DynamicPage not set as primaryPage"); | ||
611 | 410 | // now set a value to primaryPage | ||
612 | 411 | primaryPageSpy.clear(); | ||
613 | 412 | defaults.primaryPage = otherPage1; | ||
614 | 413 | primaryPageSpy.wait(400); | ||
615 | 414 | compare(defaults.primaryPageSource, undefined, "primaryPageSource must be cleared"); | ||
616 | 396 | } | 415 | } |
617 | 397 | } | 416 | } |
618 | 398 | } | 417 | } |
619 | 399 | 418 | ||
620 | === modified file 'tests/unit_x11/tst_subtheming/tst_subtheming.cpp' | |||
621 | --- tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-09-22 13:40:32 +0000 | |||
622 | +++ tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-10-06 09:05:14 +0000 | |||
623 | @@ -636,44 +636,21 @@ | |||
624 | 636 | { | 636 | { |
625 | 637 | QTest::addColumn<QString>("document"); | 637 | QTest::addColumn<QString>("document"); |
626 | 638 | QTest::addColumn<QString>("testValue"); | 638 | QTest::addColumn<QString>("testValue"); |
627 | 639 | QTest::addColumn<int>("row"); | ||
628 | 640 | QTest::addColumn<int>("column"); | ||
629 | 641 | QTest::addColumn<QString>("warning"); | ||
630 | 642 | 639 | ||
631 | 643 | QTest::newRow("Theming version 1.2") | ||
632 | 644 | << "StyledItemV12.qml" | ||
633 | 645 | << "" | ||
634 | 646 | << 0 << 0 << ""; | ||
635 | 647 | QTest::newRow("Theming version 1.3") | 640 | QTest::newRow("Theming version 1.3") |
636 | 648 | << "StyledItemV13.qml" | 641 | << "StyledItemV13.qml" |
643 | 649 | << "version1.3" | 642 | << "version1.3"; |
638 | 650 | << 0 << 0 << ""; | ||
639 | 651 | QTest::newRow("Fall back to 1.3") | ||
640 | 652 | << "StyledItemFallback.qml" | ||
641 | 653 | << "version1.3" | ||
642 | 654 | << 19 << 1 << "QML StyledItem: Theme 'TestModule.TestTheme' has no 'TestStyle.qml' style for version 1.0, fall back to version 1.3."; | ||
644 | 655 | QTest::newRow("App theme versioned") | 643 | QTest::newRow("App theme versioned") |
645 | 656 | << "StyledItemAppThemeVersioned.qml" | 644 | << "StyledItemAppThemeVersioned.qml" |
652 | 657 | << "version1.3" | 645 | << "version1.3"; |
647 | 658 | << 0 << 0 << ""; | ||
648 | 659 | QTest::newRow("App theme fallback to non-versioned") | ||
649 | 660 | << "StyledItemAppThemeFallback.qml" | ||
650 | 661 | << "" | ||
651 | 662 | << 0 << 0 << ""; | ||
653 | 663 | } | 646 | } |
654 | 664 | void test_theme_versions() | 647 | void test_theme_versions() |
655 | 665 | { | 648 | { |
656 | 666 | QFETCH(QString, document); | 649 | QFETCH(QString, document); |
657 | 667 | QFETCH(QString, testValue); | 650 | QFETCH(QString, testValue); |
658 | 668 | QFETCH(int, row); | ||
659 | 669 | QFETCH(int, column); | ||
660 | 670 | QFETCH(QString, warning); | ||
661 | 671 | 651 | ||
662 | 672 | qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", ""); | 652 | qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", ""); |
663 | 673 | qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule"); | 653 | qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule"); |
664 | 674 | if (!warning.isEmpty()) { | ||
665 | 675 | ThemeTestCase::ignoreWarning(document, row, column, warning); | ||
666 | 676 | } | ||
667 | 677 | QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document)); | 654 | QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document)); |
668 | 678 | UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(view->rootObject()); | 655 | UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(view->rootObject()); |
669 | 679 | QVERIFY(UCStyledItemBasePrivate::get(styledItem)->styleItem); | 656 | QVERIFY(UCStyledItemBasePrivate::get(styledItem)->styleItem); |
670 | @@ -689,9 +666,6 @@ | |||
671 | 689 | qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", ""); | 666 | qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", ""); |
672 | 690 | qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule:" + m_themesPath.toLatin1()); | 667 | qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule:" + m_themesPath.toLatin1()); |
673 | 691 | QScopedPointer<ThemeTestCase> view(new ThemeTestCase("DeprecatedTheme.qml")); | 668 | QScopedPointer<ThemeTestCase> view(new ThemeTestCase("DeprecatedTheme.qml")); |
674 | 692 | // NOTE TestTheme resets the theme therefore the theming will look for the tested style version under Ambiance theme | ||
675 | 693 | // which will cause a warning; therefore we mark the warning to be ignored | ||
676 | 694 | ThemeTestCase::ignoreWarning("DeprecatedTheme.qml", 19, 1, "QML StyledItem: Theme 'Ubuntu.Components.Themes.Ambiance' has no 'OptionSelectorStyle.qml' style for version 1.0, fall back to version 1.3."); | ||
677 | 695 | } | 669 | } |
678 | 696 | 670 | ||
679 | 697 | void test_style_change_has_precedence() | 671 | void test_style_change_has_precedence() |