Merge lp:~elopio/ubuntu-ui-toolkit/fix1239751_go_back into lp:ubuntu-ui-toolkit

Proposed by Leo Arias
Status: Merged
Approved by: Tim Peeters
Approved revision: 796
Merged at revision: 799
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/fix1239751_go_back
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 101 lines (+65/-0)
3 files modified
modules/Ubuntu/Components/ToolbarItems.qml (+1/-0)
tests/autopilot/ubuntuuitoolkit/emulators.py (+9/-0)
tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+55/-0)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/fix1239751_go_back
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Martin Pitt (community) Approve
Ubuntu SDK team Pending
Review via email: mp+191002@code.launchpad.net

Commit message

Added the go back method to the autopilot emulators.

To post a comment you must log in.
796. By Leo Arias

Fixed pep8.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Martin Pitt (pitti) wrote :

Very nice, thank you!

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

PASSED: Continuous integration, rev:796
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/999/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy-vm/420
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/3048
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-saucy-amd64-ci/856
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-saucy-armhf-ci/856
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-saucy-armhf-ci/856/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-vm-saucy/317
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-i386/4568
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-i386/4568/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3050
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/3050/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2555
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2606
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/141
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/140

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/999/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/ToolbarItems.qml'
2--- modules/Ubuntu/Components/ToolbarItems.qml 2013-07-12 10:27:41 +0000
3+++ modules/Ubuntu/Components/ToolbarItems.qml 2013-10-14 16:41:00 +0000
4@@ -137,6 +137,7 @@
5 \endqml
6 */
7 property Item back: ToolbarButton {
8+ objectName: "back_toolbar_button"
9 iconSource: Qt.resolvedUrl("artwork/back.png")
10 text: i18n.tr("Back")
11 visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1
12
13=== modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py'
14--- tests/autopilot/ubuntuuitoolkit/emulators.py 2013-10-02 07:01:03 +0000
15+++ tests/autopilot/ubuntuuitoolkit/emulators.py 2013-10-14 16:41:00 +0000
16@@ -183,6 +183,11 @@
17 return self.select_single(
18 ActionSelectionPopover, objectName=object_name)
19
20+ def go_back(self):
21+ """Go to the previous page."""
22+ toolbar = self.open_toolbar()
23+ toolbar.click_back_button()
24+
25
26 class Header(UbuntuUIToolkitEmulatorBase):
27 """Header Autopilot emulator."""
28@@ -223,6 +228,10 @@
29 def _get_button(self, object_name):
30 return self.select_single('ActionItem', objectName=object_name)
31
32+ def click_back_button(self):
33+ """Click the back button of the toolbar."""
34+ self.click_button('back_toolbar_button')
35+
36
37 class Tabs(UbuntuUIToolkitEmulatorBase):
38 """Tabs Autopilot emulator."""
39
40=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py'
41--- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-10-03 03:35:03 +0000
42+++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-10-14 16:41:00 +0000
43@@ -445,3 +445,58 @@
44 with mock.patch.object(input.Pointer, 'click_object') as mock_click:
45 self.toggle.uncheck()
46 self.assertFalse(mock_click.called)
47+
48+
49+class PageStackTestCase(tests.QMLStringAppTestCase):
50+
51+ test_qml = ("""
52+import QtQuick 2.0
53+import Ubuntu.Components 0.1
54+
55+MainView {
56+ width: units.gu(48)
57+ height: units.gu(60)
58+
59+ PageStack {
60+ id: pageStack
61+ Component.onCompleted: push(page0)
62+
63+ Page {
64+ id: page0
65+ title: "Page 0"
66+ visible: false
67+
68+ Button {
69+ objectName: "go_to_page1"
70+ text: "Go to page 1"
71+ onClicked: pageStack.push(page1)
72+ }
73+ }
74+
75+ Page {
76+ id: page1
77+ title: "Page 1"
78+ visible: false
79+ }
80+ }
81+}
82+""")
83+
84+ def setUp(self):
85+ super(PageStackTestCase, self).setUp()
86+ self.header = self.main_view.get_header()
87+ self.assertEqual(self.header.title, 'Page 0')
88+
89+ def test_open_page(self):
90+ self._go_to_page1()
91+ self.assertEqual(self.header.title, 'Page 1')
92+
93+ def _go_to_page1(self):
94+ button = self.main_view.select_single(
95+ 'Button', objectName='go_to_page1')
96+ self.pointing_device.click_object(button)
97+
98+ def test_go_back(self):
99+ self._go_to_page1()
100+ self.main_view.go_back()
101+ self.assertEqual(self.header.title, 'Page 0')

Subscribers

People subscribed via source and target branches

to status/vote changes: