Merge lp:~om26er/camera-app/ap_tests_improvements into lp:camera-app
- ap_tests_improvements
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ugo Riboni |
Approved revision: | 137 |
Merged at revision: | 132 |
Proposed branch: | lp:~om26er/camera-app/ap_tests_improvements |
Merge into: | lp:camera-app |
Diff against target: |
505 lines (+136/-92) 5 files modified
tests/autopilot/camera_app/tests/__init__.py (+10/-6) tests/autopilot/camera_app/tests/test_capture.py (+32/-21) tests/autopilot/camera_app/tests/test_flash.py (+13/-7) tests/autopilot/camera_app/tests/test_focus.py (+43/-31) tests/autopilot/camera_app/tests/test_zoom.py (+38/-27) |
To merge this branch: | bzr merge lp:~om26er/camera-app/ap_tests_improvements |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ugo Riboni (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Ubuntu Phablet Team | Pending | ||
Review via email: mp+165733@code.launchpad.net |
Commit message
make the camera-app tests pep8 compliant, improves tests for readability and re-usability of code, skip few tests on the Nexus 7 as camera does not work on it yet.
Description of the change
make the camera-app tests pep8 compliant, improves tests for readability and re-usability of code.
- 133. By Omer Akram
-
simplify
PS Jenkins bot (ps-jenkins) wrote : | # |
- 134. By Omer Akram
-
skip a bunch of tests on the nexus 7 as camera does not work there
- 135. By Omer Akram
-
fix test on phone
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:135
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 136. By Omer Akram
-
separate out the Nexus 7 skip test changes
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:136
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Omer Akram (om26er) wrote : | # |
I have now removed the Nexus 7 specific changes, I'll do that in another branch.
Ugo Riboni (uriboni) wrote : | # |
291 + """Tests clicking outside of the viewfinder image area, where it should
292 + not focus
293 +
294 + """
Why all the extra space ?
346 + center_click_coords = list(self.
347 +
348 + focus_ring_center = self.get_
349 +
Same issue here
356 + drag_end_coords = [focus_
357 + self.pointing_
358 + focus_ring_
359
Since you're improving readability by adding intermediate variable in other places, you might want to do this here for the parameters to drag() too.
- 137. By Omer Akram
-
fix per suggestions
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:137
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:137
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ugo Riboni (uriboni) wrote : | # |
Looks good to me and all tests pass on jenkins, approved.
Preview Diff
1 | === modified file 'tests/autopilot/camera_app/tests/__init__.py' |
2 | --- tests/autopilot/camera_app/tests/__init__.py 2013-05-14 20:27:38 +0000 |
3 | +++ tests/autopilot/camera_app/tests/__init__.py 2013-05-29 11:56:26 +0000 |
4 | @@ -18,18 +18,19 @@ |
5 | |
6 | from camera_app.emulators.main_window import MainWindow |
7 | |
8 | + |
9 | class CameraAppTestCase(AutopilotTestCase): |
10 | |
11 | - """A common test case class that provides several useful methods for camera-app tests.""" |
12 | + """A common test case class that provides several useful methods |
13 | + for camera-app tests. |
14 | |
15 | + """ |
16 | if model() == 'Desktop': |
17 | scenarios = [ |
18 | - ('with mouse', dict(input_device_class=Mouse)) |
19 | - ] |
20 | + ('with mouse', dict(input_device_class=Mouse))] |
21 | else: |
22 | scenarios = [ |
23 | - ('with touch', dict(input_device_class=Touch)) |
24 | - ] |
25 | + ('with touch', dict(input_device_class=Touch))] |
26 | |
27 | local_location = "../../camera-app" |
28 | |
29 | @@ -56,7 +57,10 @@ |
30 | "--desktop_file_hint=/usr/share/applications/camera-app.desktop", |
31 | app_type='qt') |
32 | |
33 | + def get_center(self, object_proxy): |
34 | + x, y, w, h = object_proxy.globalRect |
35 | + return [x + (w / 2), y + (h / 2)] |
36 | + |
37 | @property |
38 | def main_window(self): |
39 | return MainWindow(self.app) |
40 | - |
41 | |
42 | === modified file 'tests/autopilot/camera_app/tests/test_capture.py' |
43 | --- tests/autopilot/camera_app/tests/test_capture.py 2013-05-07 19:07:05 +0000 |
44 | +++ tests/autopilot/camera_app/tests/test_capture.py 2013-05-29 11:56:26 +0000 |
45 | @@ -20,6 +20,7 @@ |
46 | import os |
47 | from os import path |
48 | |
49 | + |
50 | class TestCapture(CameraAppTestCase): |
51 | """Tests the main camera features""" |
52 | |
53 | @@ -27,7 +28,8 @@ |
54 | In the testfarm, the application may take some time to show up.""" |
55 | def setUp(self): |
56 | super(TestCapture, self).setUp() |
57 | - self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
58 | + self.assertThat( |
59 | + self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
60 | |
61 | def tearDown(self): |
62 | super(TestCapture, self).tearDown() |
63 | @@ -39,21 +41,23 @@ |
64 | pictures_dir = path.expanduser("~/Pictures") |
65 | |
66 | # Remove all pictures from ~/Pictures that match our pattern |
67 | - files = [ f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir,f))] |
68 | + files = [f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir, f))] |
69 | for f in files: |
70 | os.remove(path.join(pictures_dir, f)) |
71 | |
72 | - # Wait for the camera to have finished focusing (the exposure button gets enabled when ready) |
73 | + # Wait for the camera to have finished focusing |
74 | + # (the exposure button gets enabled when ready) |
75 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) |
76 | |
77 | # Now take the picture! (Give it a little time to animate) |
78 | self.pointing_device.move_to_object(exposure_button) |
79 | self.pointing_device.click() |
80 | |
81 | - # Check that only one picture with the right name pattern is actually there |
82 | + # Check that only one picture with the right name pattern |
83 | + # is actually there |
84 | one_picture_on_disk = False |
85 | for i in range(0, 10): |
86 | - files = [ f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir,f))] |
87 | + files = [f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir, f))] |
88 | if len(files) == 1: |
89 | one_picture_on_disk = True |
90 | break |
91 | @@ -78,7 +82,7 @@ |
92 | |
93 | # Click the record button to toggle photo/video mode |
94 | self.pointing_device.move_to_object(record_control) |
95 | - self.pointing_device.click(); |
96 | + self.pointing_device.click() |
97 | |
98 | # Has the flash changed to be a torch ? |
99 | self.assertThat(flash_button.flashState, Eventually(Equals("off"))) |
100 | @@ -91,24 +95,27 @@ |
101 | |
102 | # Click the exposure button to start recording |
103 | self.pointing_device.move_to_object(exposure_button) |
104 | - self.pointing_device.click(); |
105 | + self.pointing_device.click() |
106 | |
107 | - # Record video for 2 seconds and check if the stop watch actually runs and |
108 | - # is visible. |
109 | - # Since the timer is not precise we don't check the actual time, just that it |
110 | - # is not counting zero anymore. |
111 | + # Record video for 2 seconds and check if the stop watch actually |
112 | + # runs and is visible. |
113 | + # Since the timer is not precise we don't check the actual time, |
114 | + # just that it is not counting zero anymore. |
115 | self.assertThat(stop_watch.opacity, Eventually(Equals(1.0))) |
116 | self.assertThat(stop_watch.elapsed, Eventually(NotEquals("00:00"))) |
117 | |
118 | - # Now stop the video and check if everything resets itself to previous states |
119 | + # Now stop the video and check if everything resets itself to |
120 | + # previous states. |
121 | self.pointing_device.click() |
122 | |
123 | self.assertThat(stop_watch.opacity, Eventually(Equals(0.0))) |
124 | |
125 | - # Now start recording a second video and check if everything still works |
126 | - self.pointing_device.click(); |
127 | + # Now start recording a second video and check if everything |
128 | + # still works |
129 | + self.pointing_device.click() |
130 | |
131 | - # Has the flash changed to be a torch, is the stop watch visible and set to 00:00? |
132 | + # Has the flash changed to be a torch, is the stop watch visible |
133 | + # and set to 00:00? |
134 | self.assertThat(flash_button.flashState, Eventually(Equals("off"))) |
135 | self.assertThat(flash_button.torchMode, Eventually(Equals(True))) |
136 | self.assertThat(stop_watch.opacity, Eventually(Equals(1.0))) |
137 | @@ -117,16 +124,20 @@ |
138 | # Record video for 2 seconds and check if the stop watch actually works |
139 | self.assertThat(stop_watch.elapsed, Eventually(NotEquals("00:00"))) |
140 | |
141 | - # Now stop the video and go back to picture mode and check if everything resets itself to previous states |
142 | - self.pointing_device.click(); |
143 | + # Now stop the video and go back to picture mode and check if |
144 | + # everything resets itself to previous states |
145 | + self.pointing_device.click() |
146 | self.pointing_device.move_to_object(record_control) |
147 | - self.pointing_device.click(); |
148 | + self.pointing_device.click() |
149 | |
150 | self.assertThat(stop_watch.opacity, Eventually(Equals(0.0))) |
151 | - self.assertThat(flash_button.flashState, Eventually(Equals(flashlight_old_state))) |
152 | - self.assertThat(flash_button.torchMode, Eventually(Equals(torchmode_old_state))) |
153 | + self.assertThat( |
154 | + flash_button.flashState, Eventually(Equals(flashlight_old_state))) |
155 | + self.assertThat( |
156 | + flash_button.torchMode, Eventually(Equals(torchmode_old_state))) |
157 | |
158 | - """Test that the shoot button gets disabled for a while then re-enabled after shooting""" |
159 | + """Test that the shoot button gets disabled for a while then re-enabled |
160 | + after shooting""" |
161 | def test_shoot_button_disable(self): |
162 | exposure_button = self.main_window.get_exposure_button() |
163 | |
164 | |
165 | === modified file 'tests/autopilot/camera_app/tests/test_flash.py' |
166 | --- tests/autopilot/camera_app/tests/test_flash.py 2013-04-26 13:22:45 +0000 |
167 | +++ tests/autopilot/camera_app/tests/test_flash.py 2013-05-29 11:56:26 +0000 |
168 | @@ -16,6 +16,7 @@ |
169 | |
170 | import time |
171 | |
172 | + |
173 | class TestCameraFlash(CameraAppTestCase): |
174 | """Tests the flash""" |
175 | |
176 | @@ -23,7 +24,8 @@ |
177 | In the testfarm, the application may take some time to show up.""" |
178 | def setUp(self): |
179 | super(TestCameraFlash, self).setUp() |
180 | - self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
181 | + self.assertThat( |
182 | + self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
183 | |
184 | def tearDown(self): |
185 | super(TestCameraFlash, self).tearDown() |
186 | @@ -77,8 +79,8 @@ |
187 | flash_button = self.main_window.get_flash_button() |
188 | record_button = self.main_window.get_record_control() |
189 | |
190 | - # Change flash mode, then switch to camera, then back to flash and verify |
191 | - # that previous state is preserved |
192 | + # Change flash mode, then switch to camera, then back to flash |
193 | + # and verify that previous state is preserved |
194 | self.pointing_device.move_to_object(flash_button) |
195 | self.pointing_device.click() |
196 | self.pointing_device.click() |
197 | @@ -90,10 +92,12 @@ |
198 | self.assertThat(flash_button.torchMode, Equals(True)) |
199 | |
200 | self.pointing_device.click() |
201 | - self.assertThat(flash_button.flashState, Eventually(Equals(old_flash_state))) |
202 | + self.assertThat( |
203 | + flash_button.flashState, Eventually(Equals(old_flash_state))) |
204 | self.assertThat(flash_button.torchMode, Equals(False)) |
205 | |
206 | - # Now test the same thing in the opposite way, seeing if torch state is preserved |
207 | + # Now test the same thing in the opposite way, seeing if torch state |
208 | + # is preserved |
209 | self.pointing_device.click() |
210 | self.assertThat(flash_button.flashState, Eventually(Equals("off"))) |
211 | self.assertThat(flash_button.torchMode, Equals(True)) |
212 | @@ -104,9 +108,11 @@ |
213 | |
214 | self.pointing_device.move_to_object(record_button) |
215 | self.pointing_device.click() |
216 | - self.assertThat(flash_button.flashState, Eventually(Equals(old_flash_state))) |
217 | + self.assertThat( |
218 | + flash_button.flashState, Eventually(Equals(old_flash_state))) |
219 | self.assertThat(flash_button.torchMode, Equals(False)) |
220 | |
221 | self.pointing_device.click() |
222 | - self.assertThat(flash_button.flashState, Eventually(Equals(old_torch_state))) |
223 | + self.assertThat( |
224 | + flash_button.flashState, Eventually(Equals(old_torch_state))) |
225 | self.assertThat(flash_button.torchMode, Equals(True)) |
226 | |
227 | === modified file 'tests/autopilot/camera_app/tests/test_focus.py' |
228 | --- tests/autopilot/camera_app/tests/test_focus.py 2013-04-26 13:22:45 +0000 |
229 | +++ tests/autopilot/camera_app/tests/test_focus.py 2013-05-29 11:56:26 +0000 |
230 | @@ -17,6 +17,7 @@ |
231 | import unittest |
232 | import time |
233 | |
234 | + |
235 | class TestFocus(CameraAppTestCase): |
236 | """Tests the focus""" |
237 | |
238 | @@ -24,7 +25,8 @@ |
239 | In the testfarm, the application may take some time to show up.""" |
240 | def setUp(self): |
241 | super(TestFocus, self).setUp() |
242 | - self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
243 | + self.assertThat( |
244 | + self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
245 | |
246 | def tearDown(self): |
247 | super(TestFocus, self).tearDown() |
248 | @@ -41,13 +43,13 @@ |
249 | # The focus ring should be invisible in the beginning |
250 | self.assertEquals(focus_ring.opacity, 0.0) |
251 | |
252 | - # Click in the center of the viewfinder area |
253 | - click_coords = [feed.globalRect[2] / 2 + feed.globalRect[0], feed.globalRect[3] / 2 + feed.globalRect[1]] |
254 | - self.pointing_device.move(click_coords[0], click_coords[1]) |
255 | + self.pointing_device.move_to_object(feed) |
256 | self.pointing_device.click() |
257 | + click_coords = list(self.pointing_device.position()) |
258 | |
259 | - # The focus ring sould be visible and centered to the mouse click coords now |
260 | - focus_ring_center = [focus_ring.globalRect[2] / 2 + focus_ring.globalRect[0], focus_ring.globalRect[3] / 2 + focus_ring.globalRect[1]] |
261 | + # The focus ring sould be visible and centered to the mouse click |
262 | + # coords now |
263 | + focus_ring_center = self.get_center(focus_ring) |
264 | self.assertThat(focus_ring.opacity, Eventually(Equals(1.0))) |
265 | self.assertEquals(focus_ring_center, click_coords) |
266 | |
267 | @@ -60,20 +62,22 @@ |
268 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) |
269 | |
270 | # Click in the center of the viewfinder area |
271 | - click_coords = [feed.globalRect[2] / 2 + feed.globalRect[0], feed.globalRect[3] / 2 + feed.globalRect[1]] |
272 | + click_coords =[feed.globalRect[2] / 2 + feed.globalRect[0], feed.globalRect[3] / 2 + feed.globalRect[1]] |
273 | self.pointing_device.move(click_coords[0], click_coords[1]) |
274 | self.pointing_device.click() |
275 | |
276 | - # The focus ring sould be visible and centered to the mouse click coords now |
277 | - focus_ring_center = [focus_ring.globalRect[2] / 2 + focus_ring.globalRect[0], focus_ring.globalRect[3] / 2 + focus_ring.globalRect[1]] |
278 | + # The focus ring sould be visible and centered to the mouse |
279 | + # click coords now |
280 | + focus_ring_center = self.get_center(focus_ring) |
281 | self.assertThat(focus_ring.opacity, Eventually(Equals(1.0))) |
282 | self.assertEquals(focus_ring_center, click_coords) |
283 | |
284 | # After some seconds the focus ring should fade out |
285 | self.assertThat(focus_ring.opacity, Eventually(Equals(0.0))) |
286 | |
287 | - """Tests clicking outside of the viewfinder image area, where it should not focus""" |
288 | def test_focus_invalid(self): |
289 | + """Tests clicking outside of the viewfinder image area, where it should |
290 | + not focus.""" |
291 | camera_window = self.main_window.get_camera() |
292 | toolbar = self.main_window.get_toolbar() |
293 | zoom = self.main_window.get_zoom_control() |
294 | @@ -85,16 +89,21 @@ |
295 | # The focus ring should be invisible in the beginning |
296 | self.assertEquals(focus_ring.opacity, 0.0) |
297 | |
298 | - # Click at the bottom of the window below the toolbar. It should never focus there. |
299 | - click_coords = [toolbar.globalRect[2] / 2 + toolbar.globalRect[0], toolbar.globalRect[1] + toolbar.globalRect[3] + 2] |
300 | - self.pointing_device.move(click_coords[0], click_coords[1]) |
301 | + x, y, h, w = toolbar.globalRect |
302 | + tx = x + (h / 2) |
303 | + ty = y + (w + 2) |
304 | + # Click at the bottom of the window below the toolbar. It should never |
305 | + # focus there. |
306 | + self.pointing_device.move(tx, ty) |
307 | self.pointing_device.click() |
308 | self.assertEquals(focus_ring.opacity, 0.0) |
309 | |
310 | - # Check if there's a gap between the viewfinder feed and the zoom control. |
311 | - # If there is, test that focusing there won't show the focus ring. |
312 | + # Check if there's a gap between the viewfinder feed and the zoom |
313 | + # control. If there is, test that focusing there won't show the focus |
314 | + #ring. |
315 | if zoom.y > feed.height: # Feed is aligned to the top of the window |
316 | - click_coords = [zoom.globalRect[2] / 2 + zoom.globalRect[0], zoom.globalRect[1] - 2] |
317 | + x, y, h, w = zoom.globalRect |
318 | + click_coords = [x + (h / 2), y - 2] |
319 | self.pointing_device.move(click_coords[0], click_coords[1]) |
320 | self.pointing_device.click() |
321 | self.assertEquals(focus_ring.opacity, 0.0) |
322 | @@ -106,7 +115,8 @@ |
323 | |
324 | # Maybe we will have the gap when we switch the camera, test it again |
325 | if zoom.y > feed.height: |
326 | - click_coords = [zoom.globalRect[2] / 2 + zoom.globalRect[0], zoom.globalRect[1] - 2] |
327 | + x, y, h, w = zoom.globalRect |
328 | + click_coords = [x + (h / 2), y - 2] |
329 | self.pointing_device.move(click_coords[0], click_coords[1]) |
330 | self.pointing_device.click() |
331 | self.assertEquals(focus_ring.opacity, 0.0) |
332 | @@ -123,36 +133,38 @@ |
333 | self.assertEquals(focus_ring.opacity, 0.0) |
334 | |
335 | # Focus to the center of the viewfinder feed |
336 | - center_click_coords = [feed.globalRect[2] / 2 + feed.globalRect[0], feed.globalRect[3] / 2 + feed.globalRect[1]] |
337 | - self.pointing_device.move(center_click_coords[0], center_click_coords[1]) |
338 | + self.pointing_device.move_to_object(feed) |
339 | self.pointing_device.click() |
340 | + center_click_coords = list(self.pointing_device.position()) |
341 | |
342 | - focus_ring_center = [focus_ring.globalRect[2] / 2 + focus_ring.globalRect[0], focus_ring.globalRect[3] / 2 + focus_ring.globalRect[1]] |
343 | + focus_ring_center = self.get_center(focus_ring) |
344 | self.assertThat(focus_ring.opacity, Eventually(Equals(1.0))) |
345 | self.assertEquals(focus_ring_center, center_click_coords) |
346 | |
347 | # Now drag it halfway across the feed, verify that it has moved there |
348 | - drag_end_coords = [focus_ring_center[0] + feed.globalRect[2] / 4, focus_ring_center[1] + feed.globalRect[3] / 4] |
349 | - self.pointing_device.drag(focus_ring_center[0], focus_ring_center[1], drag_end_coords[0], drag_end_coords[1]) |
350 | + tx = focus_ring_center[0] |
351 | + ty = focus_ring_center[1] |
352 | + self.pointing_device.drag(tx, ty, tx / 2, ty / 2) |
353 | |
354 | - focus_ring_center = [focus_ring.globalRect[2] / 2 + focus_ring.globalRect[0], focus_ring.globalRect[3] / 2 + focus_ring.globalRect[1]] |
355 | - self.assertThat(focus_ring_center[1], GreaterThan(drag_end_coords[1] - 2)) |
356 | + focus_ring_center = self.get_center(focus_ring) |
357 | + self.assertThat(focus_ring_center[1], GreaterThan(ty / 2 - 2)) |
358 | |
359 | # Switch cameras, wait for camera to settle, and try again |
360 | self.pointing_device.move_to_object(switch_cameras) |
361 | self.pointing_device.click() |
362 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) |
363 | |
364 | - center_click_coords = [feed.globalRect[2] / 2 + feed.globalRect[0], feed.globalRect[3] / 2 + feed.globalRect[1]] |
365 | - self.pointing_device.move(center_click_coords[0], center_click_coords[1]) |
366 | + self.pointing_device.move_to_object(feed) |
367 | self.pointing_device.click() |
368 | + center_click_coords = list(self.pointing_device.position()) |
369 | |
370 | - focus_ring_center = [focus_ring.globalRect[2] / 2 + focus_ring.globalRect[0], focus_ring.globalRect[3] / 2 + focus_ring.globalRect[1]] |
371 | + focus_ring_center = self.get_center(focus_ring) |
372 | self.assertThat(focus_ring.opacity, Eventually(Equals(1.0))) |
373 | self.assertEquals(focus_ring_center, center_click_coords) |
374 | |
375 | - drag_end_coords = [focus_ring_center[0] + feed.globalRect[2] / 4, focus_ring_center[1] + feed.globalRect[3] / 4] |
376 | - self.pointing_device.drag(focus_ring_center[0], focus_ring_center[1], drag_end_coords[0], drag_end_coords[1]) |
377 | + tx = focus_ring_center[0] |
378 | + ty = focus_ring_center[1] |
379 | + self.pointing_device.drag(tx, ty, tx / 2, ty / 2) |
380 | |
381 | - focus_ring_center = [focus_ring.globalRect[2] / 2 + focus_ring.globalRect[0], focus_ring.globalRect[3] / 2 + focus_ring.globalRect[1]] |
382 | - self.assertThat(focus_ring_center[1], GreaterThan(drag_end_coords[1] - 2)) |
383 | + focus_ring_center = self.get_center(focus_ring) |
384 | + self.assertThat(focus_ring_center[1], GreaterThan(ty / 2 - 2)) |
385 | |
386 | === modified file 'tests/autopilot/camera_app/tests/test_zoom.py' |
387 | --- tests/autopilot/camera_app/tests/test_zoom.py 2013-05-14 19:55:38 +0000 |
388 | +++ tests/autopilot/camera_app/tests/test_zoom.py 2013-05-29 11:56:26 +0000 |
389 | @@ -17,6 +17,7 @@ |
390 | import time |
391 | import unittest |
392 | |
393 | + |
394 | class TestCameraZoom(CameraAppTestCase): |
395 | """Tests the main camera features""" |
396 | |
397 | @@ -24,7 +25,8 @@ |
398 | In the testfarm, the application may take some time to show up.""" |
399 | def setUp(self): |
400 | super(TestCameraZoom, self).setUp() |
401 | - self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
402 | + self.assertThat( |
403 | + self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
404 | |
405 | def tearDown(self): |
406 | super(TestCameraZoom, self).tearDown() |
407 | @@ -32,30 +34,32 @@ |
408 | """Tests the zoom slider""" |
409 | def test_slider(self): |
410 | zoom_control = self.main_window.get_zoom_control() |
411 | - |
412 | zoom_button = self.main_window.get_zoom_slider_button() |
413 | |
414 | - zoom_button_center_x = zoom_button.globalRect[0] + zoom_button.globalRect[2] / 2 |
415 | - zoom_button_center_y = zoom_button.globalRect[1] + zoom_button.globalRect[3] / 2 |
416 | - |
417 | - if self.main_window.get_orientation() == "portrait": |
418 | - self.pointing_device.drag(zoom_button_center_x, zoom_button_center_y, zoom_button_center_x + zoom_control.width, zoom_button_center_y) |
419 | - else: |
420 | - self.pointing_device.drag(zoom_button_center_x, zoom_button_center_y, zoom_button_center_x, zoom_button_center_y - zoom_control.width) |
421 | - |
422 | - self.assertThat(zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
423 | - |
424 | - zoom_button_center_x = zoom_button.globalRect[0] + zoom_button.globalRect[2] / 2 |
425 | - zoom_button_center_y = zoom_button.globalRect[1] + zoom_button.globalRect[3] / 2 |
426 | - |
427 | - if self.main_window.get_orientation() == "portrait": |
428 | - self.pointing_device.drag(zoom_button_center_x, zoom_button_center_y, zoom_button_center_x - zoom_control.width, zoom_button_center_y) |
429 | - else: |
430 | - self.pointing_device.drag(zoom_button_center_x, zoom_button_center_y, zoom_button_center_x, zoom_button_center_y + zoom_control.width) |
431 | + x, y, h, w = zoom_button.globalRect |
432 | + |
433 | + tx = x + (h / 2) |
434 | + ty = y + (w / 2) |
435 | + |
436 | + if self.main_window.get_orientation() == "portrait": |
437 | + self.pointing_device.drag(tx, ty, (tx + zoom_control.width), ty) |
438 | + else: |
439 | + self.pointing_device.drag(tx, ty, tx, (ty - zoom_control.width)) |
440 | + |
441 | + self.assertThat( |
442 | + zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
443 | + |
444 | + tx = x + (h / 2) |
445 | + ty = y + (w / 2) |
446 | + |
447 | + if self.main_window.get_orientation() == "portrait": |
448 | + self.pointing_device.drag(tx, ty, (tx - zoom_control.width), ty) |
449 | + else: |
450 | + self.pointing_device.drag(tx, ty, tx, (ty + zoom_control.width)) |
451 | |
452 | self.assertThat(zoom_control.value, Eventually(Equals(1.0))) |
453 | |
454 | - @unittest.skip("Disabled this failing test due to bug 1179592") |
455 | + @unittest.skip("Disabled this failing test due to bug 1179592") |
456 | def test_plus_minus(self): |
457 | """Tests the plus and minus buttons""" |
458 | zoom_control = self.main_window.get_zoom_control() |
459 | @@ -79,32 +83,39 @@ |
460 | |
461 | self.pointing_device.move_to_object(minus) |
462 | self.pointing_device.click() |
463 | - self.assertThat(zoom_control.value, Eventually(LessThan(value_before_minus))) |
464 | + self.assertThat( |
465 | + zoom_control.value, Eventually(LessThan(value_before_minus))) |
466 | |
467 | # Test that keeping the plus button pressed eventually reaches max zoom |
468 | self.pointing_device.move_to_object(plus) |
469 | self.pointing_device.press() |
470 | - self.assertThat(zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
471 | + self.assertThat( |
472 | + zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
473 | self.pointing_device.release() |
474 | |
475 | # Test that plus when at maximum zoom does nothing |
476 | - self.assertThat(zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
477 | + self.assertThat( |
478 | + zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
479 | self.pointing_device.move_to_object(plus) |
480 | self.pointing_device.click() |
481 | - self.assertThat(zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
482 | + self.assertThat( |
483 | + zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
484 | |
485 | # Test that minus moves to some non-maximum value |
486 | # and that plus goes back up |
487 | - self.assertThat(zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
488 | + self.assertThat( |
489 | + zoom_control.value, Eventually(Equals(zoom_control.maximumValue))) |
490 | self.pointing_device.move_to_object(minus) |
491 | self.pointing_device.click() |
492 | - self.assertThat(zoom_control.value, Eventually(NotEquals(zoom_control.maximumValue))) |
493 | + self.assertThat( |
494 | + zoom_control.value, Eventually(NotEquals(zoom_control.maximumValue))) |
495 | |
496 | value_before_plus = zoom_control.value |
497 | |
498 | self.pointing_device.move_to_object(plus) |
499 | self.pointing_device.click() |
500 | - self.assertThat(zoom_control.value, Eventually(GreaterThan(value_before_plus))) |
501 | + self.assertThat( |
502 | + zoom_control.value, Eventually(GreaterThan(value_before_plus))) |
503 | |
504 | # Test that keeping the minus button pressed eventually reaches min zoom |
505 | self.pointing_device.move_to_object(minus) |
PASSED: Continuous integration, rev:133 jenkins. qa.ubuntu. com/job/ camera- app-ci/ 42/ jenkins. qa.ubuntu. com/job/ camera- app-raring- amd64-ci/ 32 jenkins. qa.ubuntu. com/job/ camera- app-raring- armhf-ci/ 55 jenkins. qa.ubuntu. com/job/ camera- app-raring- armhf-ci/ 55/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ camera- app-raring- i386-ci/ 55 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner/ 1690
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ camera- app-ci/ 42/rebuild
http://