Merge lp:~zsombi/ubuntu-ui-toolkit/aplReplacePrimaryPage into lp:ubuntu-ui-toolkit/staging
- aplReplacePrimaryPage
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Cris Dywan |
Approved revision: | 1668 |
Merged at revision: | 1673 |
Proposed branch: | lp:~zsombi/ubuntu-ui-toolkit/aplReplacePrimaryPage |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Prerequisite: | lp:~zsombi/ubuntu-ui-toolkit/aplPrimaryPageAsync |
Diff against target: |
466 lines (+179/-138) 2 files modified
src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+52/-30) tests/unit_x11/tst_components/tst_adaptivepagelayout.qml (+127/-108) |
To merge this branch: | bzr merge lp:~zsombi/ubuntu-ui-toolkit/aplReplacePrimaryPage |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cris Dywan | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+272868@code.launchpad.net |
Commit message
Make primaryPage and primaryPageSource replaceable after component completion.
Description of the change
Make primaryPage and primaryPageSource replaceable after component completion.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1666. By Zsombor Egri
-
documentation fixed
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1666
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Cris Dywan (kalikiana) wrote : | # |
+ The property can only hold a Page instance. When changed runtime (not by the
...changed at runtime...
+ be cerated asynchronously and the instance will be reported through
...be created asynchronously...
+ if (source === null) {
+ if (source === undefined) {
These conditionals are hard to make sense of for me even after checking the two places the function can be called from. I'm thinking it might make more sense to dissolve the function so it's easier to understand given there is very little code to be shared.
+ function findPageFromLay
How about making this objectName only? That'd be more consistent and there's no chance of killing time by retroactively investigating localization-
Also, may be worth adding to UbuntuTestCase?
Zsombor Egri (zsombi) wrote : | # |
> + The property can only hold a Page instance. When changed runtime (not by the
>
> ...changed at runtime...
>
> + be cerated asynchronously and the instance will be reported through
>
> ...be created asynchronously...
>
> + if (source === null) {
> + if (source === undefined) {
>
> These conditionals are hard to make sense of for me even after checking the
> two places the function can be called from. I'm thinking it might make more
> sense to dissolve the function so it's easier to understand given there is
> very little code to be shared.
>
> + function findPageFromLay
>
> How about making this objectName only? That'd be more consistent and there's
> no chance of killing time by retroactively investigating localization-
> failures because of labels.
Yep, makes sense.
> Also, may be worth adding to UbuntuTestCase?
Well... should we have APL specific function in UbuntuTestCase? The function itself looks in the body of the APL and not in the APL children itself. Pages can be added as child to APL (which are then forwarded to the internal hiddenPages) so we are not interested of those...
- 1667. By Zsombor Egri
-
review comments applied
- 1668. By Zsombor Egri
-
findPageFromLay
outWithProperty renamed into findPageFromLayout
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1668
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Cris Dywan (kalikiana) wrote : | # |
Thanks for the update!
Preview Diff
1 | === modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml' | |||
2 | --- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-09-30 09:46:03 +0000 | |||
3 | +++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-02 05:22:37 +0000 | |||
4 | @@ -42,13 +42,11 @@ | |||
5 | 42 | add the page to the leftmost column of the view. | 42 | add the page to the leftmost column of the view. |
6 | 43 | 43 | ||
7 | 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 |
15 | 45 | \l primaryPage or \l primaryPageSource properties. The properties cannot be | 45 | \l primaryPage or \l primaryPageSource properties. \l primaryPage can only |
16 | 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 |
17 | 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 |
18 | 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 |
19 | 49 | precedence over \l primaryPage and will create the Page asynchronously. The | 49 | property, and will replace any value set into that property. |
13 | 50 | page instance will be reported through \l primaryPage property and will replace | ||
14 | 51 | any previous value set to that property. | ||
20 | 52 | 50 | ||
21 | 53 | \qml | 51 | \qml |
22 | 54 | import QtQuick 2.4 | 52 | import QtQuick 2.4 |
23 | @@ -188,17 +186,18 @@ | |||
24 | 188 | /*! | 186 | /*! |
25 | 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 |
26 | 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. |
29 | 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 |
30 | 192 | component completion. | 190 | AdaptivePageLayout component itself), the \l primaryPageSource property |
31 | 191 | will be reset. | ||
32 | 193 | */ | 192 | */ |
33 | 194 | property Page primaryPage | 193 | property Page primaryPage |
34 | 195 | 194 | ||
35 | 196 | /*! | 195 | /*! |
36 | 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 |
37 | 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 |
41 | 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 |
42 | 200 | completion. The page specified in this way will be cerated asynchronously | 199 | be cerated asynchronously and the instance will be reported through |
43 | 201 | and the instance will be reported through \l primaryPage property. | 200 | \l primaryPage property. |
44 | 202 | */ | 201 | */ |
45 | 203 | property var primaryPageSource | 202 | property var primaryPageSource |
46 | 204 | 203 | ||
47 | @@ -322,12 +321,7 @@ | |||
48 | 322 | pages will be removed. | 321 | pages will be removed. |
49 | 323 | */ | 322 | */ |
50 | 324 | function removePages(page) { | 323 | function removePages(page) { |
57 | 325 | var nodeToRemove = d.getWrapper(page); | 324 | d.removeAllPages(page, page != layout.primaryPage); |
52 | 326 | var removedNodes = d.tree.chop(nodeToRemove, page != layout.primaryPage); | ||
53 | 327 | for (var i = removedNodes.length-1; i >= 0; i--) { | ||
54 | 328 | var node = removedNodes[i]; | ||
55 | 329 | d.updatePageForColumn(node.column); | ||
56 | 330 | } | ||
58 | 331 | } | 325 | } |
59 | 332 | 326 | ||
60 | 333 | /* | 327 | /* |
61 | @@ -345,26 +339,34 @@ | |||
62 | 345 | d.createPrimaryPage(primaryPageSource); | 339 | d.createPrimaryPage(primaryPageSource); |
63 | 346 | } else if (primaryPage) { | 340 | } else if (primaryPage) { |
64 | 347 | d.createPrimaryPage(primaryPage); | 341 | d.createPrimaryPage(primaryPage); |
65 | 348 | } else { | ||
66 | 349 | console.warn("No primary page set. No pages can be added without a primary page."); | ||
67 | 350 | } | 342 | } |
68 | 351 | d.completed = true; | 343 | d.completed = true; |
69 | 352 | } | 344 | } |
70 | 353 | onPrimaryPageChanged: { | 345 | onPrimaryPageChanged: { |
74 | 354 | if (d.completed && !d.internalUpdate) { | 346 | if (!d.completed || d.internalUpdate) { |
72 | 355 | console.warn("Cannot change primaryPage after completion."); | ||
73 | 356 | d.internalPropertyUpdate("primaryPage", d.lastPrimaryPage); | ||
75 | 357 | return; | 347 | return; |
76 | 358 | } | 348 | } |
78 | 359 | d.lastPrimaryPage = primaryPage; | 349 | // reset the primaryPageSource |
79 | 350 | d.internalPropertyUpdate("primaryPageSource", undefined); | ||
80 | 351 | // clear the layout | ||
81 | 352 | d.purgeLayout(); | ||
82 | 353 | // add the new page if valid | ||
83 | 354 | if (primaryPage !== null) { | ||
84 | 355 | d.createPrimaryPage(primaryPage); | ||
85 | 356 | } | ||
86 | 360 | } | 357 | } |
87 | 361 | onPrimaryPageSourceChanged: { | 358 | onPrimaryPageSourceChanged: { |
91 | 362 | if (d.completed && !d.internalUpdate) { | 359 | if (!d.completed || d.internalUpdate) { |
89 | 363 | console.warn("Cannot change primaryPageSource after completion."); | ||
90 | 364 | d.internalPropertyUpdate("primaryPageSource", d.lastPrimaryPageSource); | ||
92 | 365 | return; | 360 | return; |
93 | 366 | } | 361 | } |
95 | 367 | d.lastPrimaryPageSource = primaryPageSource; | 362 | // remove all pages first |
96 | 363 | d.purgeLayout(); | ||
97 | 364 | // create the new primary page if a valid component is specified | ||
98 | 365 | if (primaryPageSource) { | ||
99 | 366 | d.createPrimaryPage(primaryPageSource); | ||
100 | 367 | } else { | ||
101 | 368 | d.internalPropertyUpdate("primaryPage", null); | ||
102 | 369 | } | ||
103 | 368 | } | 370 | } |
104 | 369 | 371 | ||
105 | 370 | onLayoutsChanged: { | 372 | onLayoutsChanged: { |
106 | @@ -389,8 +391,7 @@ | |||
107 | 389 | (activeLayout ? activeLayout.data.length : 1) | 391 | (activeLayout ? activeLayout.data.length : 1) |
108 | 390 | property PageColumnsLayout activeLayout: null | 392 | property PageColumnsLayout activeLayout: null |
109 | 391 | property list<PageColumnsLayout> prevLayouts | 393 | property list<PageColumnsLayout> prevLayouts |
112 | 392 | property Page lastPrimaryPage | 394 | property Page prevPrimaryPage |
111 | 393 | property var lastPrimaryPageSource | ||
113 | 394 | 395 | ||
114 | 395 | /*! internal */ | 396 | /*! internal */ |
115 | 396 | onColumnsChanged: { | 397 | onColumnsChanged: { |
116 | @@ -416,10 +417,20 @@ | |||
117 | 416 | wrapper.incubator.onStatusChanged = function (status) { | 417 | wrapper.incubator.onStatusChanged = function (status) { |
118 | 417 | if (status == Component.Ready) { | 418 | if (status == Component.Ready) { |
119 | 418 | internalPropertyUpdate("primaryPage", wrapper.incubator.object); | 419 | internalPropertyUpdate("primaryPage", wrapper.incubator.object); |
120 | 420 | prevPrimaryPage = wrapper.incubator.object; | ||
121 | 419 | } | 421 | } |
122 | 420 | } | 422 | } |
123 | 421 | } else { | 423 | } else { |
124 | 422 | finalizeAddingPage(wrapper); | 424 | finalizeAddingPage(wrapper); |
125 | 425 | prevPrimaryPage = wrapper.object; | ||
126 | 426 | } | ||
127 | 427 | } | ||
128 | 428 | |||
129 | 429 | // remove all pages, including primaryPage | ||
130 | 430 | function purgeLayout() { | ||
131 | 431 | if (prevPrimaryPage) { | ||
132 | 432 | removeAllPages(prevPrimaryPage, true); | ||
133 | 433 | prevPrimaryPage = null; | ||
134 | 423 | } | 434 | } |
135 | 424 | } | 435 | } |
136 | 425 | 436 | ||
137 | @@ -514,6 +525,17 @@ | |||
138 | 514 | return newWrapper.incubator; | 525 | return newWrapper.incubator; |
139 | 515 | } | 526 | } |
140 | 516 | 527 | ||
141 | 528 | // removes all pages from the layout, and may include the page itself | ||
142 | 529 | function removeAllPages(page, inclusive) { | ||
143 | 530 | inclusive = typeof inclusive !== 'undefined' ? inclusive : true; | ||
144 | 531 | var nodeToRemove = d.getWrapper(page); | ||
145 | 532 | var removedNodes = d.tree.chop(nodeToRemove, inclusive); | ||
146 | 533 | for (var i = removedNodes.length-1; i >= 0; i--) { | ||
147 | 534 | var node = removedNodes[i]; | ||
148 | 535 | updatePageForColumn(node.column); | ||
149 | 536 | } | ||
150 | 537 | } | ||
151 | 538 | |||
152 | 517 | // update the page for the specified column | 539 | // update the page for the specified column |
153 | 518 | function updatePageForColumn(column) { | 540 | function updatePageForColumn(column) { |
154 | 519 | var effectiveColumn = MathUtils.clamp(column, 0, d.columns - 1); | 541 | var effectiveColumn = MathUtils.clamp(column, 0, d.columns - 1); |
155 | 520 | 542 | ||
156 | === modified file 'tests/unit_x11/tst_components/tst_adaptivepagelayout.qml' | |||
157 | --- tests/unit_x11/tst_components/tst_adaptivepagelayout.qml 2015-09-29 10:37:46 +0000 | |||
158 | +++ tests/unit_x11/tst_components/tst_adaptivepagelayout.qml 2015-10-02 05:22:37 +0000 | |||
159 | @@ -27,83 +27,79 @@ | |||
160 | 27 | // 2 on desktop, 1 on phone. | 27 | // 2 on desktop, 1 on phone. |
161 | 28 | property int columns: width >= units.gu(80) ? 2 : 1 | 28 | property int columns: width >= units.gu(80) ? 2 : 1 |
162 | 29 | 29 | ||
203 | 30 | AdaptivePageLayout { | 30 | Column { |
204 | 31 | id: layout | 31 | anchors.fill: parent |
205 | 32 | width: parent.width | 32 | AdaptivePageLayout { |
206 | 33 | height: parent.height | 33 | id: layout |
207 | 34 | 34 | width: parent.width | |
208 | 35 | primaryPage: page1 | 35 | height: parent.height / 2 |
209 | 36 | 36 | ||
210 | 37 | Page { | 37 | primaryPage: page1 |
211 | 38 | id: page1 | 38 | |
212 | 39 | title: "Page1" | 39 | Page { |
213 | 40 | 40 | id: page1 | |
214 | 41 | Column { | 41 | objectName: title |
215 | 42 | anchors.centerIn: parent | 42 | title: "Page1" |
216 | 43 | width: childrenRect.width | 43 | |
217 | 44 | Button { | 44 | Column { |
218 | 45 | text: "Page 2 left" | 45 | anchors.centerIn: parent |
219 | 46 | onTriggered: layout.addPageToCurrentColumn(page1, page2) | 46 | width: childrenRect.width |
220 | 47 | } | 47 | Button { |
221 | 48 | Button { | 48 | text: "Page 2 left" |
222 | 49 | text: "Page 3 right" | 49 | onTriggered: layout.addPageToCurrentColumn(page1, page2) |
223 | 50 | onTriggered: layout.addPageToNextColumn(page1, page3); | 50 | } |
224 | 51 | } | 51 | Button { |
225 | 52 | } | 52 | text: "Page 3 right" |
226 | 53 | } | 53 | onTriggered: layout.addPageToNextColumn(page1, page3); |
227 | 54 | Page { | 54 | } |
228 | 55 | id: page2 | 55 | } |
229 | 56 | title: "Page2" | 56 | } |
230 | 57 | } | 57 | Page { |
231 | 58 | Page { | 58 | id: page2 |
232 | 59 | id: page3 | 59 | objectName: title |
233 | 60 | title: "Page3" | 60 | title: "Page2" |
234 | 61 | } | 61 | } |
235 | 62 | Page { | 62 | Page { |
236 | 63 | id: page4 | 63 | id: page3 |
237 | 64 | title: "Page4" | 64 | objectName: title |
238 | 65 | } | 65 | title: "Page3" |
239 | 66 | } | 66 | } |
240 | 67 | 67 | Page { | |
241 | 68 | AdaptivePageLayout { | 68 | id: page4 |
242 | 69 | id: defaults | 69 | objectName: title |
243 | 70 | title: "Page4" | ||
244 | 71 | } | ||
245 | 72 | } | ||
246 | 73 | AdaptivePageLayout { | ||
247 | 74 | id: defaults | ||
248 | 75 | width: parent.width | ||
249 | 76 | height: parent.height / 2 | ||
250 | 77 | Page { | ||
251 | 78 | id: otherPage1 | ||
252 | 79 | objectName: title | ||
253 | 80 | title: "Page1" | ||
254 | 81 | } | ||
255 | 82 | Page { | ||
256 | 83 | id: otherPage2 | ||
257 | 84 | objectName: title | ||
258 | 85 | title: "Page2" | ||
259 | 86 | } | ||
260 | 87 | Page { | ||
261 | 88 | id: otherPage3 | ||
262 | 89 | objectName: title | ||
263 | 90 | title: "Page3" | ||
264 | 91 | } | ||
265 | 92 | } | ||
266 | 70 | } | 93 | } |
267 | 71 | 94 | ||
268 | 72 | Component { | 95 | Component { |
269 | 73 | id: pageComponent | 96 | id: pageComponent |
270 | 74 | Page { | 97 | Page { |
271 | 98 | objectName: title | ||
272 | 75 | title: "DynamicPage" | 99 | title: "DynamicPage" |
273 | 76 | } | 100 | } |
274 | 77 | } | 101 | } |
275 | 78 | 102 | ||
276 | 79 | Component { | ||
277 | 80 | id: aplComponent | ||
278 | 81 | AdaptivePageLayout { | ||
279 | 82 | width: units.gu(40) | ||
280 | 83 | height: units.gu(50) | ||
281 | 84 | primaryPageSource: pageComponent | ||
282 | 85 | } | ||
283 | 86 | } | ||
284 | 87 | |||
285 | 88 | Component { | ||
286 | 89 | id: aplDocument | ||
287 | 90 | AdaptivePageLayout { | ||
288 | 91 | width: units.gu(40) | ||
289 | 92 | height: units.gu(50) | ||
290 | 93 | primaryPageSource: Qt.resolvedUrl("MyExternalPage.qml") | ||
291 | 94 | } | ||
292 | 95 | } | ||
293 | 96 | |||
294 | 97 | Component { | ||
295 | 98 | id: aplPrecedence | ||
296 | 99 | AdaptivePageLayout { | ||
297 | 100 | width: units.gu(40) | ||
298 | 101 | height: units.gu(50) | ||
299 | 102 | primaryPage: page1 | ||
300 | 103 | primaryPageSource: Qt.resolvedUrl("MyExternalPage.qml") | ||
301 | 104 | } | ||
302 | 105 | } | ||
303 | 106 | |||
304 | 107 | UbuntuTestCase { | 103 | UbuntuTestCase { |
305 | 108 | id: testCase | 104 | id: testCase |
306 | 109 | when: windowShown | 105 | when: windowShown |
307 | @@ -115,6 +111,10 @@ | |||
308 | 115 | target: testCase | 111 | target: testCase |
309 | 116 | signalName: "pageLoaded" | 112 | signalName: "pageLoaded" |
310 | 117 | } | 113 | } |
311 | 114 | SignalSpy { | ||
312 | 115 | id: primaryPageSpy | ||
313 | 116 | signalName: "primaryPageChanged" | ||
314 | 117 | } | ||
315 | 118 | 118 | ||
316 | 119 | function resize_single_column() { | 119 | function resize_single_column() { |
317 | 120 | layout.width = units.gu(40); | 120 | layout.width = units.gu(40); |
318 | @@ -135,29 +135,38 @@ | |||
319 | 135 | return apl.__d.getWrapper(page); | 135 | return apl.__d.getWrapper(page); |
320 | 136 | } | 136 | } |
321 | 137 | 137 | ||
322 | 138 | function findPageFromLayout(apl, objectName) { | ||
323 | 139 | var body = findChild(apl, "body"); | ||
324 | 140 | verify(body); | ||
325 | 141 | return findChild(body, objectName); | ||
326 | 142 | } | ||
327 | 143 | |||
328 | 138 | function cleanup() { | 144 | function cleanup() { |
329 | 139 | page1.title = "Page1"; | 145 | page1.title = "Page1"; |
330 | 140 | page2.title = "Page2"; | 146 | page2.title = "Page2"; |
331 | 141 | page3.title = "Page3"; | 147 | page3.title = "Page3"; |
332 | 142 | page4.title = "Page4"; | 148 | page4.title = "Page4"; |
333 | 143 | loadedSpy.clear(); | 149 | loadedSpy.clear(); |
334 | 150 | primaryPageSpy.clear(); | ||
335 | 151 | primaryPageSpy.target = null; | ||
336 | 144 | resize_multiple_columns(); | 152 | resize_multiple_columns(); |
338 | 145 | layout.removePages(page1); | 153 | layout.removePages(layout.primaryPage); |
339 | 154 | defaults.primaryPage = null; | ||
340 | 155 | wait(200); | ||
341 | 146 | } | 156 | } |
342 | 147 | 157 | ||
343 | 148 | function initTestCase() { | 158 | function initTestCase() { |
344 | 149 | compare(defaults.primaryPage, null, "primaryPage not null by default"); | 159 | compare(defaults.primaryPage, null, "primaryPage not null by default"); |
345 | 150 | compare(defaults.primaryPageSource, undefined, "primaryPageSource not set by default"); | 160 | compare(defaults.primaryPageSource, undefined, "primaryPageSource not set by default"); |
346 | 151 | compare(defaults.layouts.length, 0, "no layouts by default"); | 161 | compare(defaults.layouts.length, 0, "no layouts by default"); |
348 | 152 | compare(defaults.columns, 1, "1 column as default"); | 162 | compare(defaults.columns, columns, columns + " column(s) as default"); |
349 | 153 | } | 163 | } |
350 | 154 | 164 | ||
351 | 155 | function test_change_primaryPage() { | 165 | function test_change_primaryPage() { |
357 | 156 | // this prints the warning but still changes the primary page, | 166 | defaults.primaryPage = otherPage1; |
358 | 157 | // so the test must be executed last not to mess up the other tests. | 167 | defaults.addPageToCurrentColumn(defaults.primaryPage, otherPage2); |
359 | 158 | ignoreWarning("Cannot change primaryPage after completion."); | 168 | defaults.primaryPage = otherPage3; |
360 | 159 | layout.primaryPage = page3; | 169 | verify(!findPageFromLayout(defaults, "Page2"), "Page2 still in the view!"); |
356 | 160 | verify(layout.primaryPage != page3, "primaryPage value was changed"); | ||
361 | 161 | } | 170 | } |
362 | 162 | 171 | ||
363 | 163 | function test_add_page_when_source_page_not_in_stack() { | 172 | function test_add_page_when_source_page_not_in_stack() { |
364 | @@ -333,10 +342,10 @@ | |||
365 | 333 | } | 342 | } |
366 | 334 | 343 | ||
367 | 335 | var testPage = testHolder.pageWrapper.object; | 344 | var testPage = testHolder.pageWrapper.object; |
369 | 336 | var prevPageActive = false | 345 | var prevPageActive = false; |
370 | 337 | var incubator = data.nextColumn | 346 | var incubator = data.nextColumn |
371 | 338 | ? layout.addPageToNextColumn(data.sourcePage, data.page) | 347 | ? layout.addPageToNextColumn(data.sourcePage, data.page) |
373 | 339 | : layout.addPageToCurrentColumn(data.sourcePage, data.page);; | 348 | : layout.addPageToCurrentColumn(data.sourcePage, data.page); |
374 | 340 | verify(incubator); | 349 | verify(incubator); |
375 | 341 | compare(testHolder.pageWrapper.object, testPage); | 350 | compare(testHolder.pageWrapper.object, testPage); |
376 | 342 | incubator.onStatusChanged = function (status) { | 351 | incubator.onStatusChanged = function (status) { |
377 | @@ -351,48 +360,58 @@ | |||
378 | 351 | 360 | ||
379 | 352 | function test_primaryPageSource_bug1499179_data() { | 361 | function test_primaryPageSource_bug1499179_data() { |
380 | 353 | return [ | 362 | return [ |
383 | 354 | {tag: "Component", test: aplComponent}, | 363 | {tag: "Component", test: pageComponent}, |
384 | 355 | {tag: "Document", test: aplDocument}, | 364 | {tag: "Document", test: Qt.resolvedUrl("MyExternalPage.qml")}, |
385 | 356 | ]; | 365 | ]; |
386 | 357 | } | 366 | } |
387 | 358 | function test_primaryPageSource_bug1499179(data) { | 367 | function test_primaryPageSource_bug1499179(data) { |
393 | 359 | var apl = data.test.createObject(root); | 368 | primaryPageSpy.target = defaults; |
394 | 360 | verify(apl); | 369 | defaults.primaryPageSource = data.test; |
395 | 361 | tryCompareFunction(function () { return apl.primaryPage != null }, true, 1500); | 370 | primaryPageSpy.wait(); |
391 | 362 | apl.visible = false; | ||
392 | 363 | apl = null; | ||
396 | 364 | } | 371 | } |
397 | 365 | 372 | ||
399 | 366 | function test_primaryPageSource_not_set_twice_data() { | 373 | function test_change_primaryPageSource_data() { |
400 | 367 | return [ | 374 | return [ |
403 | 368 | {tag: "Component", test: aplComponent, nextValue: null}, | 375 | {tag: "Component", test: pageComponent, nextValue: Qt.resolvedUrl("MyExternalPage.qml")}, |
404 | 369 | {tag: "Document", test: aplDocument, nextValue: null}, | 376 | {tag: "Document", test: Qt.resolvedUrl("MyExternalPage.qml"), nextValue: pageComponent}, |
405 | 370 | ]; | 377 | ]; |
406 | 371 | } | 378 | } |
421 | 372 | function test_primaryPageSource_not_set_twice(data) { | 379 | function test_change_primaryPageSource(data) { |
422 | 373 | var apl = data.test.createObject(root); | 380 | primaryPageSpy.target = defaults; |
423 | 374 | verify(apl); | 381 | verify(defaults.primaryPage == null); |
424 | 375 | tryCompareFunction(function () { return apl.primaryPage != null }, true, 1500); | 382 | verify(defaults.primaryPageSource == undefined); |
425 | 376 | ignoreWarning("Cannot change primaryPageSource after completion."); | 383 | defaults.primaryPageSource = data.test; |
426 | 377 | apl.primaryPageSource = data.nextValue; | 384 | primaryPageSpy.wait(400); |
427 | 378 | verify(apl.primaryPageSource != data.nextValue, "property value changed!"); | 385 | // add some pages |
428 | 379 | apl.visible = false; | 386 | defaults.addPageToCurrentColumn(defaults.primaryPage, otherPage2); |
429 | 380 | apl = null; | 387 | // then replace the primaryPageSource |
430 | 381 | } | 388 | primaryPageSpy.clear(); |
431 | 382 | 389 | defaults.primaryPageSource = data.nextValue; | |
432 | 383 | SignalSpy { | 390 | primaryPageSpy.wait(400); |
433 | 384 | id: primaryPageSpy | 391 | // look after page2 |
434 | 385 | signalName: "primaryPageChanged" | 392 | verify(!findPageFromLayout(defaults, "Page2"), "Page2 still in the view!"); |
435 | 386 | } | 393 | } |
436 | 387 | 394 | ||
437 | 388 | function test_primaryPageSource_precedence_over_primaryPage() { | 395 | function test_primaryPageSource_precedence_over_primaryPage() { |
445 | 389 | var apl = aplPrecedence.createObject(root); | 396 | primaryPageSpy.target = defaults; |
446 | 390 | primaryPageSpy.target = apl; | 397 | defaults.primaryPage = otherPage1; |
447 | 391 | verify(apl); | 398 | primaryPageSpy.wait(400); |
448 | 392 | primaryPageSpy.wait(); | 399 | // now set a value to primaryPageSource |
449 | 393 | verify(apl.primaryPage.title != page1.title, "primaryPage has not been overloaded by primaryPageSource"); | 400 | primaryPageSpy.clear(); |
450 | 394 | apl.visible = false; | 401 | defaults.primaryPageSource = pageComponent; |
451 | 395 | apl = null; | 402 | primaryPageSpy.wait(400); |
452 | 403 | } | ||
453 | 404 | |||
454 | 405 | function test_primaryPage_change_clears_primaryPageSource() { | ||
455 | 406 | primaryPageSpy.target = defaults; | ||
456 | 407 | defaults.primaryPageSource = pageComponent; | ||
457 | 408 | primaryPageSpy.wait(400); | ||
458 | 409 | compare(defaults.primaryPage.title, "DynamicPage", "DynamicPage not set as primaryPage"); | ||
459 | 410 | // now set a value to primaryPage | ||
460 | 411 | primaryPageSpy.clear(); | ||
461 | 412 | defaults.primaryPage = otherPage1; | ||
462 | 413 | primaryPageSpy.wait(400); | ||
463 | 414 | compare(defaults.primaryPageSource, undefined, "primaryPageSource must be cleared"); | ||
464 | 396 | } | 415 | } |
465 | 397 | } | 416 | } |
466 | 398 | } | 417 | } |
FAILED: Continuous integration, rev:1665 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2334/ jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-amd64- ci/1062/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/1064/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-i386- ci/1061/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2334/ rebuild
http://