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