Merge lp:~tpeeters/ubuntu-ui-toolkit/40-PageWithHeader into lp:ubuntu-ui-toolkit/staging
- 40-PageWithHeader
- Merge into staging
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Cris Dywan | ||||||||||||||||
Approved revision: | 1695 | ||||||||||||||||
Merged at revision: | 1686 | ||||||||||||||||
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/40-PageWithHeader | ||||||||||||||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||||||||||||||
Diff against target: |
411 lines (+279/-12) 8 files modified
components.api (+1/-0) src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+7/-3) src/Ubuntu/Components/1.3/MainView.qml (+9/-1) src/Ubuntu/Components/1.3/Page.qml (+40/-0) src/Ubuntu/Components/1.3/PageTreeNode.qml (+0/-7) src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+1/-1) tests/unit_x11/tst_components/tst_multicolumnheader.qml (+69/-0) tests/unit_x11/tst_components/tst_page_with_header.qml (+152/-0) |
||||||||||||||||
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/40-PageWithHeader | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cris Dywan | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email:
|
Commit message
Add header property to Page.
Description of the change
Add header property to Page. Setting the header property will disable the MainView's application header, and the column header in the AdaptivePageLayout.
Follow-up MRs will have to add an automatic back-button to the PageHeader, as well as sync the PageHeader heights when used in Pages in the AdaptivePageLayout. Also, when these features are done I will update the Page documentation examples to use the new header, and deprecated the old properties.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1694
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Cris Dywan (kalikiana) wrote : | # |
Looks sensible and works very nicely. Keep those iterations coming!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1695
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Cris Dywan (kalikiana) : | # |
Preview Diff
1 | === modified file 'components.api' | |||
2 | --- components.api 2015-10-12 14:45:11 +0000 | |||
3 | +++ components.api 2015-10-15 10:08:16 +0000 | |||
4 | @@ -671,6 +671,7 @@ | |||
5 | 671 | Ubuntu.Components.Page 1.3: PageTreeNode | 671 | Ubuntu.Components.Page 1.3: PageTreeNode |
6 | 672 | property Flickable flickable | 672 | property Flickable flickable |
7 | 673 | readonly property PageHeadConfiguration head | 673 | readonly property PageHeadConfiguration head |
8 | 674 | property Item header | ||
9 | 674 | property string title | 675 | property string title |
10 | 675 | Ubuntu.Components.PageColumn 1.3: QtObject | 676 | Ubuntu.Components.PageColumn 1.3: QtObject |
11 | 676 | property bool fillWidth | 677 | property bool fillWidth |
12 | 677 | 678 | ||
13 | === modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml' | |||
14 | --- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-02 05:18:15 +0000 | |||
15 | +++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-15 10:08:16 +0000 | |||
16 | @@ -667,13 +667,17 @@ | |||
17 | 667 | Layout.minimumWidth: metrics.minimumWidth | 667 | Layout.minimumWidth: metrics.minimumWidth |
18 | 668 | Layout.maximumWidth: metrics.maximumWidth | 668 | Layout.maximumWidth: metrics.maximumWidth |
19 | 669 | 669 | ||
20 | 670 | property var page: pageWrapper ? pageWrapper.object : null | ||
21 | 671 | property bool customHeader: page && page.hasOwnProperty("header") && | ||
22 | 672 | page.header | ||
23 | 673 | |||
24 | 670 | // prevent the pages from taking the app header height into account. | 674 | // prevent the pages from taking the app header height into account. |
25 | 671 | __propagated: null | 675 | __propagated: null |
26 | 672 | Item { | 676 | Item { |
27 | 673 | id: holderBody | 677 | id: holderBody |
28 | 674 | objectName: parent.objectName + "Body" | 678 | objectName: parent.objectName + "Body" |
29 | 675 | anchors { | 679 | anchors { |
31 | 676 | top: subHeader.bottom | 680 | top: customHeader ? parent.top : subHeader.bottom |
32 | 677 | bottom: parent.bottom | 681 | bottom: parent.bottom |
33 | 678 | left: parent.left | 682 | left: parent.left |
34 | 679 | right: parent.right | 683 | right: parent.right |
35 | @@ -715,12 +719,12 @@ | |||
36 | 715 | property color dividerColor: layout.__propagated.header.dividerColor | 719 | property color dividerColor: layout.__propagated.header.dividerColor |
37 | 716 | property color panelColor: layout.__propagated.header.panelColor | 720 | property color panelColor: layout.__propagated.header.panelColor |
38 | 717 | 721 | ||
40 | 718 | visible: holder.pageWrapper && holder.pageWrapper.active | 722 | visible: !customHeader && holder.pageWrapper && holder.pageWrapper.active |
41 | 719 | 723 | ||
42 | 720 | // The multiColumn, page and showBackButton properties are used in | 724 | // The multiColumn, page and showBackButton properties are used in |
43 | 721 | // PageHeadStyle to show/hide the back button. | 725 | // PageHeadStyle to show/hide the back button. |
44 | 722 | property var multiColumn: layout | 726 | property var multiColumn: layout |
46 | 723 | property var page: holder.pageWrapper ? holder.pageWrapper.object : null | 727 | property alias page: holder.page // used in PageHeadStyle for the back button. |
47 | 724 | property bool showBackButton: { | 728 | property bool showBackButton: { |
48 | 725 | if (!page) { | 729 | if (!page) { |
49 | 726 | return false; | 730 | return false; |
50 | 727 | 731 | ||
51 | === modified file 'src/Ubuntu/Components/1.3/MainView.qml' | |||
52 | --- src/Ubuntu/Components/1.3/MainView.qml 2015-10-01 15:50:07 +0000 | |||
53 | +++ src/Ubuntu/Components/1.3/MainView.qml 2015-10-15 10:08:16 +0000 | |||
54 | @@ -172,9 +172,17 @@ | |||
55 | 172 | // Used when there is no active Page, or a Page 1.0 is used which | 172 | // Used when there is no active Page, or a Page 1.0 is used which |
56 | 173 | // does not have a PageHeadConfiguration. | 173 | // does not have a PageHeadConfiguration. |
57 | 174 | } | 174 | } |
59 | 175 | config: internal.activePage && internal.activePage.hasOwnProperty("head") ? | 175 | config: visible && internal.activePage && |
60 | 176 | internal.activePage.hasOwnProperty("head") ? | ||
61 | 176 | internal.activePage.head : defaultConfig | 177 | internal.activePage.head : defaultConfig |
62 | 177 | 178 | ||
63 | 179 | // don't show the application header if the page has its own header. | ||
64 | 180 | visible: !(internal.activePage && | ||
65 | 181 | internal.activePage.hasOwnProperty("header") && | ||
66 | 182 | internal.activePage.header) | ||
67 | 183 | |||
68 | 184 | height: visible ? implicitHeight : 0 | ||
69 | 185 | |||
70 | 178 | // 'window' is defined by QML between startup and showing on the screen. | 186 | // 'window' is defined by QML between startup and showing on the screen. |
71 | 179 | // There is no signal for when it becomes available and re-declaring it is not safe. | 187 | // There is no signal for when it becomes available and re-declaring it is not safe. |
72 | 180 | property bool windowActive: typeof window != 'undefined' | 188 | property bool windowActive: typeof window != 'undefined' |
73 | 181 | 189 | ||
74 | === modified file 'src/Ubuntu/Components/1.3/Page.qml' | |||
75 | --- src/Ubuntu/Components/1.3/Page.qml 2015-10-01 12:54:32 +0000 | |||
76 | +++ src/Ubuntu/Components/1.3/Page.qml 2015-10-15 10:08:16 +0000 | |||
77 | @@ -33,6 +33,27 @@ | |||
78 | 33 | width: parentNode ? parentNode.width - page.x : undefined | 33 | width: parentNode ? parentNode.width - page.x : undefined |
79 | 34 | height: parentNode ? page.flickable ? parentNode.height : parentNode.height - internal.headerHeight : undefined | 34 | height: parentNode ? page.flickable ? parentNode.height : parentNode.height - internal.headerHeight : undefined |
80 | 35 | 35 | ||
81 | 36 | /*! | ||
82 | 37 | The header property for this page. Setting this property will reparent the | ||
83 | 38 | header to the page and disable the \l Mainview's application header. | ||
84 | 39 | \qml | ||
85 | 40 | Page { | ||
86 | 41 | id: page | ||
87 | 42 | title: "Page with header" | ||
88 | 43 | header: PageHeader { | ||
89 | 44 | title: page.header | ||
90 | 45 | trailingActionBar.actions: [ | ||
91 | 46 | Action { iconName: "settings" }, | ||
92 | 47 | Action { iconName: "info" } | ||
93 | 48 | ] | ||
94 | 49 | } | ||
95 | 50 | } | ||
96 | 51 | \endqml | ||
97 | 52 | */ | ||
98 | 53 | property Item header | ||
99 | 54 | onHeaderChanged: internal.updateHeader() | ||
100 | 55 | Component.onCompleted: internal.updateHeader() | ||
101 | 56 | |||
102 | 36 | isLeaf: true | 57 | isLeaf: true |
103 | 37 | property string title: parentNode && parentNode.hasOwnProperty("title") ? parentNode.title : "" | 58 | property string title: parentNode && parentNode.hasOwnProperty("title") ? parentNode.title : "" |
104 | 38 | property Flickable flickable: Utils.getFlickableChild(page) | 59 | property Flickable flickable: Utils.getFlickableChild(page) |
105 | @@ -50,6 +71,25 @@ | |||
106 | 50 | Toolkit13.Object { | 71 | Toolkit13.Object { |
107 | 51 | id: internal | 72 | id: internal |
108 | 52 | 73 | ||
109 | 74 | property Item previousHeader: null | ||
110 | 75 | property Item previousHeaderParent: null | ||
111 | 76 | function updateHeader() { | ||
112 | 77 | if (internal.previousHeader) { | ||
113 | 78 | internal.previousHeader.parent = internal.previousHeaderParent; | ||
114 | 79 | } | ||
115 | 80 | if (page.header) { | ||
116 | 81 | internal.previousHeaderParent = page.header.parent; | ||
117 | 82 | internal.previousHeader = page.header; | ||
118 | 83 | page.header.parent = page; | ||
119 | 84 | } else { | ||
120 | 85 | internal.previousHeader = null; | ||
121 | 86 | internal.previousHeaderParent = null; | ||
122 | 87 | } | ||
123 | 88 | } | ||
124 | 89 | |||
125 | 90 | /////////////////////////////// | ||
126 | 91 | // old header handling below // | ||
127 | 92 | /////////////////////////////// | ||
128 | 53 | property AppHeader header: page.__propagated && page.__propagated.header ? page.__propagated.header : null | 93 | property AppHeader header: page.__propagated && page.__propagated.header ? page.__propagated.header : null |
129 | 54 | // Used to position the Page when there is no flickable. | 94 | // Used to position the Page when there is no flickable. |
130 | 55 | // When there is a flickable, the header will automatically position it. | 95 | // When there is a flickable, the header will automatically position it. |
131 | 56 | 96 | ||
132 | === modified file 'src/Ubuntu/Components/1.3/PageTreeNode.qml' | |||
133 | --- src/Ubuntu/Components/1.3/PageTreeNode.qml 2015-05-06 10:32:20 +0000 | |||
134 | +++ src/Ubuntu/Components/1.3/PageTreeNode.qml 2015-10-15 10:08:16 +0000 | |||
135 | @@ -43,13 +43,6 @@ | |||
136 | 43 | 43 | ||
137 | 44 | /*! | 44 | /*! |
138 | 45 | \deprecated | 45 | \deprecated |
139 | 46 | The header of the node. Propagates down from the root node. | ||
140 | 47 | This property is DEPRECATED. | ||
141 | 48 | */ | ||
142 | 49 | property Item header: node.__propagated ? node.__propagated.header : null | ||
143 | 50 | |||
144 | 51 | /*! | ||
145 | 52 | \deprecated | ||
146 | 53 | The toolbar of the node. Propagates down from the root node. | 46 | The toolbar of the node. Propagates down from the root node. |
147 | 54 | This property is DEPRECATED. | 47 | This property is DEPRECATED. |
148 | 55 | */ | 48 | */ |
149 | 56 | 49 | ||
150 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml' | |||
151 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2015-10-13 09:58:12 +0000 | |||
152 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2015-10-15 10:08:16 +0000 | |||
153 | @@ -53,7 +53,7 @@ | |||
154 | 53 | right: parent.right | 53 | right: parent.right |
155 | 54 | verticalCenter: parent.verticalCenter | 54 | verticalCenter: parent.verticalCenter |
156 | 55 | } | 55 | } |
158 | 56 | color: header.__styleInstance.foregroundColor | 56 | color: pageHeaderStyle.foregroundColor |
159 | 57 | font.weight: pageHeaderStyle.fontWeight | 57 | font.weight: pageHeaderStyle.fontWeight |
160 | 58 | textSize: pageHeaderStyle.textSize | 58 | textSize: pageHeaderStyle.textSize |
161 | 59 | elide: Text.ElideRight | 59 | elide: Text.ElideRight |
162 | 60 | 60 | ||
163 | === modified file 'tests/unit_x11/tst_components/tst_multicolumnheader.qml' | |||
164 | --- tests/unit_x11/tst_components/tst_multicolumnheader.qml 2015-09-01 12:00:17 +0000 | |||
165 | +++ tests/unit_x11/tst_components/tst_multicolumnheader.qml 2015-10-15 10:08:16 +0000 | |||
166 | @@ -69,6 +69,14 @@ | |||
167 | 69 | text: "Add page with head contents right" | 69 | text: "Add page with head contents right" |
168 | 70 | onClicked: layout.addPageToNextColumn(rootPage, headContentsPage) | 70 | onClicked: layout.addPageToNextColumn(rootPage, headContentsPage) |
169 | 71 | } | 71 | } |
170 | 72 | ListItemWithLabel { | ||
171 | 73 | text: "Add page with header left" | ||
172 | 74 | onClicked: layout.addPageToCurrentColumn(rootPage, pageWithHeader) | ||
173 | 75 | } | ||
174 | 76 | ListItemWithLabel { | ||
175 | 77 | text: "Add page with header right" | ||
176 | 78 | onClicked: layout.addPageToNextColumn(rootPage, pageWithHeader) | ||
177 | 79 | } | ||
178 | 72 | } | 80 | } |
179 | 73 | } | 81 | } |
180 | 74 | Page { | 82 | Page { |
181 | @@ -124,6 +132,40 @@ | |||
182 | 124 | anchors.fill: parent | 132 | anchors.fill: parent |
183 | 125 | } | 133 | } |
184 | 126 | } | 134 | } |
185 | 135 | Page { | ||
186 | 136 | id: pageWithHeader | ||
187 | 137 | header: PageHeader { | ||
188 | 138 | title: "Page with header" | ||
189 | 139 | // FIXME (timp): Automatic back buttons for the PageHeader | ||
190 | 140 | // will be added in a later MR. | ||
191 | 141 | leadingActionBar.actions: Action { | ||
192 | 142 | text: "Back" | ||
193 | 143 | iconName: "close" | ||
194 | 144 | onTriggered: layout.removePages(pageWithHeader) | ||
195 | 145 | } | ||
196 | 146 | // Distinguish this header clearly from the AppHeader | ||
197 | 147 | // visually for manual tests. | ||
198 | 148 | StyleHints { | ||
199 | 149 | backgroundColor: UbuntuColors.blue | ||
200 | 150 | foregroundColor: "white" | ||
201 | 151 | } | ||
202 | 152 | } | ||
203 | 153 | Rectangle { | ||
204 | 154 | anchors { | ||
205 | 155 | top: pageWithHeader.header.bottom | ||
206 | 156 | left: parent.left | ||
207 | 157 | right: parent.right | ||
208 | 158 | bottom: parent.bottom | ||
209 | 159 | margins: units.gu(2) | ||
210 | 160 | } | ||
211 | 161 | color: UbuntuColors.warmGrey | ||
212 | 162 | Button { | ||
213 | 163 | anchors.centerIn: parent | ||
214 | 164 | text: "Add sections to next column." | ||
215 | 165 | onTriggered: layout.addPageToNextColumn(pageWithHeader, sectionsPage) | ||
216 | 166 | } | ||
217 | 167 | } | ||
218 | 168 | } | ||
219 | 127 | } | 169 | } |
220 | 128 | 170 | ||
221 | 129 | UbuntuTestCase { | 171 | UbuntuTestCase { |
222 | @@ -376,5 +418,32 @@ | |||
223 | 376 | compare(headRectangle.parent == null, false, "Head contents has no parent in next column."); | 418 | compare(headRectangle.parent == null, false, "Head contents has no parent in next column."); |
224 | 377 | layout.removePages(headContentsPage); | 419 | layout.removePages(headContentsPage); |
225 | 378 | } | 420 | } |
226 | 421 | |||
227 | 422 | function test_page_header_disables_apl_subheader() { | ||
228 | 423 | layout.addPageToCurrentColumn(rootPage, pageWithHeader); | ||
229 | 424 | var subHeader = get_header(0); | ||
230 | 425 | compare(subHeader.visible, false, | ||
231 | 426 | "Adding a Page with header does not hide the column's subHeader."); | ||
232 | 427 | |||
233 | 428 | layout.addPageToCurrentColumn(pageWithHeader, sectionsPage); | ||
234 | 429 | subHeader = get_header(0); | ||
235 | 430 | compare(subHeader.visible, true, | ||
236 | 431 | "Adding a Page without header does not reveal the column's subHeader."); | ||
237 | 432 | |||
238 | 433 | layout.removePages(sectionsPage); | ||
239 | 434 | subHeader = get_header(0); | ||
240 | 435 | compare(subHeader.visible, false, | ||
241 | 436 | "Going back to Page with header does not hide the column's subHeader."); | ||
242 | 437 | |||
243 | 438 | if (root.columns > 1) { | ||
244 | 439 | layout.addPageToNextColumn(pageWithHeader, sectionsPage); | ||
245 | 440 | subHeader = get_header(0); | ||
246 | 441 | compare(subHeader.visible, false, | ||
247 | 442 | "Adding Page without header to next column shows subHeader in first column."); | ||
248 | 443 | subHeader = get_header(1); | ||
249 | 444 | compare(subHeader.visible, true, | ||
250 | 445 | "Adding Page without header to next column does not show subHeader in next column"); | ||
251 | 446 | } | ||
252 | 447 | } | ||
253 | 379 | } | 448 | } |
254 | 380 | } | 449 | } |
255 | 381 | 450 | ||
256 | === added file 'tests/unit_x11/tst_components/tst_page_with_header.qml' | |||
257 | --- tests/unit_x11/tst_components/tst_page_with_header.qml 1970-01-01 00:00:00 +0000 | |||
258 | +++ tests/unit_x11/tst_components/tst_page_with_header.qml 2015-10-15 10:08:16 +0000 | |||
259 | @@ -0,0 +1,152 @@ | |||
260 | 1 | /* | ||
261 | 2 | * Copyright (C) 2015 Canonical Ltd. | ||
262 | 3 | * | ||
263 | 4 | * This program is free software; you can redistribute it and/or modify | ||
264 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
265 | 6 | * the Free Software Foundation; version 3. | ||
266 | 7 | * | ||
267 | 8 | * This program is distributed in the hope that it will be useful, | ||
268 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
269 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
270 | 11 | * GNU Lesser General Public License for more details. | ||
271 | 12 | * | ||
272 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
273 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
274 | 15 | */ | ||
275 | 16 | |||
276 | 17 | import QtQuick 2.4 | ||
277 | 18 | import Ubuntu.Components 1.3 | ||
278 | 19 | import Ubuntu.Test 1.0 | ||
279 | 20 | |||
280 | 21 | MainView { | ||
281 | 22 | width: units.gu(50) | ||
282 | 23 | height: units.gu(70) | ||
283 | 24 | id: root | ||
284 | 25 | |||
285 | 26 | Item { | ||
286 | 27 | id: invisible | ||
287 | 28 | visible: false | ||
288 | 29 | |||
289 | 30 | Rectangle { | ||
290 | 31 | objectName: "my_rectangle" | ||
291 | 32 | id: myRectangle | ||
292 | 33 | anchors { | ||
293 | 34 | left: parent.left | ||
294 | 35 | right: parent.right | ||
295 | 36 | } | ||
296 | 37 | height: units.gu(6) | ||
297 | 38 | color: UbuntuColors.red | ||
298 | 39 | } | ||
299 | 40 | |||
300 | 41 | PageHeader { | ||
301 | 42 | id: myPageHeader | ||
302 | 43 | objectName: "my_page_header" | ||
303 | 44 | title: "Page header" | ||
304 | 45 | trailingActionBar.actions: [ | ||
305 | 46 | Action { | ||
306 | 47 | iconName: "settings" | ||
307 | 48 | text: "First" | ||
308 | 49 | }, | ||
309 | 50 | Action { | ||
310 | 51 | iconName: "info" | ||
311 | 52 | text: "Second" | ||
312 | 53 | } | ||
313 | 54 | ] | ||
314 | 55 | } | ||
315 | 56 | } | ||
316 | 57 | |||
317 | 58 | Page { | ||
318 | 59 | id: page | ||
319 | 60 | title: "Page with header" | ||
320 | 61 | header: myPageHeader | ||
321 | 62 | |||
322 | 63 | Column { | ||
323 | 64 | anchors { | ||
324 | 65 | left: parent.left | ||
325 | 66 | right: parent.right | ||
326 | 67 | top: parent.top | ||
327 | 68 | topMargin: units.gu(10) | ||
328 | 69 | leftMargin: units.gu(10) | ||
329 | 70 | rightMargin: units.gu(10) | ||
330 | 71 | } | ||
331 | 72 | height: childrenRect.height | ||
332 | 73 | |||
333 | 74 | Button { | ||
334 | 75 | anchors { | ||
335 | 76 | left: parent.left | ||
336 | 77 | right: parent.right | ||
337 | 78 | } | ||
338 | 79 | text: "Page header" | ||
339 | 80 | onClicked: page.header = myPageHeader | ||
340 | 81 | } | ||
341 | 82 | Button { | ||
342 | 83 | anchors { | ||
343 | 84 | left: parent.left | ||
344 | 85 | right: parent.right | ||
345 | 86 | } | ||
346 | 87 | text: "Rectangle" | ||
347 | 88 | onClicked: page.header = myRectangle | ||
348 | 89 | } | ||
349 | 90 | Button { | ||
350 | 91 | anchors { | ||
351 | 92 | left: parent.left | ||
352 | 93 | right: parent.right | ||
353 | 94 | } | ||
354 | 95 | text: "Null" | ||
355 | 96 | onClicked: page.header = null | ||
356 | 97 | } | ||
357 | 98 | } | ||
358 | 99 | } | ||
359 | 100 | |||
360 | 101 | UbuntuTestCase { | ||
361 | 102 | name: "PageWithHeader" | ||
362 | 103 | when: windowShown | ||
363 | 104 | id: testCase | ||
364 | 105 | |||
365 | 106 | property var appHeader; | ||
366 | 107 | function initTestCase() { | ||
367 | 108 | var pageHeader = findChild(page, "my_page_header"); | ||
368 | 109 | compare(pageHeader, myPageHeader, | ||
369 | 110 | "My PageHeader not initialized with Page as its parent."); | ||
370 | 111 | appHeader = findChild(root, "MainView_Header"); | ||
371 | 112 | compare(appHeader.visible, false, | ||
372 | 113 | "AppHeader is not hidden initially when Page.header is set."); | ||
373 | 114 | } | ||
374 | 115 | |||
375 | 116 | function cleanup() { | ||
376 | 117 | page.header = myPageHeader; | ||
377 | 118 | var pageHeader = findChild(page, "my_page_header"); | ||
378 | 119 | compare(pageHeader, myPageHeader, | ||
379 | 120 | "PageHeader is not correctly re-parented to the Page when setting Page.header."); | ||
380 | 121 | compare(myPageHeader.visible, true, | ||
381 | 122 | "PageHeader is not visible after being re-parented to the Page."); | ||
382 | 123 | compare(appHeader.visible, false, | ||
383 | 124 | "AppHeader is not hidden when Page.header is set."); | ||
384 | 125 | } | ||
385 | 126 | |||
386 | 127 | function test_page_with_no_header() { | ||
387 | 128 | page.header = null; | ||
388 | 129 | compare(myPageHeader.parent, invisible, | ||
389 | 130 | "Header parent is not correctly reverted when unsetting Page.header."); | ||
390 | 131 | compare(myPageHeader.visible, false, | ||
391 | 132 | "My PageHeader is still visible after re-parenting it to an invisible Item."); | ||
392 | 133 | compare(appHeader.visible, true, | ||
393 | 134 | "AppHeader does not become visible when Page.header is null."); | ||
394 | 135 | } | ||
395 | 136 | |||
396 | 137 | function test_page_with_alternative_header() { | ||
397 | 138 | page.header = myRectangle; | ||
398 | 139 | compare(myPageHeader.parent, invisible, | ||
399 | 140 | "Header parent not correctly reverted when setting a different Page.header."); | ||
400 | 141 | compare(myRectangle.parent, page, | ||
401 | 142 | "Rectangle parent is not correctly set to page after setting it as Page.header."); | ||
402 | 143 | compare(appHeader.visible, false, | ||
403 | 144 | "Setting a different Page.header Item shows the AppHeader."); | ||
404 | 145 | |||
405 | 146 | page.header = myPageHeader; | ||
406 | 147 | compare(myRectangle.parent, invisible, | ||
407 | 148 | "Rectangle parent is not correctly reverted after unsetting it as Page.header."); | ||
408 | 149 | // myPageHeader parent is checked in cleanup(). | ||
409 | 150 | } | ||
410 | 151 | } | ||
411 | 152 | } |
PASSED: Continuous integration, rev:1692 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2381/ jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-amd64- ci/1109 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/1111 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/1111/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-i386- ci/1108
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2381/ rebuild
http://