Merge lp:~dandrader/unity/phablet_autopilotTouchOnly into lp:unity/phablet

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Michał Sawicz
Approved revision: no longer in the source branch.
Merged at revision: 708
Proposed branch: lp:~dandrader/unity/phablet_autopilotTouchOnly
Merge into: lp:unity/phablet
Diff against target: 245 lines (+44/-57)
4 files modified
debian/control (+1/-0)
tests/autopilot/qml_phone_shell/tests/__init__.py (+4/-4)
tests/autopilot/qml_phone_shell/tests/helpers.py (+19/-29)
tests/autopilot/qml_phone_shell/tests/testcases.py (+20/-24)
To merge this branch: bzr merge lp:~dandrader/unity/phablet_autopilotTouchOnly
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michał Sawicz Approve
Albert Astals Cid (community) Approve
Review via email: mp+165666@code.launchpad.net

Commit message

Make autopilot tests use only touch instead of mouse

To better emulate what happens on real usage, as phone and tablet UIs are
touch (not mouse) operated.

Includes some minor refactoring here and there as well.

Description of the change

Make autopilot tests use only touch instead of mouse

To better emulate what happens on real usage, as phone and tablet UIs are touch (not mouse) operated.

Includes some minor refactoring here and there as well.

To post a comment you must log in.
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)
Revision history for this message
Albert Astals Cid (aacid) wrote :

In
30 - self.pointing_device.move_to_object(password_field)
31 + self.touch.tap_object(password_field)
32 self.assertThat(password_field.opacity, Eventually(Equals(1)))
33 - self.pointing_device.click()

I remember we added the opacity assert because sometimes we had problems with the click not happening, i guess it'd make sense to do the same and put the tap after the opacity assert

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> In
> 30 - self.pointing_device.move_to_object(password_field)
> 31 + self.touch.tap_object(password_field)
> 32 self.assertThat(password_field.opacity, Eventually(Equals(1)))
> 33 - self.pointing_device.click()
>
> I remember we added the opacity assert because sometimes we had problems with
> the click not happening, i guess it'd make sense to do the same and put the
> tap after the opacity assert

Fixed.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me, let's wait for CI

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Jenkins failed because of merge conflicts.

Revision history for this message
Michał Sawicz (saviq) wrote :

Please go "wrap-and-sort" in the source tree while you're at it.

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

With that change, shouldn't we drop "-mousetouch" from the autopilot calls?

review: Needs Information
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> With that change, shouldn't we drop "-mousetouch" from the autopilot calls?

It's not needed but it does no harm either.

But ok, I've removed the "-mousetouch" arguments.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Jenkins failed because of merge conflicts.

Solved. Rebased on top of latest trunk.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Please go "wrap-and-sort" in the source tree while you're at it.

Done. Put python-evdev dependency in the correct, ordered, place.

Revision history for this message
Michał Sawicz (saviq) wrote :

Pending CI.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-05-27 07:00:02 +0000
3+++ debian/control 2013-05-29 11:59:29 +0000
4@@ -67,6 +67,7 @@
5 Depends: libautopilot-qt,
6 libqt5test5,
7 libqt5widgets5,
8+ python-evdev,
9 qml-phone-shell (= ${source:Version}),
10 qml-phone-shell-fake-env (= ${source:Version}),
11 ${misc:Depends},
12
13=== modified file 'tests/autopilot/qml_phone_shell/tests/__init__.py'
14--- tests/autopilot/qml_phone_shell/tests/__init__.py 2013-05-24 09:36:28 +0000
15+++ tests/autopilot/qml_phone_shell/tests/__init__.py 2013-05-29 11:59:29 +0000
16@@ -41,20 +41,20 @@
17 os.environ['QML2_IMPORT_PATH'] = "../../builddir/tests/mocks:../../builddir/plugins"
18 if geometry != "0x0":
19 self.app = self.launch_test_application(
20- "../../builddir/qml-phone-shell", "-geometry", geometry, "-frameless", "-mousetouch")
21+ "../../builddir/qml-phone-shell", "-geometry", geometry, "-frameless")
22 else:
23 self.app = self.launch_test_application(
24- "../../builddir/qml-phone-shell", "-fullscreen", "-mousetouch")
25+ "../../builddir/qml-phone-shell", "-fullscreen")
26
27 def launch_test_installed(self, geometry):
28 os.environ['LD_LIBRARY_PATH'] = "/usr/share/qml-phone-shell/plugins/mocks/LightDM/full"
29 os.environ['QML2_IMPORT_PATH'] = "/usr/share/qml-phone-shell/plugins/mocks:/usr/share/qml-phone-shell/plugins"
30 if model() == 'Desktop' and geometry != "0x0":
31 self.app = self.launch_test_application(
32- "qml-phone-shell", "-geometry", geometry, "-frameless", "-mousetouch")
33+ "qml-phone-shell", "-geometry", geometry, "-frameless")
34 else:
35 self.app = self.launch_test_application(
36- "qml-phone-shell", "-fullscreen", "-mousetouch")
37+ "qml-phone-shell", "-fullscreen")
38
39 def skipWrapper(*args, **kwargs):
40 pass
41
42=== modified file 'tests/autopilot/qml_phone_shell/tests/helpers.py'
43--- tests/autopilot/qml_phone_shell/tests/helpers.py 2013-05-23 18:07:17 +0000
44+++ tests/autopilot/qml_phone_shell/tests/helpers.py 2013-05-29 11:59:29 +0000
45@@ -44,8 +44,7 @@
46 if target_user is None:
47 break
48 user_label = target_user.get_children_by_type("Label")[0]
49- self.pointing_device.move_to_object(user_label)
50- self.pointing_device.click()
51+ self.touch.tap_object(user_label)
52 self.assertThat(path_view.movingInternally, Eventually(Equals(False)))
53 if user_label.text == username:
54 return login_list.get_children_by_type("TextField")[0]
55@@ -58,9 +57,8 @@
56
57 if greeter.multiUser:
58 password_field = self.select_greeter_user("No Password")
59- self.pointing_device.move_to_object(password_field)
60 self.assertThat(password_field.opacity, Eventually(Equals(1)))
61- self.pointing_device.click()
62+ self.touch.tap_object(password_field)
63
64 else:
65 rect = greeter.globalRect
66@@ -68,10 +66,7 @@
67 start_y = int(rect[1] + rect[3] / 2)
68 stop_x = int(rect[0] + rect[2] * 0.2)
69 stop_y = start_y
70- self.pointing_device.move(start_x, start_y)
71- self.pointing_device.press()
72- self.pointing_device.move(stop_x, stop_y)
73- self.pointing_device.release()
74+ self.touch.drag(start_x, start_y, stop_x, stop_y)
75
76 # Because the shell loads up lots of stuff, unlocking the greeter can
77 # be a bit stuttery while lenses are still consuming all resources.
78@@ -93,8 +88,7 @@
79 self.assertThat(app_grid.get_children()[0].totalContentHeight, Eventually(NotEquals(0)))
80 self.assertThat(app_grid.get_children()[0].height, Eventually(Equals(app_grid.get_children()[0].totalContentHeight)))
81 first_app = app_grid.get_children()[0].get_children()[0].get_children()[0].get_children()[0]
82- self.pointing_device.move_to_object(first_app)
83- self.pointing_device.click()
84+ self.touch.tap_object(first_app)
85 bottombar = self.main_window.get_bottombar()
86
87 # if we have huge amounts of pixels (e.g. Nexus10), but slow video (e.g. VM) it might take a little
88@@ -116,30 +110,31 @@
89
90 hud_show_button = self.main_window.get_hud_show_button()
91 hud = self.main_window.get_hud()
92- rect = hud.globalRect
93- start_x = int(rect[0] + rect[2] / 2)
94- start_y = rect[1] + rect[3] - 1
95- self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
96- self.pointing_device.move(start_x, start_y)
97- self.pointing_device.press()
98- self.pointing_device.move(start_x, start_y - self.grid_size)
99- self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
100- self.pointing_device.move(start_x, start_y - self.grid_size * 2)
101+ window = self.main_window.get_qml_view()
102+ start_x = int(window.x + window.width / 2)
103+ start_y = window.y + window.height - 3
104+ self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
105+ self.touch.press(start_x, start_y)
106+ self.touch._finger_move(start_x, start_y - self.grid_size)
107+ self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
108+ self.touch._finger_move(start_x, start_y - self.grid_size * 2)
109+ self.touch._finger_move(start_x, start_y - self.grid_size * 3)
110+ self.touch._finger_move(start_x, start_y - self.grid_size * 4)
111 try:
112 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
113 except:
114 if retries > 0:
115 logger.warning("Failed to get hud button to show. Retrying...")
116- self.pointing_device.release()
117+ self.touch.release()
118 self.show_hud(retries-1)
119 return
120 else:
121 logger.warning("Failed to get hud button to show. Giving up. Tests may fail...")
122 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
123- self.pointing_device.move(start_x, start_y - self.grid_size * 34)
124+ self.touch._finger_move(start_x, start_y - self.grid_size * 34)
125 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
126 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(True)))
127- self.pointing_device.release()
128+ self.touch.release()
129 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
130 self.assertThat(hud.shown, Eventually(Equals(True)))
131
132@@ -149,8 +144,7 @@
133 rect = hud.globalRect
134 x = int(rect[0] + rect[2] / 2)
135 y = rect[1] + self.grid_size
136- self.pointing_device.move(x, y)
137- self.pointing_device.click()
138+ self.touch.tap(x, y)
139 self.assertThat(hud.shown, Eventually(Equals(False)))
140
141 def show_launcher(self):
142@@ -160,9 +154,5 @@
143 start_y = view.y + view.height / 2
144 stop_x = start_x + launcher.shortcutsWidth + 1
145 stop_y = start_y
146- self.pointing_device.move(start_x, start_y)
147- self.pointing_device.press()
148- self.pointing_device.move(stop_x, stop_y)
149- self.assertThat(launcher.state, Eventually(Equals("spreadMoving")))
150- self.pointing_device.release()
151+ self.touch.drag(start_x, start_y, stop_x, stop_y)
152 self.assertThat(launcher.shown, Eventually(Equals(True)))
153
154=== modified file 'tests/autopilot/qml_phone_shell/tests/testcases.py'
155--- tests/autopilot/qml_phone_shell/tests/testcases.py 2013-05-14 14:27:05 +0000
156+++ tests/autopilot/qml_phone_shell/tests/testcases.py 2013-05-29 11:59:29 +0000
157@@ -52,22 +52,19 @@
158
159 if model() == 'Desktop':
160 scenarios = [
161- # Nexus4
162- ('with mouse', dict(input_device_class=Mouse, app_width=768, app_height=1280, grid_unit_px=18)),
163- # Nexus10
164- ('with mouse', dict(input_device_class=Mouse, app_width=2560, app_height=1600, grid_unit_px=20)),
165+ ('Nexus 4', dict(app_width=768, app_height=1280, grid_unit_px=18)),
166+ ('Nexus 10', dict(app_width=2560, app_height=1600, grid_unit_px=20)),
167 # TODO: don't run fullscreen tests just yet as the VM is performing too badly for that. Enable this once
168 # Autopilot tests are running on bear metal.
169-# ('with mouse', dict(input_device_class=Mouse, app_width=0, app_height=0, grid_unit_px=10)),
170+# ('Fullscreen', dict(app_width=0, app_height=0, grid_unit_px=10)),
171 ]
172 else:
173 scenarios = [
174- # Fullscreen
175- ('with touch', dict(input_device_class=Touch, app_width=0, app_height=0, grid_unit_px=0)),
176+ ('Fullscreen', dict(app_width=0, app_height=0, grid_unit_px=0)),
177 ]
178
179 def setUp(self):
180- self.pointing_device = Pointer(self.input_device_class.create())
181+ self.touch = Touch.create()
182
183 sg = Display().create()
184 divisor = 1
185@@ -89,24 +86,25 @@
186 self.open_first_dash_home_app()
187 hud_show_button = self.main_window.get_hud_show_button()
188 hud = self.main_window.get_hud()
189- rect = hud.globalRect
190- start_x = int(rect[0] + rect[2] / 2)
191- start_y = rect[1] + rect[3] - 1
192- self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
193- self.pointing_device.move(start_x, start_y)
194- self.pointing_device.press()
195- self.pointing_device.move(start_x, start_y - self.grid_size)
196- self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
197- self.pointing_device.move(start_x, start_y - self.grid_size * 2)
198+ window = self.main_window.get_qml_view()
199+ start_x = int(window.x + window.width / 2)
200+ start_y = window.y + window.height - 2
201+ self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
202+ self.touch.press(start_x, start_y)
203+ self.touch._finger_move(start_x, start_y - self.grid_size)
204+ self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
205+ self.touch._finger_move(start_x, start_y - self.grid_size * 2)
206+ self.touch._finger_move(start_x, start_y - self.grid_size * 3)
207+ self.touch._finger_move(start_x, start_y - self.grid_size * 4)
208 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
209 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
210- self.pointing_device.move(start_x, start_y - self.grid_size * 34)
211+ self.touch._finger_move(start_x, start_y - self.grid_size * 34)
212 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
213 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(True)))
214- self.pointing_device.move(start_x, start_y - self.grid_size)
215+ self.touch._finger_move(start_x, start_y - self.grid_size)
216 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
217 self.assertThat(hud_show_button.mouseOver, Eventually(Equals(False)))
218- self.pointing_device.release()
219+ self.touch.release()
220 self.assertThat(hud_show_button.opacity, Eventually(Equals(0)))
221 self.assertThat(hud.shown, Eventually(Equals(False)))
222
223@@ -124,8 +122,7 @@
224 rect = hud.globalRect
225 x = int(rect[0] + rect[2] / 2)
226 y = rect[1] + hud.handleHeight + 1
227- self.pointing_device.move(x, y)
228- self.pointing_device.click()
229+ self.touch.tap(x, y)
230 self.assertRaises(MismatchError, lambda: self.assertThat(hud.shown, Eventually(Equals(False), timeout=3)))
231
232 def test_hide_hud_dragging(self):
233@@ -137,11 +134,10 @@
234 start_y = rect[1] + 1
235 stop_x = start_x
236 stop_y = start_y + (rect[3] - rect[1]) / 2
237- self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
238+ self.touch.drag(start_x, start_y, stop_x, stop_y)
239 self.assertThat(hud.shown, Eventually(Equals(False)))
240
241 def test_hide_hud_launcher(self):
242- launcher = self.main_window.get_hud()
243 hud = self.main_window.get_hud()
244 self.unlock_greeter()
245 self.show_hud()

Subscribers

People subscribed via source and target branches