Merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/make_flickable_methods_public into lp:ubuntu-ui-toolkit/staging

Proposed by Leo Arias
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1179
Merged at revision: 1187
Proposed branch: lp:~canonical-platform-qa/ubuntu-ui-toolkit/make_flickable_methods_public
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 153 lines (+38/-15)
3 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+15/-8)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py (+3/-3)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+20/-4)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/make_flickable_methods_public
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zsombor Egri Approve
Omer Akram (community) Approve
Review via email: mp+229354@code.launchpad.net

Commit message

Made public the swipe methods in the flickable autopilot helper.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

The swipe_to_show_more methods are already tested extensively.

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

PASSED: Continuous integration, rev:1178
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/718/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2957
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2345
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/550
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/550
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/550/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/550
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3015
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4200
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4200/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10904
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1940
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2611
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2611/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/718/rebuild

review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Hi Leo,

Good work there, it would have been more easy for review if you had made a commit for only making private methods public. though its a small MR so no problem.

130 + def test_swipe_int_view_top_element(self):

you have a type there, make it 'into'

Other than that code looks good. nice work.

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

Thanks for the review Omer. I fixed it.

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

PASSED: Continuous integration, rev:1179
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/724/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/2987
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2367
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/556
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/556
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/556/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/556
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3040
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4230
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4230/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10941
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1960
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2633
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2633/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/724/rebuild

review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Thanks!

review: Approve
Revision history for this message
Zsombor Egri (zsombi) wrote :

Thanks!

review: Approve
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 :

FAILED: Continuous integration, rev:1179
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/771/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3317
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2595
    FAILURE: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/603/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/603
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/603/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/603/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3257
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4562
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4562/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11246
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2106
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2869
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2869/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/771/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

Finally :) Thanks for the review zsombi.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py'
2--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-06-18 05:35:24 +0000
3+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-08-04 15:29:48 +0000
4@@ -110,16 +110,16 @@
5 # Check the direction of the swipe based on the position of the
6 # child relative to the immediate flickable container.
7 if child.globalRect.y < self.globalRect.y:
8- self._swipe_to_show_more_above(containers)
9+ self.swipe_to_show_more_above(containers)
10 else:
11- self._swipe_to_show_more_below(containers)
12+ self.swipe_to_show_more_below(containers)
13
14 if self.contentY == original_content_y:
15 raise _common.ToolkitException(
16 "Couldn't swipe in the flickable.")
17
18 @autopilot_logging.log_action(logger.info)
19- def _swipe_to_show_more_above(self, containers):
20+ def swipe_to_show_more_above(self, containers):
21 if self.atYBeginning:
22 raise _common.ToolkitException(
23 "Can't swipe more, we are already at the top of the "
24@@ -128,7 +128,7 @@
25 self._swipe_to_show_more('above', containers)
26
27 @autopilot_logging.log_action(logger.info)
28- def _swipe_to_show_more_below(self, containers):
29+ def swipe_to_show_more_below(self, containers):
30 if self.atYEnd:
31 raise _common.ToolkitException(
32 "Can't swipe more, we are already at the bottom of the "
33@@ -160,11 +160,18 @@
34 self.moving.wait_for(False)
35
36 @autopilot_logging.log_action(logger.info)
37- def _swipe_to_top(self):
38+ def swipe_to_top(self):
39 if not self.atYBeginning:
40 containers = self._get_containers()
41 while not self.atYBeginning:
42- self._swipe_to_show_more_above(containers)
43+ self.swipe_to_show_more_above(containers)
44+
45+ @autopilot_logging.log_action(logger.info)
46+ def swipe_to_bottom(self):
47+ if not self.atYEnd:
48+ containers = self._get_containers()
49+ while not self.atYEnd:
50+ self.swipe_to_show_more_below(containers)
51
52 @autopilot_logging.log_action(logger.info)
53 def pull_to_refresh(self):
54@@ -179,7 +186,7 @@
55 except autopilot.exceptions.StateNotFoundError:
56 raise _common.ToolkitException(
57 'The flickable has no pull to refresh functionality.')
58- self._swipe_to_top()
59+ self.swipe_to_top()
60 self._swipe_to_middle()
61 pull_to_refresh.wait_for_refresh()
62
63@@ -202,7 +209,7 @@
64 """Swipe down the list and then swipe it up to cancel the refresh."""
65 # This method is kept private because it's not for the test writers to
66 # call. It's to test pull to refresh. --elopio - 2014-05-22
67- self._swipe_to_top()
68+ self.swipe_to_top()
69 start_x = stop_x = self.globalRect.x + (self.globalRect.width // 2)
70 # Start just a little under the top.
71 containers = self._get_containers()
72
73=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py'
74--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2014-05-27 04:55:40 +0000
75+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2014-08-04 15:29:48 +0000
76@@ -53,15 +53,15 @@
77 if direction is None:
78 # We don't know where the object is so we start looking for it from
79 # the top.
80- self._swipe_to_top()
81+ self.swipe_to_top()
82 direction = 'below'
83
84 if direction == 'below':
85 fail_condition = lambda: self.atYEnd
86- swipe_method = self._swipe_to_show_more_below
87+ swipe_method = self.swipe_to_show_more_below
88 elif direction == 'above':
89 fail_condition = lambda: self.atYBeginning
90- swipe_method = self._swipe_to_show_more_above
91+ swipe_method = self.swipe_to_show_more_above
92 else:
93 raise _common.ToolkitException(
94 'Invalid direction: {}'.format(direction))
95
96=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
97--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-07-10 09:00:26 +0000
98+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-08-04 15:29:48 +0000
99@@ -89,7 +89,7 @@
100 self.assertEqual(element.is_flickable(), self.is_flickable)
101
102
103-class SwipeIntoViewTestCase(tests.QMLStringAppTestCase):
104+class SwipeFlickableTestCase(tests.QMLStringAppTestCase):
105
106 test_qml = ("""
107 import QtQuick 2.0
108@@ -140,12 +140,14 @@
109 """)
110
111 def setUp(self):
112- super(SwipeIntoViewTestCase, self).setUp()
113+ super(SwipeFlickableTestCase, self).setUp()
114+ self.flickable = self.main_view.select_single(
115+ ubuntuuitoolkit.QQuickFlickable, objectName='flickable')
116 self.label = self.main_view.select_single(
117 'Label', objectName='clickedLabel')
118 self.assertEqual(self.label.text, 'No element clicked.')
119
120- def test_swipe_to_bottom(self):
121+ def test_swipe_into_view_bottom_element(self):
122 self.main_view.close_toolbar()
123
124 button = self.main_view.select_single(objectName='bottomButton')
125@@ -154,7 +156,7 @@
126 self.pointing_device.click_object(button)
127 self.assertEqual(self.label.text, 'bottomButton')
128
129- def test_swipe_to_top(self):
130+ def test_swipe_into_view_top_element(self):
131 self.main_view.close_toolbar()
132 bottomButton = self.main_view.select_single(objectName='bottomButton')
133 bottomButton.swipe_into_view()
134@@ -165,6 +167,20 @@
135 self.pointing_device.click_object(topButton)
136 self.assertEqual(self.label.text, 'topButton')
137
138+ def test_swipe_to_top_must_leave_flickable_at_y_beginning(self):
139+ self.flickable.swipe_to_bottom()
140+ self.assertFalse(self.flickable.atYBeginning)
141+
142+ self.flickable.swipe_to_top()
143+ self.assertTrue(self.flickable.atYBeginning)
144+
145+ def test_swipe_to_bottom_must_leave_flickable_at_y_end(self):
146+ self.flickable.swipe_to_top()
147+ self.assertFalse(self.flickable.atYEnd)
148+
149+ self.flickable.swipe_to_bottom()
150+ self.assertTrue(self.flickable.atYEnd)
151+
152
153 class UnityFlickableTestCase(tests.QMLStringAppTestCase):
154

Subscribers

People subscribed via source and target branches