Merge lp:~tpeeters/ubuntu-ui-toolkit/40-back-in-header into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Florian Boucault
Approved revision: 1006
Merged at revision: 1024
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/40-back-in-header
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/30-optIn-tabsDrawer
Diff against target: 218 lines (+79/-17)
8 files modified
components.api (+1/-0)
modules/Ubuntu/Components/Header.qml (+6/-0)
modules/Ubuntu/Components/Page.qml (+7/-0)
modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+23/-1)
tests/autopilot/ubuntuuitoolkit/emulators.py (+17/-2)
tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+23/-14)
tests/resources/navigation/PageStack.qml (+1/-0)
tests/resources/navigation/StackWithTabs.qml (+1/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/40-back-in-header
Reviewer Review Type Date Requested Status
Florian Boucault (community) Approve
PS Jenkins bot continuous-integration Approve
Leo Arias (community) autopilot bits Approve
Review via email: mp+217212@code.launchpad.net

Commit message

Back button in new header

Description of the change

Back button in new header

To post a comment you must log in.
1002. By Tim Peeters

merge staging

1003. By Tim Peeters

improve AP test

1004. By Tim Peeters

improve doc

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1005. By Tim Peeters

flake8

Revision history for this message
Leo Arias (elopio) wrote :

The autopilot changes look good, thanks for taking care of it.

review: Approve (autopilot bits)
1006. By Tim Peeters

clean back button AP test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1005
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/105/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/443
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5066
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/105
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/105
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/105/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/105
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/396
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4691
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4691/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6410
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4356
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5255
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5255/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/105/rebuild

review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

system-settings-app works well on phone with new back button.

Other apps don't have a stack or need additional functionality in the header before they should be used with useDeprecatedToolbar = false.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1006
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/106/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/446
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5068
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/106
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/106
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/106/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/106
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/399
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4694
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4694/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6413
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4358
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5257
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5257/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/106/rebuild

review: Approve (continuous-integration)
Revision history for this message
Florian Boucault (fboucault) wrote :

I like what I'm seeing here.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2014-04-25 12:06:54 +0000
3+++ components.api 2014-04-25 13:36:06 +0000
4@@ -61,6 +61,7 @@
5 property string title
6 property Item contents
7 property var tabsModel
8+ property var pageStack
9 property Flickable flickable
10 property bool useDeprecatedToolbar
11 Icon 0.1 1.0
12
13=== modified file 'modules/Ubuntu/Components/Header.qml'
14--- modules/Ubuntu/Components/Header.qml 2014-04-24 18:21:34 +0000
15+++ modules/Ubuntu/Components/Header.qml 2014-04-25 13:36:06 +0000
16@@ -94,6 +94,12 @@
17 */
18 property var tabsModel: null
19
20+ /*!
21+ If it is possible to pop this PageStack, a back button will be
22+ shown in the header.
23+ */
24+ property var pageStack: null
25+
26 // FIXME: Currently autopilot can only get visual items, but once bug #1273956
27 // is fixed to support non-visual items, a QtObject may be used.
28 // --timp - 2014-03-20
29
30=== modified file 'modules/Ubuntu/Components/Page.qml'
31--- modules/Ubuntu/Components/Page.qml 2014-04-24 18:21:34 +0000
32+++ modules/Ubuntu/Components/Page.qml 2014-04-25 13:36:06 +0000
33@@ -151,6 +151,13 @@
34 Object {
35 id: internal
36
37+ Binding {
38+ target: internal.header
39+ property: "pageStack"
40+ value: page.pageStack
41+ when: page.active && internal.header != null && page.pageStack != null
42+ }
43+
44 UnityActions.ActionContext {
45 id: actionContext
46
47
48=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml'
49--- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-04-24 18:21:34 +0000
50+++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-04-25 13:36:06 +0000
51@@ -74,13 +74,35 @@
52 width: childrenRect.width
53
54 AbstractButton {
55+ id: backButton
56+ objectName: "backButton"
57+ height: parent ? parent.height : undefined
58+ width: visible ? units.gu(5) : 0
59+
60+ iconName: "back"
61+ visible: styledItem.pageStack !== null &&
62+ styledItem.pageStack.depth > 1
63+
64+ text: "back"
65+
66+ // FIXME: We currently use an AbstractButton with ToolbarButtonStyle because
67+ // a ToolbarButton does not have its own MouseArea to handle interaction,
68+ // that was done in the Toolbar.
69+ style: Theme.createStyleComponent("ToolbarButtonStyle.qml", backButton)
70+
71+ onTriggered: {
72+ styledItem.pageStack.pop();
73+ }
74+ }
75+
76+ AbstractButton {
77 id: tabsButton
78 objectName: "tabsButton"
79 height: parent ? parent.height : undefined
80 width: visible ? units.gu(5) : 0
81
82 iconName: "navigation-menu"
83- visible: styledItem.tabsModel !== null
84+ visible: styledItem.tabsModel !== null && !backButton.visible
85 text: visible ? styledItem.tabsModel.count + " tabs" : ""
86
87 // FIXME: We currently use an AbstractButton with ToolbarButtonStyle because
88
89=== modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py'
90--- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-04-24 12:07:30 +0000
91+++ tests/autopilot/ubuntuuitoolkit/emulators.py 2014-04-25 13:36:06 +0000
92@@ -233,8 +233,11 @@
93 @autopilot_logging.log_action(logger.info)
94 def go_back(self):
95 """Go to the previous page."""
96- toolbar = self.open_toolbar()
97- toolbar.click_back_button()
98+ if self.useDeprecatedToolbar:
99+ toolbar = self.open_toolbar()
100+ toolbar.click_back_button()
101+ else:
102+ self.get_header().click_back_button()
103
104
105 class Header(UbuntuUIToolkitEmulatorBase):
106@@ -244,6 +247,18 @@
107 super(Header, self).__init__(*args)
108 self.pointing_device = get_pointing_device()
109
110+ def click_back_button(self):
111+ if self.useDeprecatedToolbar:
112+ raise ToolkitEmulatorException('Old header has no back button')
113+ try:
114+ back_button = self.select_single(
115+ 'AbstractButton', objectName='backButton')
116+ except dbus.StateNotFoundError:
117+ raise ToolkitEmulatorException('Missing back button in header')
118+ if not back_button.visible:
119+ raise ToolkitEmulatorException('Back button in header not visible')
120+ self.pointing_device.click_object(back_button)
121+
122 def _get_animating(self):
123 if (self.useDeprecatedToolbar):
124 tab_bar_style = self.select_single('TabBarStyle')
125
126=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py'
127--- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-04-23 22:36:54 +0000
128+++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-04-25 13:36:06 +0000
129@@ -887,42 +887,51 @@
130 item.swipe_to_delete()
131 self.assertFalse(item.exists())
132
133-
134-class PageStackTestCase(tests.QMLStringAppTestCase):
135-
136- test_qml = ("""
137+TEST_PAGESTACK_QML_FORMAT = ("""
138 import QtQuick 2.0
139 import Ubuntu.Components 1.0
140
141-MainView {
142+MainView {{
143 width: units.gu(48)
144 height: units.gu(60)
145+ useDeprecatedToolbar: {use_deprecated_toolbar}
146
147- PageStack {
148+ PageStack {{
149 id: pageStack
150 Component.onCompleted: push(page0)
151
152- Page {
153+ Page {{
154 id: page0
155 title: "Page 0"
156 visible: false
157
158- Button {
159+ Button {{
160 objectName: "go_to_page1"
161 text: "Go to page 1"
162 onClicked: pageStack.push(page1)
163- }
164- }
165+ }}
166+ }}
167
168- Page {
169+ Page {{
170 id: page1
171 title: "Page 1"
172 visible: false
173- }
174- }
175-}
176+ }}
177+ }}
178+}}
179 """)
180
181+
182+class PageStackTestCase(tests.QMLStringAppTestCase):
183+ scenarios = [
184+ ('back in toolbar', dict(
185+ test_qml=TEST_PAGESTACK_QML_FORMAT.format(
186+ use_deprecated_toolbar='true'))),
187+ ('back in header', dict(
188+ test_qml=TEST_PAGESTACK_QML_FORMAT.format(
189+ use_deprecated_toolbar='false')))
190+ ]
191+
192 def setUp(self):
193 super(PageStackTestCase, self).setUp()
194 self.header = self.main_view.get_header()
195
196=== modified file 'tests/resources/navigation/PageStack.qml'
197--- tests/resources/navigation/PageStack.qml 2014-04-20 19:25:12 +0000
198+++ tests/resources/navigation/PageStack.qml 2014-04-25 13:36:06 +0000
199@@ -28,6 +28,7 @@
200 width: units.gu(38)
201 height: units.gu(50)
202 anchors.centerIn: parent
203+ useDeprecatedToolbar: false
204
205 PageStack {
206 id: pageStack
207
208=== modified file 'tests/resources/navigation/StackWithTabs.qml'
209--- tests/resources/navigation/StackWithTabs.qml 2014-04-20 19:25:12 +0000
210+++ tests/resources/navigation/StackWithTabs.qml 2014-04-25 13:36:06 +0000
211@@ -21,6 +21,7 @@
212 id: mainView
213 width: units.gu(38)
214 height: units.gu(50)
215+ useDeprecatedToolbar: false
216
217 PageStack {
218 id: pageStack

Subscribers

People subscribed via source and target branches