Merge lp:~bzoltan/ubuntu-ui-toolkit/landing-2015-10-06 into lp:ubuntu-ui-toolkit

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
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
=== modified file 'debian/changelog'
--- debian/changelog 2015-10-02 16:32:27 +0000
+++ debian/changelog 2015-10-06 09:05:14 +0000
@@ -1,3 +1,16 @@
1ubuntu-ui-toolkit (1.3.1676+15.10.20151006.1-0ubuntu1) UNRELEASED; urgency=medium
2
3 [ Zsombor Egri ]
4 * StyledItem does no longer fall back to 1.2 style loading on mixed import
5 versions.
6 * Make primaryPage and primaryPageSource replaceable after component
7 completion. Fixes LP: #1500934
8
9 [ Christian Dywan ]
10 * Merge open_page and _open_page in GalleryTestCase.
11
12 -- Zoltán Balogh <zoltan@bakter.hu> Tue, 06 Oct 2015 12:01:56 +0300
13
1ubuntu-ui-toolkit (1.3.1672+15.10.20151002.1-0ubuntu1) wily; urgency=medium14ubuntu-ui-toolkit (1.3.1672+15.10.20151002.1-0ubuntu1) wily; urgency=medium
215
3 [ Tim Peeters ]16 [ Tim Peeters ]
417
=== modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml'
--- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-09-30 09:46:03 +0000
+++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-06 09:05:14 +0000
@@ -42,13 +42,11 @@
42 add the page to the leftmost column of the view.42 add the page to the leftmost column of the view.
4343
44 The primary page, the very first page must be specified either through the44 The primary page, the very first page must be specified either through the
45 \l primaryPage or \l primaryPageSource properties. The properties cannot be45 \l primaryPage or \l primaryPageSource properties. \l primaryPage can only
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
47 \l primaryPageSource can either be a Component or a url to a document defining47 url to a document defining a Page. \l primaryPageSource has precedence over
48 a Page. This page cannot be removed from the view. \l primaryPageSource has48 \l primaryPage, and when set it will report the loaded Page through \l primaryPage
49 precedence over \l primaryPage and will create the Page asynchronously. The49 property, and will replace any value set into that property.
50 page instance will be reported through \l primaryPage property and will replace
51 any previous value set to that property.
5250
53 \qml51 \qml
54 import QtQuick 2.452 import QtQuick 2.4
@@ -188,17 +186,18 @@
188 /*!186 /*!
189 The property holds the first Page which will be added to the view. If the187 The property holds the first Page which will be added to the view. If the
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.
191 The property can hold only a Page instance. The property cannot be changed after189 The property can only hold a Page instance. When changed runtime (not by the
192 component completion.190 AdaptivePageLayout component itself), the \l primaryPageSource property
191 will be reset.
193 */192 */
194 property Page primaryPage193 property Page primaryPage
195194
196 /*!195 /*!
197 The property specifies the source of the primaryPage in case the primary196 The property specifies the source of the primaryPage in case the primary
198 page is created from a Component or loaded from an external document. It197 page is created from a Component or loaded from an external document. It
199 has precedence over \l primaryPage and cannot be changed after component198 has precedence over \l primaryPage. The page specified in this way will
200 completion. The page specified in this way will be cerated asynchronously199 be cerated asynchronously and the instance will be reported through
201 and the instance will be reported through \l primaryPage property.200 \l primaryPage property.
202 */201 */
203 property var primaryPageSource202 property var primaryPageSource
204203
@@ -322,12 +321,7 @@
322 pages will be removed.321 pages will be removed.
323 */322 */
324 function removePages(page) {323 function removePages(page) {
325 var nodeToRemove = d.getWrapper(page);324 d.removeAllPages(page, page != layout.primaryPage);
326 var removedNodes = d.tree.chop(nodeToRemove, page != layout.primaryPage);
327 for (var i = removedNodes.length-1; i >= 0; i--) {
328 var node = removedNodes[i];
329 d.updatePageForColumn(node.column);
330 }
331 }325 }
332326
333 /*327 /*
@@ -345,26 +339,34 @@
345 d.createPrimaryPage(primaryPageSource);339 d.createPrimaryPage(primaryPageSource);
346 } else if (primaryPage) {340 } else if (primaryPage) {
347 d.createPrimaryPage(primaryPage);341 d.createPrimaryPage(primaryPage);
348 } else {
349 console.warn("No primary page set. No pages can be added without a primary page.");
350 }342 }
351 d.completed = true;343 d.completed = true;
352 }344 }
353 onPrimaryPageChanged: {345 onPrimaryPageChanged: {
354 if (d.completed && !d.internalUpdate) {346 if (!d.completed || d.internalUpdate) {
355 console.warn("Cannot change primaryPage after completion.");
356 d.internalPropertyUpdate("primaryPage", d.lastPrimaryPage);
357 return;347 return;
358 }348 }
359 d.lastPrimaryPage = primaryPage;349 // reset the primaryPageSource
350 d.internalPropertyUpdate("primaryPageSource", undefined);
351 // clear the layout
352 d.purgeLayout();
353 // add the new page if valid
354 if (primaryPage !== null) {
355 d.createPrimaryPage(primaryPage);
356 }
360 }357 }
361 onPrimaryPageSourceChanged: {358 onPrimaryPageSourceChanged: {
362 if (d.completed && !d.internalUpdate) {359 if (!d.completed || d.internalUpdate) {
363 console.warn("Cannot change primaryPageSource after completion.");
364 d.internalPropertyUpdate("primaryPageSource", d.lastPrimaryPageSource);
365 return;360 return;
366 }361 }
367 d.lastPrimaryPageSource = primaryPageSource;362 // remove all pages first
363 d.purgeLayout();
364 // create the new primary page if a valid component is specified
365 if (primaryPageSource) {
366 d.createPrimaryPage(primaryPageSource);
367 } else {
368 d.internalPropertyUpdate("primaryPage", null);
369 }
368 }370 }
369371
370 onLayoutsChanged: {372 onLayoutsChanged: {
@@ -389,8 +391,7 @@
389 (activeLayout ? activeLayout.data.length : 1)391 (activeLayout ? activeLayout.data.length : 1)
390 property PageColumnsLayout activeLayout: null392 property PageColumnsLayout activeLayout: null
391 property list<PageColumnsLayout> prevLayouts393 property list<PageColumnsLayout> prevLayouts
392 property Page lastPrimaryPage394 property Page prevPrimaryPage
393 property var lastPrimaryPageSource
394395
395 /*! internal */396 /*! internal */
396 onColumnsChanged: {397 onColumnsChanged: {
@@ -416,10 +417,20 @@
416 wrapper.incubator.onStatusChanged = function (status) {417 wrapper.incubator.onStatusChanged = function (status) {
417 if (status == Component.Ready) {418 if (status == Component.Ready) {
418 internalPropertyUpdate("primaryPage", wrapper.incubator.object);419 internalPropertyUpdate("primaryPage", wrapper.incubator.object);
420 prevPrimaryPage = wrapper.incubator.object;
419 }421 }
420 }422 }
421 } else {423 } else {
422 finalizeAddingPage(wrapper);424 finalizeAddingPage(wrapper);
425 prevPrimaryPage = wrapper.object;
426 }
427 }
428
429 // remove all pages, including primaryPage
430 function purgeLayout() {
431 if (prevPrimaryPage) {
432 removeAllPages(prevPrimaryPage, true);
433 prevPrimaryPage = null;
423 }434 }
424 }435 }
425436
@@ -514,6 +525,17 @@
514 return newWrapper.incubator;525 return newWrapper.incubator;
515 }526 }
516527
528 // removes all pages from the layout, and may include the page itself
529 function removeAllPages(page, inclusive) {
530 inclusive = typeof inclusive !== 'undefined' ? inclusive : true;
531 var nodeToRemove = d.getWrapper(page);
532 var removedNodes = d.tree.chop(nodeToRemove, inclusive);
533 for (var i = removedNodes.length-1; i >= 0; i--) {
534 var node = removedNodes[i];
535 updatePageForColumn(node.column);
536 }
537 }
538
517 // update the page for the specified column539 // update the page for the specified column
518 function updatePageForColumn(column) {540 function updatePageForColumn(column) {
519 var effectiveColumn = MathUtils.clamp(column, 0, d.columns - 1);541 var effectiveColumn = MathUtils.clamp(column, 0, d.columns - 1);
520542
=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase.cpp'
--- src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-09-28 07:06:36 +0000
+++ src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-10-06 09:05:14 +0000
@@ -28,6 +28,7 @@
28UCStyledItemBasePrivate::UCStyledItemBasePrivate()28UCStyledItemBasePrivate::UCStyledItemBasePrivate()
29 : styleComponent(Q_NULLPTR)29 : styleComponent(Q_NULLPTR)
30 , styleItem(Q_NULLPTR)30 , styleItem(Q_NULLPTR)
31 , styleVersion(LATEST_UITK_VERSION)
31 , activeFocusOnPress(false)32 , activeFocusOnPress(false)
32 , wasStyleLoaded(false)33 , wasStyleLoaded(false)
33{34{
@@ -307,7 +308,7 @@
307 // either styleComponent or styleName is valid308 // either styleComponent or styleName is valid
308 QQmlComponent *component = styleComponent;309 QQmlComponent *component = styleComponent;
309 if (!component) {310 if (!component) {
310 component = getTheme()->createStyleComponent(styleDocument + ".qml", q);311 component = getTheme()->createStyleComponent(styleDocument + ".qml", q, styleVersion);
311 }312 }
312 if (!component) {313 if (!component) {
313 return false;314 return false;
@@ -473,13 +474,9 @@
473 QQmlPropertyData *pdata = QQmlPropertyCache::property(qmlEngine(this), this, QStringLiteral("theme"), cdata, l);474 QQmlPropertyData *pdata = QQmlPropertyCache::property(qmlEngine(this), this, QStringLiteral("theme"), cdata, l);
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,
475 // therefore we must check the type of the property as well in case anyone else overrides it476 // therefore we must check the type of the property as well in case anyone else overrides it
476 bool imports13 = data->propertyCache->isAllowedInRevision(pdata) && (property("theme").type() != QVariant::String);477 d->styleVersion = data->propertyCache->isAllowedInRevision(pdata) && (property("theme").type() != QVariant::String)
477 if (!imports13) {478 ? BUILD_VERSION(1, 3)
478 // load 1.2 theme479 : BUILD_VERSION(1, 2);
479 UCTheme *theme = d->getTheme();
480 // FIXME: override the global theme version to be used when creating new themes!
481 theme->setVersion(BUILD_VERSION(1, 2));
482 }
483 // no animation at this time480 // no animation at this time
484 // prepare style context if not been done yet481 // prepare style context if not been done yet
485 d->postStyleChanged();482 d->postStyleChanged();
486483
=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase_p.h'
--- src/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-09-21 11:40:22 +0000
+++ src/Ubuntu/Components/plugin/ucstyleditembase_p.h 2015-10-06 09:05:14 +0000
@@ -64,6 +64,7 @@
64 QString styleDocument;64 QString styleDocument;
65 QQmlComponent *styleComponent;65 QQmlComponent *styleComponent;
66 QQuickItem *styleItem;66 QQuickItem *styleItem;
67 quint16 styleVersion;
67 bool activeFocusOnPress:1;68 bool activeFocusOnPress:1;
68 bool wasStyleLoaded:1;69 bool wasStyleLoaded:1;
6970
7071
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2015-05-05 17:20:27 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2015-10-06 09:05:14 +0000
@@ -53,6 +53,7 @@
53 element = self._find_element(object_name, direction)53 element = self._find_element(object_name, direction)
54 self.swipe_child_into_view(element)54 self.swipe_child_into_view(element)
55 self.pointing_device.click_object(element)55 self.pointing_device.click_object(element)
56 return element
5657
57 @autopilot_logging.log_action(logger.info)58 @autopilot_logging.log_action(logger.info)
58 def _find_element(self, object_name, direction=None):59 def _find_element(self, object_name, direction=None):
5960
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2015-09-29 18:31:46 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2015-10-06 09:05:14 +0000
@@ -129,9 +129,11 @@
129129
130 """130 """
131 list_view = self.main_view.select_single(objectName="widgetList")131 list_view = self.main_view.select_single(objectName="widgetList")
132 list_view.click_element(page)132 element = list_view.click_element(page)
133 element = self.main_view.select_single('Standard', objectName=page)133 # Do not check the ListItem's highlight
134 element.selected.wait_for(True)134 # the actual highlight is implemented in the UbuntuListView
135 self.checkPageHeader(element.text)
136 return element
135137
136 def tearDown(self):138 def tearDown(self):
137 super().tearDown()139 super().tearDown()
138140
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2015-09-23 10:53:59 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2015-10-06 09:05:14 +0000
@@ -109,13 +109,4 @@
109109
110 def test_open_page(self):110 def test_open_page(self):
111 self.open_page(self.element_name)111 self.open_page(self.element_name)
112 element = self.main_view.select_single(112 self.main_view.wait_select_single(objectName=self.template_name)
113 'Standard', objectName=self.element_name)
114 self.checkPageHeader(element.text)
115 if self.template_name == 'textinputsTemplate':
116 page_type = 'TextInputs'
117 else:
118 page_type = 'Template'
119 self.main_view.wait_select_single(
120 page_type, objectName=self.template_name)
121 # TODO check that the template is visible. --elopio - 2013-11-28
122113
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_ubuntulistview.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_ubuntulistview.py 2015-09-29 18:31:46 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_ubuntulistview.py 2015-10-06 09:05:14 +0000
@@ -16,24 +16,15 @@
1616
17"""Tests for the Ubuntu UI Toolkit Gallery - UbuntuListView component."""17"""Tests for the Ubuntu UI Toolkit Gallery - UbuntuListView component."""
1818
19import ubuntuuitoolkit
20from ubuntuuitoolkit.tests.gallery import GalleryTestCase19from ubuntuuitoolkit.tests.gallery import GalleryTestCase
2120
2221
23class UbuntuListViewTestCase(GalleryTestCase):22class UbuntuListViewTestCase(GalleryTestCase):
2423
25 def _open_page(self):24 def _open_page(self):
26 list_view = self.main_view.wait_select_single(objectName="widgetList")25 super().open_page('ubuntuListViewElement')
27 list_view.click_element("ubuntuListViewElement")
28 element = self.main_view.select_single(
29 objectName="ubuntuListViewElement")
30 # Do not check the ListItem's highlight
31 # the actual highlight is implemented in the UbuntuListView
32 self.checkPageHeader(element.text)
33 self.main_view.wait_select_single(
34 "Template", objectName="ubuntuListViewTemplate")
35 self.listView = self.main_view.select_single(26 self.listView = self.main_view.select_single(
36 ubuntuuitoolkit.UbuntuListView11, objectName="ubuntuListView")27 objectName="ubuntuListView")
3728
38 def test_pull_to_refresh_enabled(self):29 def test_pull_to_refresh_enabled(self):
39 self._open_page()30 self._open_page()
4031
=== modified file 'tests/unit_x11/tst_components/tst_adaptivepagelayout.qml'
--- tests/unit_x11/tst_components/tst_adaptivepagelayout.qml 2015-09-29 10:37:46 +0000
+++ tests/unit_x11/tst_components/tst_adaptivepagelayout.qml 2015-10-06 09:05:14 +0000
@@ -27,83 +27,79 @@
27 // 2 on desktop, 1 on phone.27 // 2 on desktop, 1 on phone.
28 property int columns: width >= units.gu(80) ? 2 : 128 property int columns: width >= units.gu(80) ? 2 : 1
2929
30 AdaptivePageLayout {30 Column {
31 id: layout31 anchors.fill: parent
32 width: parent.width32 AdaptivePageLayout {
33 height: parent.height33 id: layout
3434 width: parent.width
35 primaryPage: page135 height: parent.height / 2
3636
37 Page {37 primaryPage: page1
38 id: page138
39 title: "Page1"39 Page {
4040 id: page1
41 Column {41 objectName: title
42 anchors.centerIn: parent42 title: "Page1"
43 width: childrenRect.width43
44 Button {44 Column {
45 text: "Page 2 left"45 anchors.centerIn: parent
46 onTriggered: layout.addPageToCurrentColumn(page1, page2)46 width: childrenRect.width
47 }47 Button {
48 Button {48 text: "Page 2 left"
49 text: "Page 3 right"49 onTriggered: layout.addPageToCurrentColumn(page1, page2)
50 onTriggered: layout.addPageToNextColumn(page1, page3);50 }
51 }51 Button {
52 }52 text: "Page 3 right"
53 }53 onTriggered: layout.addPageToNextColumn(page1, page3);
54 Page {54 }
55 id: page255 }
56 title: "Page2"56 }
57 }57 Page {
58 Page {58 id: page2
59 id: page359 objectName: title
60 title: "Page3"60 title: "Page2"
61 }61 }
62 Page {62 Page {
63 id: page463 id: page3
64 title: "Page4"64 objectName: title
65 }65 title: "Page3"
66 }66 }
6767 Page {
68 AdaptivePageLayout {68 id: page4
69 id: defaults69 objectName: title
70 title: "Page4"
71 }
72 }
73 AdaptivePageLayout {
74 id: defaults
75 width: parent.width
76 height: parent.height / 2
77 Page {
78 id: otherPage1
79 objectName: title
80 title: "Page1"
81 }
82 Page {
83 id: otherPage2
84 objectName: title
85 title: "Page2"
86 }
87 Page {
88 id: otherPage3
89 objectName: title
90 title: "Page3"
91 }
92 }
70 }93 }
7194
72 Component {95 Component {
73 id: pageComponent96 id: pageComponent
74 Page {97 Page {
98 objectName: title
75 title: "DynamicPage"99 title: "DynamicPage"
76 }100 }
77 }101 }
78102
79 Component {
80 id: aplComponent
81 AdaptivePageLayout {
82 width: units.gu(40)
83 height: units.gu(50)
84 primaryPageSource: pageComponent
85 }
86 }
87
88 Component {
89 id: aplDocument
90 AdaptivePageLayout {
91 width: units.gu(40)
92 height: units.gu(50)
93 primaryPageSource: Qt.resolvedUrl("MyExternalPage.qml")
94 }
95 }
96
97 Component {
98 id: aplPrecedence
99 AdaptivePageLayout {
100 width: units.gu(40)
101 height: units.gu(50)
102 primaryPage: page1
103 primaryPageSource: Qt.resolvedUrl("MyExternalPage.qml")
104 }
105 }
106
107 UbuntuTestCase {103 UbuntuTestCase {
108 id: testCase104 id: testCase
109 when: windowShown105 when: windowShown
@@ -115,6 +111,10 @@
115 target: testCase111 target: testCase
116 signalName: "pageLoaded"112 signalName: "pageLoaded"
117 }113 }
114 SignalSpy {
115 id: primaryPageSpy
116 signalName: "primaryPageChanged"
117 }
118118
119 function resize_single_column() {119 function resize_single_column() {
120 layout.width = units.gu(40);120 layout.width = units.gu(40);
@@ -135,29 +135,38 @@
135 return apl.__d.getWrapper(page);135 return apl.__d.getWrapper(page);
136 }136 }
137137
138 function findPageFromLayout(apl, objectName) {
139 var body = findChild(apl, "body");
140 verify(body);
141 return findChild(body, objectName);
142 }
143
138 function cleanup() {144 function cleanup() {
139 page1.title = "Page1";145 page1.title = "Page1";
140 page2.title = "Page2";146 page2.title = "Page2";
141 page3.title = "Page3";147 page3.title = "Page3";
142 page4.title = "Page4";148 page4.title = "Page4";
143 loadedSpy.clear();149 loadedSpy.clear();
150 primaryPageSpy.clear();
151 primaryPageSpy.target = null;
144 resize_multiple_columns();152 resize_multiple_columns();
145 layout.removePages(page1);153 layout.removePages(layout.primaryPage);
154 defaults.primaryPage = null;
155 wait(200);
146 }156 }
147157
148 function initTestCase() {158 function initTestCase() {
149 compare(defaults.primaryPage, null, "primaryPage not null by default");159 compare(defaults.primaryPage, null, "primaryPage not null by default");
150 compare(defaults.primaryPageSource, undefined, "primaryPageSource not set by default");160 compare(defaults.primaryPageSource, undefined, "primaryPageSource not set by default");
151 compare(defaults.layouts.length, 0, "no layouts by default");161 compare(defaults.layouts.length, 0, "no layouts by default");
152 compare(defaults.columns, 1, "1 column as default");162 compare(defaults.columns, columns, columns + " column(s) as default");
153 }163 }
154164
155 function test_change_primaryPage() {165 function test_change_primaryPage() {
156 // this prints the warning but still changes the primary page,166 defaults.primaryPage = otherPage1;
157 // so the test must be executed last not to mess up the other tests.167 defaults.addPageToCurrentColumn(defaults.primaryPage, otherPage2);
158 ignoreWarning("Cannot change primaryPage after completion.");168 defaults.primaryPage = otherPage3;
159 layout.primaryPage = page3;169 verify(!findPageFromLayout(defaults, "Page2"), "Page2 still in the view!");
160 verify(layout.primaryPage != page3, "primaryPage value was changed");
161 }170 }
162171
163 function test_add_page_when_source_page_not_in_stack() {172 function test_add_page_when_source_page_not_in_stack() {
@@ -333,10 +342,10 @@
333 }342 }
334343
335 var testPage = testHolder.pageWrapper.object;344 var testPage = testHolder.pageWrapper.object;
336 var prevPageActive = false345 var prevPageActive = false;
337 var incubator = data.nextColumn346 var incubator = data.nextColumn
338 ? layout.addPageToNextColumn(data.sourcePage, data.page)347 ? layout.addPageToNextColumn(data.sourcePage, data.page)
339 : layout.addPageToCurrentColumn(data.sourcePage, data.page);;348 : layout.addPageToCurrentColumn(data.sourcePage, data.page);
340 verify(incubator);349 verify(incubator);
341 compare(testHolder.pageWrapper.object, testPage);350 compare(testHolder.pageWrapper.object, testPage);
342 incubator.onStatusChanged = function (status) {351 incubator.onStatusChanged = function (status) {
@@ -351,48 +360,58 @@
351360
352 function test_primaryPageSource_bug1499179_data() {361 function test_primaryPageSource_bug1499179_data() {
353 return [362 return [
354 {tag: "Component", test: aplComponent},363 {tag: "Component", test: pageComponent},
355 {tag: "Document", test: aplDocument},364 {tag: "Document", test: Qt.resolvedUrl("MyExternalPage.qml")},
356 ];365 ];
357 }366 }
358 function test_primaryPageSource_bug1499179(data) {367 function test_primaryPageSource_bug1499179(data) {
359 var apl = data.test.createObject(root);368 primaryPageSpy.target = defaults;
360 verify(apl);369 defaults.primaryPageSource = data.test;
361 tryCompareFunction(function () { return apl.primaryPage != null }, true, 1500);370 primaryPageSpy.wait();
362 apl.visible = false;
363 apl = null;
364 }371 }
365372
366 function test_primaryPageSource_not_set_twice_data() {373 function test_change_primaryPageSource_data() {
367 return [374 return [
368 {tag: "Component", test: aplComponent, nextValue: null},375 {tag: "Component", test: pageComponent, nextValue: Qt.resolvedUrl("MyExternalPage.qml")},
369 {tag: "Document", test: aplDocument, nextValue: null},376 {tag: "Document", test: Qt.resolvedUrl("MyExternalPage.qml"), nextValue: pageComponent},
370 ];377 ];
371 }378 }
372 function test_primaryPageSource_not_set_twice(data) {379 function test_change_primaryPageSource(data) {
373 var apl = data.test.createObject(root);380 primaryPageSpy.target = defaults;
374 verify(apl);381 verify(defaults.primaryPage == null);
375 tryCompareFunction(function () { return apl.primaryPage != null }, true, 1500);382 verify(defaults.primaryPageSource == undefined);
376 ignoreWarning("Cannot change primaryPageSource after completion.");383 defaults.primaryPageSource = data.test;
377 apl.primaryPageSource = data.nextValue;384 primaryPageSpy.wait(400);
378 verify(apl.primaryPageSource != data.nextValue, "property value changed!");385 // add some pages
379 apl.visible = false;386 defaults.addPageToCurrentColumn(defaults.primaryPage, otherPage2);
380 apl = null;387 // then replace the primaryPageSource
381 }388 primaryPageSpy.clear();
382389 defaults.primaryPageSource = data.nextValue;
383 SignalSpy {390 primaryPageSpy.wait(400);
384 id: primaryPageSpy391 // look after page2
385 signalName: "primaryPageChanged"392 verify(!findPageFromLayout(defaults, "Page2"), "Page2 still in the view!");
386 }393 }
387394
388 function test_primaryPageSource_precedence_over_primaryPage() {395 function test_primaryPageSource_precedence_over_primaryPage() {
389 var apl = aplPrecedence.createObject(root);396 primaryPageSpy.target = defaults;
390 primaryPageSpy.target = apl;397 defaults.primaryPage = otherPage1;
391 verify(apl);398 primaryPageSpy.wait(400);
392 primaryPageSpy.wait();399 // now set a value to primaryPageSource
393 verify(apl.primaryPage.title != page1.title, "primaryPage has not been overloaded by primaryPageSource");400 primaryPageSpy.clear();
394 apl.visible = false;401 defaults.primaryPageSource = pageComponent;
395 apl = null;402 primaryPageSpy.wait(400);
403 }
404
405 function test_primaryPage_change_clears_primaryPageSource() {
406 primaryPageSpy.target = defaults;
407 defaults.primaryPageSource = pageComponent;
408 primaryPageSpy.wait(400);
409 compare(defaults.primaryPage.title, "DynamicPage", "DynamicPage not set as primaryPage");
410 // now set a value to primaryPage
411 primaryPageSpy.clear();
412 defaults.primaryPage = otherPage1;
413 primaryPageSpy.wait(400);
414 compare(defaults.primaryPageSource, undefined, "primaryPageSource must be cleared");
396 }415 }
397 }416 }
398}417}
399418
=== modified file 'tests/unit_x11/tst_subtheming/tst_subtheming.cpp'
--- tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-09-22 13:40:32 +0000
+++ tests/unit_x11/tst_subtheming/tst_subtheming.cpp 2015-10-06 09:05:14 +0000
@@ -636,44 +636,21 @@
636 {636 {
637 QTest::addColumn<QString>("document");637 QTest::addColumn<QString>("document");
638 QTest::addColumn<QString>("testValue");638 QTest::addColumn<QString>("testValue");
639 QTest::addColumn<int>("row");
640 QTest::addColumn<int>("column");
641 QTest::addColumn<QString>("warning");
642639
643 QTest::newRow("Theming version 1.2")
644 << "StyledItemV12.qml"
645 << ""
646 << 0 << 0 << "";
647 QTest::newRow("Theming version 1.3")640 QTest::newRow("Theming version 1.3")
648 << "StyledItemV13.qml"641 << "StyledItemV13.qml"
649 << "version1.3"642 << "version1.3";
650 << 0 << 0 << "";
651 QTest::newRow("Fall back to 1.3")
652 << "StyledItemFallback.qml"
653 << "version1.3"
654 << 19 << 1 << "QML StyledItem: Theme 'TestModule.TestTheme' has no 'TestStyle.qml' style for version 1.0, fall back to version 1.3.";
655 QTest::newRow("App theme versioned")643 QTest::newRow("App theme versioned")
656 << "StyledItemAppThemeVersioned.qml"644 << "StyledItemAppThemeVersioned.qml"
657 << "version1.3"645 << "version1.3";
658 << 0 << 0 << "";
659 QTest::newRow("App theme fallback to non-versioned")
660 << "StyledItemAppThemeFallback.qml"
661 << ""
662 << 0 << 0 << "";
663 }646 }
664 void test_theme_versions()647 void test_theme_versions()
665 {648 {
666 QFETCH(QString, document);649 QFETCH(QString, document);
667 QFETCH(QString, testValue);650 QFETCH(QString, testValue);
668 QFETCH(int, row);
669 QFETCH(int, column);
670 QFETCH(QString, warning);
671651
672 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");652 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");
673 qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule");653 qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule");
674 if (!warning.isEmpty()) {
675 ThemeTestCase::ignoreWarning(document, row, column, warning);
676 }
677 QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document));654 QScopedPointer<ThemeTestCase> view(new ThemeTestCase(document));
678 UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(view->rootObject());655 UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(view->rootObject());
679 QVERIFY(UCStyledItemBasePrivate::get(styledItem)->styleItem);656 QVERIFY(UCStyledItemBasePrivate::get(styledItem)->styleItem);
@@ -689,9 +666,6 @@
689 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");666 qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");
690 qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule:" + m_themesPath.toLatin1());667 qputenv("XDG_DATA_DIRS", "./themes:./themes/TestModule:" + m_themesPath.toLatin1());
691 QScopedPointer<ThemeTestCase> view(new ThemeTestCase("DeprecatedTheme.qml"));668 QScopedPointer<ThemeTestCase> view(new ThemeTestCase("DeprecatedTheme.qml"));
692 // NOTE TestTheme resets the theme therefore the theming will look for the tested style version under Ambiance theme
693 // which will cause a warning; therefore we mark the warning to be ignored
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.");
695 }669 }
696670
697 void test_style_change_has_precedence()671 void test_style_change_has_precedence()

Subscribers

People subscribed via source and target branches

to status/vote changes: