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
=== modified file 'modules/Ubuntu/Components/ToolbarItems.qml'
--- modules/Ubuntu/Components/ToolbarItems.qml 2013-07-12 10:27:41 +0000
+++ modules/Ubuntu/Components/ToolbarItems.qml 2013-10-14 16:41:00 +0000
@@ -137,6 +137,7 @@
137 \endqml137 \endqml
138 */138 */
139 property Item back: ToolbarButton {139 property Item back: ToolbarButton {
140 objectName: "back_toolbar_button"
140 iconSource: Qt.resolvedUrl("artwork/back.png")141 iconSource: Qt.resolvedUrl("artwork/back.png")
141 text: i18n.tr("Back")142 text: i18n.tr("Back")
142 visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1143 visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1
143144
=== modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py'
--- tests/autopilot/ubuntuuitoolkit/emulators.py 2013-10-02 07:01:03 +0000
+++ tests/autopilot/ubuntuuitoolkit/emulators.py 2013-10-14 16:41:00 +0000
@@ -183,6 +183,11 @@
183 return self.select_single(183 return self.select_single(
184 ActionSelectionPopover, objectName=object_name)184 ActionSelectionPopover, objectName=object_name)
185185
186 def go_back(self):
187 """Go to the previous page."""
188 toolbar = self.open_toolbar()
189 toolbar.click_back_button()
190
186191
187class Header(UbuntuUIToolkitEmulatorBase):192class Header(UbuntuUIToolkitEmulatorBase):
188 """Header Autopilot emulator."""193 """Header Autopilot emulator."""
@@ -223,6 +228,10 @@
223 def _get_button(self, object_name):228 def _get_button(self, object_name):
224 return self.select_single('ActionItem', objectName=object_name)229 return self.select_single('ActionItem', objectName=object_name)
225230
231 def click_back_button(self):
232 """Click the back button of the toolbar."""
233 self.click_button('back_toolbar_button')
234
226235
227class Tabs(UbuntuUIToolkitEmulatorBase):236class Tabs(UbuntuUIToolkitEmulatorBase):
228 """Tabs Autopilot emulator."""237 """Tabs Autopilot emulator."""
229238
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py'
--- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-10-03 03:35:03 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-10-14 16:41:00 +0000
@@ -445,3 +445,58 @@
445 with mock.patch.object(input.Pointer, 'click_object') as mock_click:445 with mock.patch.object(input.Pointer, 'click_object') as mock_click:
446 self.toggle.uncheck()446 self.toggle.uncheck()
447 self.assertFalse(mock_click.called)447 self.assertFalse(mock_click.called)
448
449
450class PageStackTestCase(tests.QMLStringAppTestCase):
451
452 test_qml = ("""
453import QtQuick 2.0
454import Ubuntu.Components 0.1
455
456MainView {
457 width: units.gu(48)
458 height: units.gu(60)
459
460 PageStack {
461 id: pageStack
462 Component.onCompleted: push(page0)
463
464 Page {
465 id: page0
466 title: "Page 0"
467 visible: false
468
469 Button {
470 objectName: "go_to_page1"
471 text: "Go to page 1"
472 onClicked: pageStack.push(page1)
473 }
474 }
475
476 Page {
477 id: page1
478 title: "Page 1"
479 visible: false
480 }
481 }
482}
483""")
484
485 def setUp(self):
486 super(PageStackTestCase, self).setUp()
487 self.header = self.main_view.get_header()
488 self.assertEqual(self.header.title, 'Page 0')
489
490 def test_open_page(self):
491 self._go_to_page1()
492 self.assertEqual(self.header.title, 'Page 1')
493
494 def _go_to_page1(self):
495 button = self.main_view.select_single(
496 'Button', objectName='go_to_page1')
497 self.pointing_device.click_object(button)
498
499 def test_go_back(self):
500 self._go_to_page1()
501 self.main_view.go_back()
502 self.assertEqual(self.header.title, 'Page 0')

Subscribers

People subscribed via source and target branches

to status/vote changes: