Merge lp:~tpeeters/ubuntu-ui-toolkit/10-headAnimate into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1213
Merged at revision: 1218
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/10-headAnimate
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/sourceOverflow
Diff against target: 1044 lines (+391/-124)
16 files modified
modules/Ubuntu/Components/AppHeader.qml (+5/-0)
modules/Ubuntu/Components/Icon10.qml (+1/-1)
modules/Ubuntu/Components/MainView.qml (+1/-0)
modules/Ubuntu/Components/PageStack.qml (+7/-6)
modules/Ubuntu/Components/PageWrapperUtils.js (+3/-1)
modules/Ubuntu/Components/Styles/PageHeadStyle.qml (+2/-0)
modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+166/-29)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+19/-0)
tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.qml (+61/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.new_header.qml (+43/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py (+14/-56)
tests/resources/header/header.qml (+4/-6)
tests/resources/navigation/MyCustomPage.qml (+17/-25)
tests/unit_x11/tst_components/tst_headActions.qml (+13/-0)
tests/unit_x11/tst_components/tst_pagestack_new_header.qml (+33/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/10-headAnimate
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zsombor Egri Pending
Review via email: mp+232201@code.launchpad.net

This proposal supersedes a proposal from 2014-08-22.

Description of the change

Add header animations

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote : Posted in a previous version of this proposal

Looks good, can go in.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/Ubuntu/Components/AppHeader.qml'
--- modules/Ubuntu/Components/AppHeader.qml 2014-07-17 10:59:18 +0000
+++ modules/Ubuntu/Components/AppHeader.qml 2014-08-26 11:42:43 +0000
@@ -37,6 +37,11 @@
37 */37 */
38 property bool animate: true38 property bool animate: true
3939
40 /*!
41 Animate changing to new title/actions inside the header.
42 */
43 property bool animateContents: false
44
40 Behavior on y {45 Behavior on y {
41 enabled: animate && !(header.flickable && header.flickable.moving)46 enabled: animate && !(header.flickable && header.flickable.moving)
42 SmoothedAnimation {47 SmoothedAnimation {
4348
=== modified file 'modules/Ubuntu/Components/Icon10.qml'
--- modules/Ubuntu/Components/Icon10.qml 2014-07-31 14:14:56 +0000
+++ modules/Ubuntu/Components/Icon10.qml 2014-08-26 11:42:43 +0000
@@ -83,7 +83,7 @@
83 visible: active83 visible: active
8484
85 // Whether or not a color has been set.85 // Whether or not a color has been set.
86 property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)86 property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0) && source
8787
88 property Image source: active && image.status == Image.Ready ? image : null88 property Image source: active && image.status == Image.Ready ? image : null
89 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)89 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)
9090
=== modified file 'modules/Ubuntu/Components/MainView.qml'
--- modules/Ubuntu/Components/MainView.qml 2014-08-18 13:34:29 +0000
+++ modules/Ubuntu/Components/MainView.qml 2014-08-26 11:42:43 +0000
@@ -341,6 +341,7 @@
341 id: headerItem341 id: headerItem
342 property real bottomY: headerItem.y + headerItem.height342 property real bottomY: headerItem.y + headerItem.height
343 animate: canvas.animate343 animate: canvas.animate
344 animateContents: canvas.animate
344345
345 title: internal.activePage ? internal.activePage.title : ""346 title: internal.activePage ? internal.activePage.title : ""
346 flickable: internal.activePage ? internal.activePage.flickable : null347 flickable: internal.activePage ? internal.activePage.flickable : null
347348
=== modified file 'modules/Ubuntu/Components/PageStack.qml'
--- modules/Ubuntu/Components/PageStack.qml 2014-08-12 10:03:13 +0000
+++ modules/Ubuntu/Components/PageStack.qml 2014-08-26 11:42:43 +0000
@@ -163,7 +163,6 @@
163 function push(page, properties) {163 function push(page, properties) {
164 if (internal.stack.size() > 0) internal.stack.top().active = false;164 if (internal.stack.size() > 0) internal.stack.top().active = false;
165 internal.stack.push(internal.createWrapper(page, properties));165 internal.stack.push(internal.createWrapper(page, properties));
166 internal.stack.top().active = true;
167 internal.stackUpdated();166 internal.stackUpdated();
168 }167 }
169168
@@ -181,8 +180,6 @@
181 if (internal.stack.top().canDestroy) internal.stack.top().destroyObject();180 if (internal.stack.top().canDestroy) internal.stack.top().destroyObject();
182 internal.stack.pop();181 internal.stack.pop();
183 internal.stackUpdated();182 internal.stackUpdated();
184
185 if (internal.stack.size() > 0) internal.stack.top().active = true;
186 }183 }
187184
188 /*!185 /*!
@@ -216,9 +213,13 @@
216 }213 }
217214
218 function stackUpdated() {215 function stackUpdated() {
219 pageStack.depth =+ stack.size();216 pageStack.depth = stack.size();
220 if (pageStack.depth > 0) currentPage = stack.top().object;217 if (pageStack.depth > 0) {
221 else currentPage = null;218 internal.stack.top().active = true;
219 currentPage = stack.top().object;
220 } else {
221 currentPage = null;
222 }
222 }223 }
223 }224 }
224225
225226
=== modified file 'modules/Ubuntu/Components/PageWrapperUtils.js'
--- modules/Ubuntu/Components/PageWrapperUtils.js 2013-05-24 13:51:12 +0000
+++ modules/Ubuntu/Components/PageWrapperUtils.js 2014-08-26 11:42:43 +0000
@@ -101,8 +101,10 @@
101 */101 */
102function destroyObject(pageWrapper) {102function destroyObject(pageWrapper) {
103 if (pageWrapper.canDestroy) {103 if (pageWrapper.canDestroy) {
104 pageWrapper.object.destroy();
105 pageWrapper.object = null;104 pageWrapper.object = null;
105 // Rely on garbage collector to destroy the object after all
106 // (other) references are gone. PageHeadStyle uses actions etc.
107 // of the page to show a fade-out animation after it was popped.
106 pageWrapper.canDestroy = false;108 pageWrapper.canDestroy = false;
107 }109 }
108}110}
109111
=== modified file 'modules/Ubuntu/Components/Styles/PageHeadStyle.qml'
--- modules/Ubuntu/Components/Styles/PageHeadStyle.qml 2014-06-26 14:24:41 +0000
+++ modules/Ubuntu/Components/Styles/PageHeadStyle.qml 2014-08-26 11:42:43 +0000
@@ -53,7 +53,9 @@
53 property int fontWeight53 property int fontWeight
5454
55 /*!55 /*!
56 \deprecated
56 The color of the title text.57 The color of the title text.
58 Use \l Page.head.foregroundColor instead.
57 */59 */
58 property color textColor60 property color textColor
5961
6062
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-08-26 11:42:42 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-08-26 11:42:43 +0000
@@ -29,9 +29,127 @@
29 textColor: styledItem.config.foregroundColor29 textColor: styledItem.config.foregroundColor
30 textLeftMargin: units.gu(2)30 textLeftMargin: units.gu(2)
31 maximumNumberOfActions: 331 maximumNumberOfActions: 3
32 objectName: "PageHeadStyle"
33
34 // workaround because autopilot cannot select the SequentalAnimation
35 // Needed in AppHeader.wait_for_animation() autopilot proxy object and
36 // in tst_pagestack_new_header.qml unit test.
37 property bool animating: changeAnimation.running
3238
33 implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height39 implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height
3440
41 Component.onCompleted: buffer.update()
42
43 Object {
44 id: buffer
45
46 property PageHeadConfiguration config
47 property string title
48 property Item pageStack: null
49 property int pageStackDepth: 0
50 property var tabsModel: null
51
52 function update() {
53 buffer.config = styledItem.config;
54 buffer.title = styledItem.title;
55 buffer.pageStack = styledItem.pageStack;
56 buffer.pageStackDepth = buffer.pageStack ? buffer.pageStack.depth : 0;
57 buffer.tabsModel = styledItem.tabsModel ? styledItem.tabsModel : null;
58 }
59
60 // Calling changeAnimation.start() a second time has no effect,
61 // so below we can call it whenever something changes.
62 Connections {
63 target: styledItem
64 onConfigChanged: buffer.updateConfigAndTitle()
65 onTitleChanged: buffer.updateConfigAndTitle()
66 onPageStackChanged: buffer.updateConfigAndTitle()
67 onTabsModelChanged: buffer.updateConfigAndTitle()
68 }
69
70 function updateConfigAndTitle() {
71 if (styledItem.animateContents) {
72 changeAnimation.start();
73 } else {
74 buffer.update();
75 }
76 }
77
78 SequentialAnimation {
79 id: changeAnimation
80 objectName: "changeAnimation"
81 ParallelAnimation {
82 UbuntuNumberAnimation {
83 target: foreground
84 property: "opacity"
85 from: 1.0
86 to: 0.0
87 }
88 UbuntuNumberAnimation {
89 target: leftButtonContainer
90 property: "opacity"
91 from: 1.0
92 to: 0.0
93 }
94 UbuntuNumberAnimation {
95 target: actionsContainer
96 property: "opacity"
97 from: 1.0
98 to: 0.0
99 }
100 UbuntuNumberAnimation {
101 target: leftAnchor
102 properties: "anchors.leftMargin"
103 from: 0.0
104 to: -units.gu(5)
105 }
106 UbuntuNumberAnimation {
107 target: rightAnchor
108 properties: "anchors.rightMargin"
109 from: 0
110 to: -units.gu(5)
111 }
112 }
113 ScriptAction {
114 script: {
115 buffer.update();
116 }
117 }
118 ParallelAnimation {
119 UbuntuNumberAnimation {
120 target: foreground
121 property: "opacity"
122 from: 0.0
123 to: 1.0
124 }
125 UbuntuNumberAnimation {
126 target: leftButtonContainer
127 property: "opacity"
128 from: 0.0
129 to: 1.0
130 }
131 UbuntuNumberAnimation {
132 target: actionsContainer
133 property: "opacity"
134 from: 0.0
135 to: 1.0
136 }
137 UbuntuNumberAnimation {
138 target: leftAnchor
139 properties: "anchors.leftMargin"
140 from: -units.gu(5)
141 to: 0
142 }
143 UbuntuNumberAnimation {
144 target: rightAnchor
145 properties: "anchors.rightMargin"
146 from: -units.gu(5)
147 to: 0
148 }
149 }
150 }
151 }
152
35 // FIXME: Workaround to get sectionsRepeater.count in autopilot tests,153 // FIXME: Workaround to get sectionsRepeater.count in autopilot tests,
36 // see also FIXME in AppHeader where this property is used.154 // see also FIXME in AppHeader where this property is used.
37 property alias __sections_repeater_for_autopilot: sectionsRepeater155 property alias __sections_repeater_for_autopilot: sectionsRepeater
@@ -46,7 +164,7 @@
46 source: headerStyle.separatorSource164 source: headerStyle.separatorSource
47 height: sectionsRow.visible ? units.gu(3) : units.gu(2)165 height: sectionsRow.visible ? units.gu(3) : units.gu(2)
48166
49 property PageHeadSections sections: styledItem.config.sections167 property PageHeadSections sections: buffer.config.sections
50168
51 Row {169 Row {
52 id: sectionsRow170 id: sectionsRow
@@ -121,9 +239,30 @@
121 }239 }
122240
123 Item {241 Item {
242 id: leftAnchor
243 anchors {
244 top: parent.top
245 bottom: parent.bottom
246 left: parent.left
247 leftMargin: 0
248 }
249 width: 0
250 }
251 Item {
252 id: rightAnchor
253 anchors {
254 top: parent.top
255 bottom: parent.bottom
256 right: parent.right
257 rightMargin: 0
258 }
259 width: 0
260 }
261
262 Item {
124 id: leftButtonContainer263 id: leftButtonContainer
125 anchors {264 anchors {
126 left: parent.left265 left: leftAnchor.right
127 top: parent.top266 top: parent.top
128 leftMargin: width > 0 ? units.gu(1) : 0267 leftMargin: width > 0 ? units.gu(1) : 0
129 }268 }
@@ -133,10 +272,10 @@
133 PageHeadButton {272 PageHeadButton {
134 id: customBackButton273 id: customBackButton
135 objectName: "customBackButton"274 objectName: "customBackButton"
136 action: styledItem.config.backAction275 action: buffer.config.backAction
137 visible: null !== styledItem.config.backAction &&276 visible: null !== buffer.config.backAction &&
138 styledItem.config.backAction.visible277 buffer.config.backAction.visible
139 color: styledItem.config.foregroundColor278 color: buffer.config.foregroundColor
140 }279 }
141280
142 PageHeadButton {281 PageHeadButton {
@@ -144,16 +283,14 @@
144 objectName: "backButton"283 objectName: "backButton"
145284
146 iconName: "back"285 iconName: "back"
147 visible: styledItem.pageStack !== null &&286 visible: buffer.pageStackDepth > 1 &&
148 styledItem.pageStack !== undefined &&287 !buffer.config.backAction
149 styledItem.pageStack.depth > 1 &&
150 !styledItem.config.backAction
151288
152 text: "back"289 text: "back"
153 color: styledItem.config.foregroundColor290 color: buffer.config.foregroundColor
154291
155 onTriggered: {292 onTriggered: {
156 styledItem.pageStack.pop();293 buffer.pageStack.pop();
157 }294 }
158 }295 }
159296
@@ -162,12 +299,11 @@
162 objectName: "tabsButton"299 objectName: "tabsButton"
163300
164 iconName: "navigation-menu"301 iconName: "navigation-menu"
165 visible: styledItem.tabsModel !== null &&302 visible: buffer.tabsModel !== null &&
166 styledItem.tabsModel !== undefined &&
167 !backButton.visible &&303 !backButton.visible &&
168 !customBackButton.visible304 !customBackButton.visible
169 text: visible ? styledItem.tabsModel.count + " tabs" : ""305 text: visible ? buffer.tabsModel.count + " tabs" : ""
170 color: styledItem.config.foregroundColor306 color: buffer.config.foregroundColor
171307
172 onTriggered: PopupUtils.open(tabsPopoverComponent, tabsButton)308 onTriggered: PopupUtils.open(tabsPopoverComponent, tabsButton)
173309
@@ -187,11 +323,11 @@
187 right: parent.right323 right: parent.right
188 }324 }
189 Repeater {325 Repeater {
190 model: styledItem.tabsModel326 model: buffer.tabsModel
191 AbstractButton {327 AbstractButton {
192 objectName: "tabButton" + index328 objectName: "tabButton" + index
193 onClicked: {329 onClicked: {
194 styledItem.tabsModel.selectedIndex = index;330 buffer.tabsModel.selectedIndex = index;
195 tabsPopover.hide();331 tabsPopover.hide();
196 }332 }
197 implicitHeight: units.gu(6) + bottomDividerLine.height333 implicitHeight: units.gu(6) + bottomDividerLine.height
@@ -224,7 +360,7 @@
224 ListItem.ThinDivider {360 ListItem.ThinDivider {
225 id: bottomDividerLine361 id: bottomDividerLine
226 anchors.bottom: parent.bottom362 anchors.bottom: parent.bottom
227 visible: index < styledItem.tabsModel.count - 1363 visible: index < buffer.tabsModel.count - 1
228 }364 }
229 }365 }
230 }366 }
@@ -238,12 +374,12 @@
238 id: foreground374 id: foreground
239 anchors {375 anchors {
240 left: leftButtonContainer.right376 left: leftButtonContainer.right
241 right: actionsContainer.left
242 top: parent.top377 top: parent.top
243 // don't keep a margin if there is already a button with spacing378 // don't keep a margin if there is already a button with spacing
244 leftMargin: leftButtonContainer.width > 0 ? 0 : headerStyle.textLeftMargin379 leftMargin: leftButtonContainer.width > 0 ? 0 : headerStyle.textLeftMargin
245 }380 }
246 height: headerStyle.contentHeight381 height: headerStyle.contentHeight
382 width: parent.width - leftButtonContainer.width - actionsContainer.width
247383
248 Label {384 Label {
249 objectName: "header_title_label"385 objectName: "header_title_label"
@@ -254,10 +390,10 @@
254 right: parent.right390 right: parent.right
255 verticalCenter: parent.verticalCenter391 verticalCenter: parent.verticalCenter
256 }392 }
257 text: styledItem.title393 text: buffer.title
258 font.weight: headerStyle.fontWeight394 font.weight: headerStyle.fontWeight
259 fontSize: headerStyle.fontSize395 fontSize: headerStyle.fontSize
260 color: headerStyle.textColor396 color: buffer.config.foregroundColor
261 elide: Text.ElideRight397 elide: Text.ElideRight
262 }398 }
263399
@@ -267,7 +403,7 @@
267 // when the bindings below is no longer active403 // when the bindings below is no longer active
268 id: contentsContainer404 id: contentsContainer
269 anchors.fill: parent405 anchors.fill: parent
270 visible: styledItem.contents || styledItem.config.contents406 visible: styledItem.contents || buffer.config.contents
271 }407 }
272 Binding {408 Binding {
273 target: styledItem.contents409 target: styledItem.contents
@@ -282,17 +418,17 @@
282 when: styledItem.contents418 when: styledItem.contents
283 }419 }
284 Binding {420 Binding {
285 target: styledItem.config.contents421 target: buffer.config.contents
286 property: "parent"422 property: "parent"
287 value: contentsContainer423 value: contentsContainer
288 when: styledItem.config.contents && !styledItem.contents424 when: buffer.config.contents && !styledItem.contents
289 }425 }
290 }426 }
291427
292 Row {428 Row {
293 id: actionsContainer429 id: actionsContainer
294430
295 property var visibleActions: getVisibleActions(styledItem.config.actions)431 property var visibleActions: getVisibleActions(buffer.config.actions)
296 function getVisibleActions(actions) {432 function getVisibleActions(actions) {
297 var visibleActionList = [];433 var visibleActionList = [];
298 for (var i in actions) {434 for (var i in actions) {
@@ -316,7 +452,7 @@
316452
317 anchors {453 anchors {
318 top: parent.top454 top: parent.top
319 right: parent.right455 right: rightAnchor.left
320 rightMargin: units.gu(1)456 rightMargin: units.gu(1)
321 }457 }
322 width: childrenRect.width458 width: childrenRect.width
@@ -328,7 +464,7 @@
328 id: actionButton464 id: actionButton
329 objectName: action.objectName + "_header_button"465 objectName: action.objectName + "_header_button"
330 action: actionsContainer.visibleActions[index]466 action: actionsContainer.visibleActions[index]
331 color: styledItem.config.foregroundColor467 color: buffer.config.foregroundColor
332 }468 }
333 }469 }
334470
@@ -337,8 +473,9 @@
337 objectName: "actions_overflow_button"473 objectName: "actions_overflow_button"
338 visible: numberOfSlots.requested > numberOfSlots.right474 visible: numberOfSlots.requested > numberOfSlots.right
339 iconName: "contextual-menu"475 iconName: "contextual-menu"
340 color: styledItem.config.foregroundColor476 color: buffer.config.foregroundColor
341 height: actionsContainer.height477 height: actionsContainer.height
478
342 onTriggered: PopupUtils.open(actionsOverflowPopoverComponent, actionsOverflowButton)479 onTriggered: PopupUtils.open(actionsOverflowPopoverComponent, actionsOverflowButton)
343480
344 Component {481 Component {
345482
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-08-20 06:45:28 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-08-26 11:42:43 +0000
@@ -67,6 +67,7 @@
67 raise _common.ToolkitException('Old header has no sections')67 raise _common.ToolkitException('Old header has no sections')
6868
69 try:69 try:
70 self.wait_for_animation()
70 object_name = "section_button_" + str(index)71 object_name = "section_button_" + str(index)
71 button = self.select_single(objectName=object_name)72 button = self.select_single(objectName=object_name)
72 except dbus.StateNotFoundError:73 except dbus.StateNotFoundError:
@@ -79,6 +80,7 @@
79 if self.useDeprecatedToolbar:80 if self.useDeprecatedToolbar:
80 raise _common.ToolkitException('Old header has no sections')81 raise _common.ToolkitException('Old header has no sections')
8182
83 self.wait_for_animation()
82 sectionsProperties = self.select_single(84 sectionsProperties = self.select_single(
83 'QQuickItem', objectName='sectionsProperties')85 'QQuickItem', objectName='sectionsProperties')
84 return sectionsProperties.selectedIndex86 return sectionsProperties.selectedIndex
@@ -89,12 +91,14 @@
89 if self.useDeprecatedToolbar:91 if self.useDeprecatedToolbar:
90 raise _common.ToolkitException('Old header has no back button')92 raise _common.ToolkitException('Old header has no back button')
91 try:93 try:
94 self.wait_for_animation()
92 back_button = self.select_single(objectName='backButton')95 back_button = self.select_single(objectName='backButton')
93 except dbus.StateNotFoundError:96 except dbus.StateNotFoundError:
94 raise _common.ToolkitException('Missing back button in header')97 raise _common.ToolkitException('Missing back button in header')
95 if not back_button.visible:98 if not back_button.visible:
96 raise _common.ToolkitException('Back button in header not visible')99 raise _common.ToolkitException('Back button in header not visible')
97 self.pointing_device.click_object(back_button)100 self.pointing_device.click_object(back_button)
101 self.wait_for_animation()
98102
99 def click_custom_back_button(self):103 def click_custom_back_button(self):
100 self._show_if_not_visible()104 self._show_if_not_visible()
@@ -103,6 +107,7 @@
103 raise _common.ToolkitException(107 raise _common.ToolkitException(
104 'Old header has no custom back button')108 'Old header has no custom back button')
105 try:109 try:
110 self.wait_for_animation()
106 custom_back_button = self.select_single(111 custom_back_button = self.select_single(
107 objectName='customBackButton')112 objectName='customBackButton')
108 except dbus.StateNotFoundError:113 except dbus.StateNotFoundError:
@@ -112,6 +117,7 @@
112 raise _common.ToolkitException(117 raise _common.ToolkitException(
113 'Custom back button in header not visible')118 'Custom back button in header not visible')
114 self.pointing_device.click_object(custom_back_button)119 self.pointing_device.click_object(custom_back_button)
120 self.wait_for_animation()
115121
116 def _get_animating(self):122 def _get_animating(self):
117 if self.useDeprecatedToolbar:123 if self.useDeprecatedToolbar:
@@ -120,6 +126,14 @@
120 else:126 else:
121 return False127 return False
122128
129 def wait_for_animation(self):
130 try:
131 style = self.select_single(objectName='PageHeadStyle')
132 style.animating.wait_for(False)
133 except dbus.StateNotFoundError:
134 raise _common.ToolkitException(
135 'AppHeader is not using the new PageHeadStyle')
136
123 @autopilot_logging.log_action(logger.info)137 @autopilot_logging.log_action(logger.info)
124 def switch_to_next_tab(self):138 def switch_to_next_tab(self):
125 """Open the next tab.139 """Open the next tab.
@@ -143,6 +157,7 @@
143 self._get_animating().wait_for(False)157 self._get_animating().wait_for(False)
144158
145 def _switch_to_next_tab_in_drawer(self):159 def _switch_to_next_tab_in_drawer(self):
160 self.wait_for_animation()
146 tabs_model_properties = self.select_single(161 tabs_model_properties = self.select_single(
147 'QQuickItem', objectName='tabsModelProperties')162 'QQuickItem', objectName='tabsModelProperties')
148 next_tab_index = (tabs_model_properties.selectedIndex163 next_tab_index = (tabs_model_properties.selectedIndex
@@ -167,6 +182,7 @@
167 self._switch_to_tab_in_drawer_by_index(index)182 self._switch_to_tab_in_drawer_by_index(index)
168183
169 def _switch_to_tab_in_drawer_by_index(self, index):184 def _switch_to_tab_in_drawer_by_index(self, index):
185 self.wait_for_animation()
170 try:186 try:
171 tabs_drawer_button = self.select_single(objectName='tabsButton')187 tabs_drawer_button = self.select_single(objectName='tabsButton')
172 except dbus.StateNotFoundError:188 except dbus.StateNotFoundError:
@@ -187,6 +203,7 @@
187 "Tab button {0} not found.".format(index))203 "Tab button {0} not found.".format(index))
188204
189 self.pointing_device.click_object(tab_button)205 self.pointing_device.click_object(tab_button)
206 self.wait_for_animation()
190207
191 def click_action_button(self, action_object_name):208 def click_action_button(self, action_object_name):
192 """Click an action button of the header.209 """Click an action button of the header.
@@ -200,8 +217,10 @@
200217
201 button = self._get_action_button(action_object_name)218 button = self._get_action_button(action_object_name)
202 self.pointing_device.click_object(button)219 self.pointing_device.click_object(button)
220 self.wait_for_animation()
203221
204 def _get_action_button(self, action_object_name):222 def _get_action_button(self, action_object_name):
223 self.wait_for_animation()
205 try:224 try:
206 object_name = action_object_name + "_header_button"225 object_name = action_object_name + "_header_button"
207 button = self.select_single(objectName=object_name)226 button = self.select_single(objectName=object_name)
208227
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py'
--- tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 2014-07-31 08:21:14 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 2014-08-26 11:42:43 +0000
@@ -81,6 +81,7 @@
81 objectName='push_button')81 objectName='push_button')
82 self.pointing_device.move_to_object(pushButton)82 self.pointing_device.move_to_object(pushButton)
83 self.pointing_device.click()83 self.pointing_device.click()
84 self.header.wait_for_animation()
8485
85 self.assertEqual(label.visible, False)86 self.assertEqual(label.visible, False)
86 headerContents = self.header.select_single(87 headerContents = self.header.select_single(
@@ -94,6 +95,7 @@
94 objectName='push_button')95 objectName='push_button')
95 self.pointing_device.move_to_object(pushButton)96 self.pointing_device.move_to_object(pushButton)
96 self.pointing_device.click()97 self.pointing_device.click()
98 self.header.wait_for_animation()
9799
98 headerContents = self.header.select_single(100 headerContents = self.header.select_single(
99 objectName='orange_header_contents')101 objectName='orange_header_contents')
100102
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.qml 2014-08-26 11:42:43 +0000
@@ -0,0 +1,61 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import Ubuntu.Components 1.1
19
20MainView {
21 width: units.gu(70)
22 height: units.gu(60)
23 useDeprecatedToolbar: true
24
25 Tabs {
26 id: tabs
27 Tab {
28 objectName: "tab1"
29 title: "Tab1"
30 Page {
31 tools: ToolbarItems {
32 ToolbarButton {
33 text: "Test1"
34 }
35 }
36 }
37 }
38 Tab {
39 objectName: "tab2"
40 title: "Tab2"
41 Page {
42 tools: ToolbarItems {
43 ToolbarButton {
44 text: "Test2"
45 }
46 }
47 }
48 }
49 Tab {
50 objectName: "tab3"
51 title: "Tab3"
52 Page {
53 tools: ToolbarItems {
54 ToolbarButton {
55 text: "Test3"
56 }
57 }
58 }
59 }
60 }
61}
062
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.new_header.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.new_header.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.new_header.qml 2014-08-26 11:42:43 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import Ubuntu.Components 1.1
19
20MainView {
21 width: units.gu(70)
22 height: units.gu(60)
23 useDeprecatedToolbar: false
24
25 Tabs {
26 id: tabs
27 Tab {
28 objectName: "tab1"
29 title: "Tab1"
30 Page { }
31 }
32 Tab {
33 objectName: "tab2"
34 title: "Tab2"
35 Page { }
36 }
37 Tab {
38 objectName: "tab3"
39 title: "Tab3"
40 Page { }
41 }
42 }
43}
044
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2014-06-02 23:21:48 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2014-08-26 11:42:43 +0000
@@ -14,6 +14,8 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
18
17try:19try:
18 from unittest import mock20 from unittest import mock
19except ImportError:21except ImportError:
@@ -23,64 +25,20 @@
23from ubuntuuitoolkit import tests25from ubuntuuitoolkit import tests
2426
2527
26TEST_TABS_QML_FORMAT = ("""28class TabsTestCase(tests.QMLFileAppTestCase):
27import QtQuick 2.029
28import Ubuntu.Components 1.030 path = os.path.abspath(__file__)
2931 dir_path = os.path.dirname(path)
30MainView {{32 deprecated_tabbar_test_qml_file_path = os.path.join(
31 width: units.gu(70)33 dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.qml')
32 height: units.gu(60)34 new_header_test_qml_file_path = os.path.join(
33 useDeprecatedToolbar: {use_deprecated_toolbar}35 dir_path, 'test_tabs.TabsTestCase.new_header.qml')
34
35 Tabs {{
36 id: tabs
37 Tab {{
38 objectName: "tab1"
39 title: "Tab1"
40 Page {{
41 tools: ToolbarItems {{
42 ToolbarButton {{
43 text: "Test1"
44 }}
45 }}
46 }}
47 }}
48 Tab {{
49 objectName: "tab2"
50 title: "Tab2"
51 Page {{
52 tools: ToolbarItems {{
53 ToolbarButton {{
54 text: "Test2"
55 }}
56 }}
57 }}
58 }}
59 Tab {{
60 objectName: "tab3"
61 title: "Tab3"
62 Page {{
63 tools: ToolbarItems {{
64 ToolbarButton {{
65 text: "Test3"
66 }}
67 }}
68 }}
69 }}
70 }}
71}}
72""")
73
74
75class TabsTestCase(tests.QMLStringAppTestCase):
7636
77 scenarios = [37 scenarios = [
78 ('deprecated tabs', dict(38 ('deprecated TabBar',
79 test_qml=TEST_TABS_QML_FORMAT.format(39 dict(test_qml_file_path=deprecated_tabbar_test_qml_file_path)),
80 use_deprecated_toolbar='true'))),40 ('new header',
81 ('drawer tabs', dict(41 dict(test_qml_file_path=new_header_test_qml_file_path))
82 test_qml=TEST_TABS_QML_FORMAT.format(
83 use_deprecated_toolbar='false')))
84 ]42 ]
8543
86 def test_tabs_custom_proxy_object(self):44 def test_tabs_custom_proxy_object(self):
8745
=== modified file 'tests/resources/header/header.qml'
--- tests/resources/header/header.qml 2014-07-31 14:09:45 +0000
+++ tests/resources/header/header.qml 2014-08-26 11:42:43 +0000
@@ -206,12 +206,10 @@
206 anchors.centerIn: parent206 anchors.centerIn: parent
207 text: "Use back button to return"207 text: "Use back button to return"
208 }208 }
209 tools: ToolbarItems {209 head {
210 ToolbarButton {210 actions: Action {
211 action: Action {211 iconName: "settings"
212 iconName: "settings"212 text: "settings"
213 text: "settings"
214 }
215 }213 }
216 }214 }
217 }215 }
218216
=== modified file 'tests/resources/navigation/MyCustomPage.qml'
--- tests/resources/navigation/MyCustomPage.qml 2014-08-26 11:42:42 +0000
+++ tests/resources/navigation/MyCustomPage.qml 2014-08-26 11:42:43 +0000
@@ -15,7 +15,7 @@
15 */15 */
1616
17import QtQuick 2.017import QtQuick 2.0
18import Ubuntu.Components 1.018import Ubuntu.Components 1.1
1919
20Page {20Page {
21 title: i18n.tr("My custom page")21 title: i18n.tr("My custom page")
@@ -30,32 +30,24 @@
30 horizontalCenter: parent.horizontalCenter30 horizontalCenter: parent.horizontalCenter
31 }31 }
3232
33 text: i18n.tr("This is an external page\nwith a locked toolbar.")33 text: i18n.tr("This is an external page.")
34 color: "#757373"34 color: "#757373"
35 }35 }
36 }36 }
3737
38 tools: ToolbarItems {38 head.actions: [
39 ToolbarButton {39 Action {
40 action: Action {40 text: "action 1"
41 text: "action 1"41 iconName: "outgoing-call"
42 iconName: "outgoing-call"42 },
43 }43 Action {
44 }44 text: "action 2"
45 ToolbarButton {45 iconSource: "call_icon.png"
46 action: Action {46 iconName: "missed-call"
47 text: "action 2"47 },
48 iconName: "missed-call"48 Action {
49 }49 text: "another one"
50 }50 iconName: "contact"
51 ToolbarButton {51 }
52 action: Action {52 ]
53 text: "another one"
54 iconSource: "call_icon.png"
55 }
56 }
57
58 opened: true
59 locked: true
60 }
61}53}
6254
=== modified file 'tests/unit_x11/tst_components/tst_headActions.qml'
--- tests/unit_x11/tst_components/tst_headActions.qml 2014-07-28 18:41:55 +0000
+++ tests/unit_x11/tst_components/tst_headActions.qml 2014-08-26 11:42:43 +0000
@@ -64,39 +64,52 @@
64 property var app_header64 property var app_header
65 property var back_button65 property var back_button
66 property var custom_back_button66 property var custom_back_button
67 property var head_animation
6768
68 function initTestCase() {69 function initTestCase() {
69 testCase.app_header = findChild(mainView, "MainView_Header");70 testCase.app_header = findChild(mainView, "MainView_Header");
70 testCase.back_button = findChild(app_header, "backButton");71 testCase.back_button = findChild(app_header, "backButton");
71 testCase.custom_back_button = findChild(app_header, "customBackButton");72 testCase.custom_back_button = findChild(app_header, "customBackButton");
73 testCase.head_animation = findChild(app_header, "PageHeadStyle");
7274
75 waitHeadAnimation();
73 compare(page2.head.backAction, null, "Back action set by default.");76 compare(page2.head.backAction, null, "Back action set by default.");
74 compare(back_button.visible, false, "Back button visible with only 1 page on the stack.");77 compare(back_button.visible, false, "Back button visible with only 1 page on the stack.");
75 compare(custom_back_button.visible, false, "Custom back button visible without custom back action.")78 compare(custom_back_button.visible, false, "Custom back button visible without custom back action.")
76 }79 }
7780
81 function waitHeadAnimation() {
82 tryCompareFunction(function(){return testCase.head_animation.animating}, false);
83 }
84
78 function test_default_back_button() {85 function test_default_back_button() {
79 pageStack.push(page2);86 pageStack.push(page2);
87 waitHeadAnimation();
80 compare(back_button.visible, true, "Back button not visible with 2 pages on stack.");88 compare(back_button.visible, true, "Back button not visible with 2 pages on stack.");
81 compare(custom_back_button.visible, false, "Showing custom back button without custom back action.");89 compare(custom_back_button.visible, false, "Showing custom back button without custom back action.");
82 pageStack.pop();90 pageStack.pop();
91 waitHeadAnimation();
83 }92 }
8493
85 function test_custom_back_button() {94 function test_custom_back_button() {
86 page2.head.backAction = customBackAction;95 page2.head.backAction = customBackAction;
87 pageStack.push(page2);96 pageStack.push(page2);
97 waitHeadAnimation();
88 compare(back_button.visible, false, "Default back button visible with custom back action.");98 compare(back_button.visible, false, "Default back button visible with custom back action.");
89 compare(custom_back_button.visible, true, "Custom back button invisible with back action.");99 compare(custom_back_button.visible, true, "Custom back button invisible with back action.");
90 pageStack.pop();100 pageStack.pop();
101 waitHeadAnimation();
91 page2.head.backAction = null;102 page2.head.backAction = null;
92 }103 }
93104
94 function test_no_back_button() {105 function test_no_back_button() {
95 page2.head.backAction = invisibleAction;106 page2.head.backAction = invisibleAction;
96 pageStack.push(page2);107 pageStack.push(page2);
108 waitHeadAnimation();
97 compare(back_button.visible, false, "Default back button visible with invisible custom back action.");109 compare(back_button.visible, false, "Default back button visible with invisible custom back action.");
98 compare(custom_back_button.visible, false, "Custom back button visible with invisible custom back action.");110 compare(custom_back_button.visible, false, "Custom back button visible with invisible custom back action.");
99 pageStack.pop();111 pageStack.pop();
112 waitHeadAnimation();
100 page2.head.backAction = null;113 page2.head.backAction = null;
101 }114 }
102 }115 }
103116
=== modified file 'tests/unit_x11/tst_components/tst_pagestack_new_header.qml'
--- tests/unit_x11/tst_components/tst_pagestack_new_header.qml 2014-08-18 10:40:45 +0000
+++ tests/unit_x11/tst_components/tst_pagestack_new_header.qml 2014-08-26 11:42:43 +0000
@@ -27,6 +27,7 @@
2727
28 MainView {28 MainView {
29 id: mainView29 id: mainView
30 anchors.fill: parent
30 useDeprecatedToolbar: false31 useDeprecatedToolbar: false
31 PageStack {32 PageStack {
32 id: pageStack33 id: pageStack
@@ -65,7 +66,13 @@
65 when: windowShown66 when: windowShown
66 id: testCase67 id: testCase
6768
69 function waitPageHeadAnimation() {
70 var pageHeadStyle = findChild(mainView, "PageHeadStyle");
71 tryCompare(pageHeadStyle, "animating", false);
72 }
73
68 function initTestCase() {74 function initTestCase() {
75 waitPageHeadAnimation();
69 compare(pageStack.currentPage, null, "is not set by default");76 compare(pageStack.currentPage, null, "is not set by default");
70 compare(pageStack.__propagated, mainView.__propagated, "propagated property of pageStack equals mainView.__propagated")77 compare(pageStack.__propagated, mainView.__propagated, "propagated property of pageStack equals mainView.__propagated")
71 compare(mainView.__propagated.header.title, "", "empty title by default");78 compare(mainView.__propagated.header.title, "", "empty title by default");
@@ -74,55 +81,73 @@
74 function test_depth() {81 function test_depth() {
75 compare(pageStack.depth, 0, "depth is 0 by default");82 compare(pageStack.depth, 0, "depth is 0 by default");
76 pageStack.push(page1);83 pageStack.push(page1);
84 waitPageHeadAnimation();
77 compare(pageStack.depth, 1, "depth is correctly increased when pushing a page");85 compare(pageStack.depth, 1, "depth is correctly increased when pushing a page");
78 pageStack.push(page2);86 pageStack.push(page2);
87 waitPageHeadAnimation();
79 compare(pageStack.depth, 2, "depth is correctly updated when pushing a page");88 compare(pageStack.depth, 2, "depth is correctly updated when pushing a page");
80 pageStack.pop();89 pageStack.pop();
90 waitPageHeadAnimation();
81 compare(pageStack.depth, 1, "depth is correctly decreased when popping a page");91 compare(pageStack.depth, 1, "depth is correctly decreased when popping a page");
82 pageStack.clear();92 pageStack.clear();
93 waitPageHeadAnimation();
83 compare(pageStack.depth, 0, "depth is after clearing");94 compare(pageStack.depth, 0, "depth is after clearing");
84 }95 }
8596
86 function test_currentPage() {97 function test_currentPage() {
87 compare(pageStack.currentPage, null, "currentPage is null by default");98 compare(pageStack.currentPage, null, "currentPage is null by default");
88 pageStack.push(page1);99 pageStack.push(page1);
100 waitPageHeadAnimation();
89 compare(pageStack.currentPage, page1, "currentPage properly updated");101 compare(pageStack.currentPage, page1, "currentPage properly updated");
90 pageStack.clear();102 pageStack.clear();
103 waitPageHeadAnimation();
91 compare(pageStack.currentPage, null, "currentPage properly reset");104 compare(pageStack.currentPage, null, "currentPage properly reset");
92 }105 }
93106
94 function test_active_bug1260116() {107 function test_active_bug1260116() {
95 pageStack.push(page1);108 pageStack.push(page1);
109 waitPageHeadAnimation();
96 compare(page1.active, true, "Page is active after pushing");110 compare(page1.active, true, "Page is active after pushing");
97 pageStack.push(page2);111 pageStack.push(page2);
112 waitPageHeadAnimation();
98 compare(page1.active, false, "Page no longer active after pushing a new page");113 compare(page1.active, false, "Page no longer active after pushing a new page");
99 compare(page2.active, true, "New page is active after pushing");114 compare(page2.active, true, "New page is active after pushing");
100 pageStack.pop();115 pageStack.pop();
116 waitPageHeadAnimation();
101 compare(page1.active, true, "Page re-activated when on top of the stack");117 compare(page1.active, true, "Page re-activated when on top of the stack");
102 compare(page2.active, false, "Page no longer active after being popped");118 compare(page2.active, false, "Page no longer active after being popped");
103 pageStack.clear();119 pageStack.clear();
120 waitPageHeadAnimation();
104121
105 compare(pageInStack.active, false, "Page defined inside PageStack is not active by default");122 compare(pageInStack.active, false, "Page defined inside PageStack is not active by default");
106 pageStack.push(pageInStack);123 pageStack.push(pageInStack);
124 waitPageHeadAnimation();
107 compare(pageInStack.active, true, "Pushing a page on PageStack makes it active");125 compare(pageInStack.active, true, "Pushing a page on PageStack makes it active");
108 pageStack.pop();126 pageStack.pop();
127 waitPageHeadAnimation();
109 compare(pageInStack.active, false, "Popping a page from PageStack makes it inactive");128 compare(pageInStack.active, false, "Popping a page from PageStack makes it inactive");
110 pageStack.clear();129 pageStack.clear();
130 waitPageHeadAnimation();
111 }131 }
112132
113 function test_title_bug1143345_bug1317902() {133 function test_title_bug1143345_bug1317902() {
114 pageStack.push(page1);134 pageStack.push(page1);
135 waitPageHeadAnimation();
115 compare(mainView.__propagated.header.title, "Title 1", "Header title is correctly set by page");136 compare(mainView.__propagated.header.title, "Title 1", "Header title is correctly set by page");
116 page1.title = "New title";137 page1.title = "New title";
117 compare(mainView.__propagated.header.title, "New title", "Header title correctly updated by page");138 compare(mainView.__propagated.header.title, "New title", "Header title correctly updated by page");
118 pageStack.push(page2);139 pageStack.push(page2);
140 waitPageHeadAnimation();
119 compare(mainView.__propagated.header.title, "Title 2", "Header title is correctly set by page");141 compare(mainView.__propagated.header.title, "Title 2", "Header title is correctly set by page");
120 pageStack.clear();142 pageStack.clear();
143 waitPageHeadAnimation();
121 page1.title = "Title 1";144 page1.title = "Title 1";
122145
123 pageStack.push(pageWithPage);146 pageStack.push(pageWithPage);
147 waitPageHeadAnimation();
124 compare(mainView.__propagated.header.title, pageWithPage.title, "Embedded page sets title of outer page");148 compare(mainView.__propagated.header.title, pageWithPage.title, "Embedded page sets title of outer page");
125 pageStack.clear();149 pageStack.clear();
150 waitPageHeadAnimation();
126 }151 }
127152
128 function get_tabs_button() {153 function get_tabs_button() {
@@ -134,28 +159,36 @@
134 function test_tabs_inside_stack_bug1187850() {159 function test_tabs_inside_stack_bug1187850() {
135 compare(get_tabs_button(), null, "Without tabs there is no visible tabs button.");160 compare(get_tabs_button(), null, "Without tabs there is no visible tabs button.");
136 pageStack.push(tabs);161 pageStack.push(tabs);
162 waitPageHeadAnimation();
137 compare(pageStack.currentPage, tabs, "Tabs can be pushed on a PageStack");163 compare(pageStack.currentPage, tabs, "Tabs can be pushed on a PageStack");
138 compare(tabs.active, true, "Tabs on top of a PageStack are active");164 compare(tabs.active, true, "Tabs on top of a PageStack are active");
139 compare(get_tabs_button().visible, true, "Pushing tabs on pagestack enables the tabs button");165 compare(get_tabs_button().visible, true, "Pushing tabs on pagestack enables the tabs button");
140 pageStack.push(page1);166 pageStack.push(page1);
167 waitPageHeadAnimation();
141 compare(pageStack.currentPage, page1, "A page can be pushed on top of a Tabs");168 compare(pageStack.currentPage, page1, "A page can be pushed on top of a Tabs");
142 compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");169 compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
143 compare(get_tabs_button(), null, "Contents of inactive Tabs is not applied to header");170 compare(get_tabs_button(), null, "Contents of inactive Tabs is not applied to header");
144 pageStack.pop();171 pageStack.pop();
172 waitPageHeadAnimation();
145 compare(tabs.active, true, "Tabs on top of PageStack is active");173 compare(tabs.active, true, "Tabs on top of PageStack is active");
146 compare(get_tabs_button().visible, true, "Active Tabs controls header contents");174 compare(get_tabs_button().visible, true, "Active Tabs controls header contents");
147 pageStack.clear();175 pageStack.clear();
176 waitPageHeadAnimation();
148 }177 }
149178
150 function test_pop_to_tabs_bug1316736() {179 function test_pop_to_tabs_bug1316736() {
151 pageStack.push(tabs);180 pageStack.push(tabs);
181 waitPageHeadAnimation();
152 tabs.selectedTabIndex = 1;182 tabs.selectedTabIndex = 1;
153 pageStack.push(page1);183 pageStack.push(page1);
184 waitPageHeadAnimation();
154 compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");185 compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
155 pageStack.pop();186 pageStack.pop();
187 waitPageHeadAnimation();
156 compare(tabs.active, true, "Tabs on top of PageStack is active");188 compare(tabs.active, true, "Tabs on top of PageStack is active");
157 compare(tabs.selectedTabIndex, 1, "Pushing and popping another page on top of Tabs does not change selectedTabsIndex");189 compare(tabs.selectedTabIndex, 1, "Pushing and popping another page on top of Tabs does not change selectedTabsIndex");
158 pageStack.clear();190 pageStack.clear();
191 waitPageHeadAnimation();
159 }192 }
160 }193 }
161}194}

Subscribers

People subscribed via source and target branches