Merge lp:~om26er/camera-app/fix_autopilot_test_code into lp:camera-app
- fix_autopilot_test_code
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Florian Boucault |
Proposed branch: | lp:~om26er/camera-app/fix_autopilot_test_code |
Merge into: | lp:camera-app |
Diff against target: |
428 lines (+89/-65) 6 files modified
tests/autopilot/camera_app/emulators/main_window.py (+21/-8) tests/autopilot/camera_app/tests/__init__.py (+7/-6) tests/autopilot/camera_app/tests/test_capture.py (+21/-16) tests/autopilot/camera_app/tests/test_flash.py (+9/-10) tests/autopilot/camera_app/tests/test_focus.py (+24/-16) tests/autopilot/camera_app/tests/test_zoom.py (+7/-9) |
To merge this branch: | bzr merge lp:~om26er/camera-app/fix_autopilot_test_code |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Ugo Riboni (community) | Approve | ||
Review via email: mp+195618@code.launchpad.net |
Commit message
fixes pyflakes and pep8 complaints in the autopilot code. Also improves the readability.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:232
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ugo Riboni (uriboni) wrote : | # |
Looks ok and passes
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Unmerged revisions
- 232. By Omer Akram
-
fix conflicts, merge trunk
- 231. By Omer Akram
-
True in this case is actually a string not bool
- 230. By Omer Akram
-
bring docstring inside test cases instead of being outside
- 229. By Omer Akram
-
move the check to make sure app window have appeared on screen into a central place, instead of doing the same thing in each Class
- 228. By Omer Akram
-
fix pyflakes complaints
- 227. By Omer Akram
-
fix all pep8 complaints
Preview Diff
1 | === modified file 'tests/autopilot/camera_app/emulators/main_window.py' | |||
2 | --- tests/autopilot/camera_app/emulators/main_window.py 2013-11-18 10:15:15 +0000 | |||
3 | +++ tests/autopilot/camera_app/emulators/main_window.py 2013-11-22 11:05:37 +0000 | |||
4 | @@ -4,7 +4,7 @@ | |||
5 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # This program is free software: you can redistribute it and/or modify it |
6 | 5 | # under the terms of the GNU General Public License version 3, as published | 5 | # under the terms of the GNU General Public License version 3, as published |
7 | 6 | # by the Free Software Foundation. | 6 | # by the Free Software Foundation. |
9 | 7 | import math | 7 | |
10 | 8 | 8 | ||
11 | 9 | class MainWindow(object): | 9 | class MainWindow(object): |
12 | 10 | """An emulator class that makes it easy to interact with the camera-app.""" | 10 | """An emulator class that makes it easy to interact with the camera-app.""" |
13 | @@ -19,14 +19,19 @@ | |||
14 | 19 | def get_focus_ring(self): | 19 | def get_focus_ring(self): |
15 | 20 | """Returns the focus ring of the camera""" | 20 | """Returns the focus ring of the camera""" |
16 | 21 | return self.app.wait_select_single("FocusRing") | 21 | return self.app.wait_select_single("FocusRing") |
18 | 22 | 22 | ||
19 | 23 | def get_exposure_button(self): | 23 | def get_exposure_button(self): |
20 | 24 | """Returns the button that takes pictures""" | 24 | """Returns the button that takes pictures""" |
21 | 25 | return self.app.wait_select_single("ShootButton") | 25 | return self.app.wait_select_single("ShootButton") |
22 | 26 | 26 | ||
23 | 27 | def get_record_control(self): | 27 | def get_record_control(self): |
26 | 28 | """Returns the button that switches between photo and video recording""" | 28 | """Returns the button that switches between photo and video |
27 | 29 | return self.app.wait_select_single("FadingButton", objectName="recordModeButton") | 29 | recording. |
28 | 30 | |||
29 | 31 | """ | ||
30 | 32 | return self.app.wait_select_single( | ||
31 | 33 | "FadingButton", | ||
32 | 34 | objectName="recordModeButton") | ||
33 | 30 | 35 | ||
34 | 31 | def get_flash_button(self): | 36 | def get_flash_button(self): |
35 | 32 | """Returns the flash control button of the camera""" | 37 | """Returns the flash control button of the camera""" |
36 | @@ -46,15 +51,21 @@ | |||
37 | 46 | 51 | ||
38 | 47 | def get_zoom_slider_button(self): | 52 | def get_zoom_slider_button(self): |
39 | 48 | """Returns the zoom slider button""" | 53 | """Returns the zoom slider button""" |
41 | 49 | return self.app.wait_select_single("QQuickImage", objectName="sliderThumb") | 54 | return self.app.wait_select_single( |
42 | 55 | "QQuickImage", | ||
43 | 56 | objectName="sliderThumb") | ||
44 | 50 | 57 | ||
45 | 51 | def get_zoom_plus(self): | 58 | def get_zoom_plus(self): |
46 | 52 | """Returns the zoom plus button""" | 59 | """Returns the zoom plus button""" |
48 | 53 | return self.app.wait_select_single("AbstractButton", objectName="zoomPlus") | 60 | return self.app.wait_select_single( |
49 | 61 | "AbstractButton", | ||
50 | 62 | objectName="zoomPlus") | ||
51 | 54 | 63 | ||
52 | 55 | def get_zoom_minus(self): | 64 | def get_zoom_minus(self): |
53 | 56 | """Returns the zoom minus button""" | 65 | """Returns the zoom minus button""" |
55 | 57 | return self.app.wait_select_single("AbstractButton", objectName="zoomMinus") | 66 | return self.app.wait_select_single( |
56 | 67 | "AbstractButton", | ||
57 | 68 | objectName="zoomMinus") | ||
58 | 58 | 69 | ||
59 | 59 | def get_viewfinder_geometry(self): | 70 | def get_viewfinder_geometry(self): |
60 | 60 | """Returns the viewfinder geometry tracker""" | 71 | """Returns the viewfinder geometry tracker""" |
61 | @@ -62,7 +73,9 @@ | |||
62 | 62 | 73 | ||
63 | 63 | def get_swap_camera_button(self): | 74 | def get_swap_camera_button(self): |
64 | 64 | """Returns the button that switches between front and back cameras""" | 75 | """Returns the button that switches between front and back cameras""" |
66 | 65 | return self.app.wait_select_single("CameraToolbarButton", objectName="swapButton") | 76 | return self.app.wait_select_single( |
67 | 77 | "CameraToolbarButton", | ||
68 | 78 | objectName="swapButton") | ||
69 | 66 | 79 | ||
70 | 67 | def get_orientation(self): | 80 | def get_orientation(self): |
71 | 68 | orientation = self.app.wait_select_single("DeviceOrientation") | 81 | orientation = self.app.wait_select_single("DeviceOrientation") |
72 | 69 | 82 | ||
73 | === modified file 'tests/autopilot/camera_app/tests/__init__.py' | |||
74 | --- tests/autopilot/camera_app/tests/__init__.py 2013-09-26 20:26:08 +0000 | |||
75 | +++ tests/autopilot/camera_app/tests/__init__.py 2013-11-22 11:05:37 +0000 | |||
76 | @@ -7,7 +7,6 @@ | |||
77 | 7 | 7 | ||
78 | 8 | """Camera-app autopilot tests.""" | 8 | """Camera-app autopilot tests.""" |
79 | 9 | 9 | ||
80 | 10 | from os import remove | ||
81 | 11 | import os.path | 10 | import os.path |
82 | 12 | 11 | ||
83 | 13 | from autopilot.input import Mouse, Touch, Pointer | 12 | from autopilot.input import Mouse, Touch, Pointer |
84 | @@ -26,11 +25,9 @@ | |||
85 | 26 | 25 | ||
86 | 27 | """ | 26 | """ |
87 | 28 | if model() == 'Desktop': | 27 | if model() == 'Desktop': |
90 | 29 | scenarios = [ | 28 | scenarios = [('with mouse', dict(input_device_class=Mouse))] |
89 | 30 | ('with mouse', dict(input_device_class=Mouse))] | ||
91 | 31 | else: | 29 | else: |
94 | 32 | scenarios = [ | 30 | scenarios = [('with touch', dict(input_device_class=Touch))] |
93 | 33 | ('with touch', dict(input_device_class=Touch))] | ||
95 | 34 | 31 | ||
96 | 35 | local_location = "../../camera-app" | 32 | local_location = "../../camera-app" |
97 | 36 | deb_location = '/usr/bin/camera-app' | 33 | deb_location = '/usr/bin/camera-app' |
98 | @@ -45,6 +42,9 @@ | |||
99 | 45 | else: | 42 | else: |
100 | 46 | self.launch_click_installed() | 43 | self.launch_click_installed() |
101 | 47 | 44 | ||
102 | 45 | self.assertThat( | ||
103 | 46 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
104 | 47 | |||
105 | 48 | def launch_test_local(self): | 48 | def launch_test_local(self): |
106 | 49 | self.app = self.launch_test_application( | 49 | self.app = self.launch_test_application( |
107 | 50 | self.local_location) | 50 | self.local_location) |
108 | @@ -57,7 +57,8 @@ | |||
109 | 57 | self.app = self.launch_test_application( | 57 | self.app = self.launch_test_application( |
110 | 58 | "camera-app", | 58 | "camera-app", |
111 | 59 | "--fullscreen", | 59 | "--fullscreen", |
113 | 60 | "--desktop_file_hint=/usr/share/applications/camera-app.desktop", | 60 | "--desktop_file_hint=/usr/share/applications/" |
114 | 61 | "camera-app.desktop", | ||
115 | 61 | app_type='qt') | 62 | app_type='qt') |
116 | 62 | 63 | ||
117 | 63 | def launch_click_installed(self): | 64 | def launch_click_installed(self): |
118 | 64 | 65 | ||
119 | === modified file 'tests/autopilot/camera_app/tests/test_capture.py' | |||
120 | --- tests/autopilot/camera_app/tests/test_capture.py 2013-11-18 13:34:43 +0000 | |||
121 | +++ tests/autopilot/camera_app/tests/test_capture.py 2013-11-22 11:05:37 +0000 | |||
122 | @@ -9,7 +9,7 @@ | |||
123 | 9 | 9 | ||
124 | 10 | from autopilot.matchers import Eventually | 10 | from autopilot.matchers import Eventually |
125 | 11 | from autopilot.platform import model | 11 | from autopilot.platform import model |
127 | 12 | from testtools.matchers import Equals, NotEquals, GreaterThan | 12 | from testtools.matchers import Equals, NotEquals |
128 | 13 | 13 | ||
129 | 14 | from camera_app.tests import CameraAppTestCase | 14 | from camera_app.tests import CameraAppTestCase |
130 | 15 | 15 | ||
131 | @@ -22,25 +22,25 @@ | |||
132 | 22 | class TestCapture(CameraAppTestCase): | 22 | class TestCapture(CameraAppTestCase): |
133 | 23 | """Tests the main camera features""" | 23 | """Tests the main camera features""" |
134 | 24 | 24 | ||
135 | 25 | """ This is needed to wait for the application to start. | ||
136 | 26 | In the testfarm, the application may take some time to show up.""" | ||
137 | 27 | def setUp(self): | 25 | def setUp(self): |
138 | 28 | super(TestCapture, self).setUp() | 26 | super(TestCapture, self).setUp() |
139 | 29 | self.assertThat( | ||
140 | 30 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
141 | 31 | 27 | ||
142 | 32 | def tearDown(self): | 28 | def tearDown(self): |
143 | 33 | super(TestCapture, self).tearDown() | 29 | super(TestCapture, self).tearDown() |
144 | 34 | 30 | ||
147 | 35 | """Test taking a picture""" | 31 | @unittest.skipIf( |
148 | 36 | @unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro') | 32 | model() == 'Galaxy Nexus', |
149 | 33 | 'Unusable with Mir enabled on maguro') | ||
150 | 37 | def test_take_picture(self): | 34 | def test_take_picture(self): |
152 | 38 | toolbar = self.main_window.get_toolbar() | 35 | """Test taking a picture.""" |
153 | 39 | exposure_button = self.main_window.get_exposure_button() | 36 | exposure_button = self.main_window.get_exposure_button() |
154 | 40 | pictures_dir = path.expanduser("~/Pictures") | 37 | pictures_dir = path.expanduser("~/Pictures") |
155 | 41 | 38 | ||
156 | 42 | # Remove all pictures from ~/Pictures that match our pattern | 39 | # Remove all pictures from ~/Pictures that match our pattern |
158 | 43 | files = [f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir, f))] | 40 | files = [ |
159 | 41 | f for f in os.listdir(pictures_dir) if f[0:5] == "image" | ||
160 | 42 | and path.isfile(path.join(pictures_dir, f)) | ||
161 | 43 | ] | ||
162 | 44 | for f in files: | 44 | for f in files: |
163 | 45 | os.remove(path.join(pictures_dir, f)) | 45 | os.remove(path.join(pictures_dir, f)) |
164 | 46 | 46 | ||
165 | @@ -56,7 +56,10 @@ | |||
166 | 56 | # is actually there | 56 | # is actually there |
167 | 57 | one_picture_on_disk = False | 57 | one_picture_on_disk = False |
168 | 58 | for i in range(0, 10): | 58 | for i in range(0, 10): |
170 | 59 | files = [f for f in os.listdir(pictures_dir) if f[0:5] == "image" and path.isfile(path.join(pictures_dir, f))] | 59 | files = [ |
171 | 60 | f for f in os.listdir(pictures_dir) if f[0:5] == "image" | ||
172 | 61 | and path.isfile(path.join(pictures_dir, f)) | ||
173 | 62 | ] | ||
174 | 60 | if len(files) == 1: | 63 | if len(files) == 1: |
175 | 61 | one_picture_on_disk = True | 64 | one_picture_on_disk = True |
176 | 62 | break | 65 | break |
177 | @@ -66,13 +69,13 @@ | |||
178 | 66 | # check that the camera is able to capture another photo | 69 | # check that the camera is able to capture another photo |
179 | 67 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) | 70 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) |
180 | 68 | 71 | ||
181 | 69 | """Tests clicking on the record control and checks if the flash changes | ||
182 | 70 | to torch off mode and the recording time appears""" | ||
183 | 71 | @unittest.skip('Video recording not working for V1.0') | 72 | @unittest.skip('Video recording not working for V1.0') |
184 | 72 | def test_record_video(self): | 73 | def test_record_video(self): |
185 | 74 | """Tests clicking on the record control and checks if the flash changes | ||
186 | 75 | to torch off mode and the recording time appears. | ||
187 | 76 | |||
188 | 77 | """ | ||
189 | 73 | # Get all the elements | 78 | # Get all the elements |
190 | 74 | camera_window = self.main_window.get_camera() | ||
191 | 75 | toolbar = self.main_window.get_toolbar() | ||
192 | 76 | record_control = self.main_window.get_record_control() | 79 | record_control = self.main_window.get_record_control() |
193 | 77 | flash_button = self.main_window.get_flash_button() | 80 | flash_button = self.main_window.get_flash_button() |
194 | 78 | stop_watch = self.main_window.get_stop_watch() | 81 | stop_watch = self.main_window.get_stop_watch() |
195 | @@ -138,10 +141,12 @@ | |||
196 | 138 | self.assertThat( | 141 | self.assertThat( |
197 | 139 | flash_button.torchMode, Eventually(Equals(torchmode_old_state))) | 142 | flash_button.torchMode, Eventually(Equals(torchmode_old_state))) |
198 | 140 | 143 | ||
199 | 141 | """Test that the shoot button gets disabled for a while then re-enabled | ||
200 | 142 | after shooting""" | ||
201 | 143 | @unittest.skip("Disabled this test due race condition see bug 1227373") | 144 | @unittest.skip("Disabled this test due race condition see bug 1227373") |
202 | 144 | def test_shoot_button_disable(self): | 145 | def test_shoot_button_disable(self): |
203 | 146 | """Test that the shoot button gets disabled for a while then re-enabled | ||
204 | 147 | after shooting. | ||
205 | 148 | |||
206 | 149 | """ | ||
207 | 145 | exposure_button = self.main_window.get_exposure_button() | 150 | exposure_button = self.main_window.get_exposure_button() |
208 | 146 | 151 | ||
209 | 147 | # The focus ring should be invisible in the beginning | 152 | # The focus ring should be invisible in the beginning |
210 | 148 | 153 | ||
211 | === modified file 'tests/autopilot/camera_app/tests/test_flash.py' | |||
212 | --- tests/autopilot/camera_app/tests/test_flash.py 2013-11-18 13:34:43 +0000 | |||
213 | +++ tests/autopilot/camera_app/tests/test_flash.py 2013-11-22 11:05:37 +0000 | |||
214 | @@ -12,25 +12,20 @@ | |||
215 | 12 | 12 | ||
216 | 13 | from camera_app.tests import CameraAppTestCase | 13 | from camera_app.tests import CameraAppTestCase |
217 | 14 | 14 | ||
218 | 15 | import time | ||
219 | 16 | import unittest | 15 | import unittest |
220 | 17 | 16 | ||
221 | 18 | 17 | ||
222 | 19 | class TestCameraFlash(CameraAppTestCase): | 18 | class TestCameraFlash(CameraAppTestCase): |
223 | 20 | """Tests the flash""" | 19 | """Tests the flash""" |
224 | 21 | 20 | ||
225 | 22 | """ This is needed to wait for the application to start. | ||
226 | 23 | In the testfarm, the application may take some time to show up.""" | ||
227 | 24 | def setUp(self): | 21 | def setUp(self): |
228 | 25 | super(TestCameraFlash, self).setUp() | 22 | super(TestCameraFlash, self).setUp() |
229 | 26 | self.assertThat( | ||
230 | 27 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
231 | 28 | 23 | ||
232 | 29 | def tearDown(self): | 24 | def tearDown(self): |
233 | 30 | super(TestCameraFlash, self).tearDown() | 25 | super(TestCameraFlash, self).tearDown() |
234 | 31 | 26 | ||
235 | 32 | """Test that flash modes cycle properly""" | ||
236 | 33 | def test_cycle_flash(self): | 27 | def test_cycle_flash(self): |
237 | 28 | """Test that flash modes cycle properly.""" | ||
238 | 34 | flash_button = self.main_window.get_flash_button() | 29 | flash_button = self.main_window.get_flash_button() |
239 | 35 | 30 | ||
240 | 36 | #ensure initial state | 31 | #ensure initial state |
241 | @@ -51,9 +46,9 @@ | |||
242 | 51 | self.assertThat(flash_button.flashState, Eventually(Equals("off"))) | 46 | self.assertThat(flash_button.flashState, Eventually(Equals("off"))) |
243 | 52 | self.assertThat(flash_button.torchMode, Equals(False)) | 47 | self.assertThat(flash_button.torchMode, Equals(False)) |
244 | 53 | 48 | ||
245 | 54 | """Test that torch modes cycles properly""" | ||
246 | 55 | @unittest.skip('Video recording not working for V1.0') | 49 | @unittest.skip('Video recording not working for V1.0') |
247 | 56 | def test_cycle_torch(self): | 50 | def test_cycle_torch(self): |
248 | 51 | """Test that torch modes cycles properly.""" | ||
249 | 57 | flash_button = self.main_window.get_flash_button() | 52 | flash_button = self.main_window.get_flash_button() |
250 | 58 | record_button = self.main_window.get_record_control() | 53 | record_button = self.main_window.get_record_control() |
251 | 59 | self.pointing_device.click_object(record_button) | 54 | self.pointing_device.click_object(record_button) |
252 | @@ -72,10 +67,12 @@ | |||
253 | 72 | self.assertThat(flash_button.flashState, Eventually(Equals("off"))) | 67 | self.assertThat(flash_button.flashState, Eventually(Equals("off"))) |
254 | 73 | self.assertThat(flash_button.torchMode, Equals(True)) | 68 | self.assertThat(flash_button.torchMode, Equals(True)) |
255 | 74 | 69 | ||
256 | 75 | """When switching between video and picture the previous flash state | ||
257 | 76 | should be preserved""" | ||
258 | 77 | @unittest.skip('Video recording not working for V1.0') | 70 | @unittest.skip('Video recording not working for V1.0') |
259 | 78 | def test_remember_state(self): | 71 | def test_remember_state(self): |
260 | 72 | """When switching between video and picture the previous flash state | ||
261 | 73 | should be preserved. | ||
262 | 74 | |||
263 | 75 | """ | ||
264 | 79 | flash_button = self.main_window.get_flash_button() | 76 | flash_button = self.main_window.get_flash_button() |
265 | 80 | record_button = self.main_window.get_record_control() | 77 | record_button = self.main_window.get_record_control() |
266 | 81 | initial_flash_state = flash_button.flashState | 78 | initial_flash_state = flash_button.flashState |
267 | @@ -85,7 +82,9 @@ | |||
268 | 85 | self.pointing_device.move_to_object(flash_button) | 82 | self.pointing_device.move_to_object(flash_button) |
269 | 86 | self.pointing_device.click() | 83 | self.pointing_device.click() |
270 | 87 | self.assertThat( | 84 | self.assertThat( |
272 | 88 | flash_button.flashState, Eventually(NotEquals(initial_flash_state))) | 85 | flash_button.flashState, |
273 | 86 | Eventually(NotEquals(initial_flash_state)) | ||
274 | 87 | ) | ||
275 | 89 | second_flash_state = flash_button.flashState | 88 | second_flash_state = flash_button.flashState |
276 | 90 | self.pointing_device.click() | 89 | self.pointing_device.click() |
277 | 91 | self.assertThat( | 90 | self.assertThat( |
278 | 92 | 91 | ||
279 | === modified file 'tests/autopilot/camera_app/tests/test_focus.py' | |||
280 | --- tests/autopilot/camera_app/tests/test_focus.py 2013-11-18 14:18:52 +0000 | |||
281 | +++ tests/autopilot/camera_app/tests/test_focus.py 2013-11-22 11:05:37 +0000 | |||
282 | @@ -9,31 +9,28 @@ | |||
283 | 9 | 9 | ||
284 | 10 | from autopilot.matchers import Eventually | 10 | from autopilot.matchers import Eventually |
285 | 11 | from autopilot.platform import model | 11 | from autopilot.platform import model |
287 | 12 | from testtools.matchers import Equals, NotEquals, GreaterThan | 12 | from testtools.matchers import Equals, GreaterThan |
288 | 13 | from camera_app.tests import CameraAppTestCase | 13 | from camera_app.tests import CameraAppTestCase |
289 | 14 | 14 | ||
290 | 15 | import unittest | 15 | import unittest |
291 | 16 | import time | ||
292 | 17 | 16 | ||
293 | 18 | 17 | ||
294 | 19 | class TestFocus(CameraAppTestCase): | 18 | class TestFocus(CameraAppTestCase): |
295 | 20 | """Tests the focus""" | 19 | """Tests the focus""" |
296 | 21 | 20 | ||
297 | 22 | """ This is needed to wait for the application to start. | ||
298 | 23 | In the testfarm, the application may take some time to show up.""" | ||
299 | 24 | def setUp(self): | 21 | def setUp(self): |
300 | 25 | super(TestFocus, self).setUp() | 22 | super(TestFocus, self).setUp() |
301 | 26 | self.assertThat( | ||
302 | 27 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
303 | 28 | 23 | ||
304 | 29 | def tearDown(self): | 24 | def tearDown(self): |
305 | 30 | super(TestFocus, self).tearDown() | 25 | super(TestFocus, self).tearDown() |
306 | 31 | 26 | ||
309 | 32 | """Test focusing in an area where we know the picture is""" | 27 | @unittest.skipIf( |
310 | 33 | @unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro') | 28 | model() == 'Galaxy Nexus', |
311 | 29 | 'Unusable with Mir enabled on maguro' | ||
312 | 30 | ) | ||
313 | 34 | def test_focus_valid_and_disappear(self): | 31 | def test_focus_valid_and_disappear(self): |
314 | 32 | """Test focusing in an area where we know the picture is.""" | ||
315 | 35 | focus_ring = self.main_window.get_focus_ring() | 33 | focus_ring = self.main_window.get_focus_ring() |
316 | 36 | toolbar = self.main_window.get_toolbar() | ||
317 | 37 | feed = self.main_window.get_viewfinder_geometry() | 34 | feed = self.main_window.get_viewfinder_geometry() |
318 | 38 | switch_cameras = self.main_window.get_swap_camera_button() | 35 | switch_cameras = self.main_window.get_swap_camera_button() |
319 | 39 | exposure_button = self.main_window.get_exposure_button() | 36 | exposure_button = self.main_window.get_exposure_button() |
320 | @@ -60,7 +57,10 @@ | |||
321 | 60 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) | 57 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) |
322 | 61 | 58 | ||
323 | 62 | # Click in the center of the viewfinder area | 59 | # Click in the center of the viewfinder area |
325 | 63 | click_coords =[feed.globalRect[2] // 2 + feed.globalRect[0], feed.globalRect[3] // 2 + feed.globalRect[1]] | 60 | click_coords = [ |
326 | 61 | feed.globalRect[2] // 2 + feed.globalRect[0], | ||
327 | 62 | feed.globalRect[3] // 2 + feed.globalRect[1] | ||
328 | 63 | ] | ||
329 | 64 | self.pointing_device.move(click_coords[0], click_coords[1]) | 64 | self.pointing_device.move(click_coords[0], click_coords[1]) |
330 | 65 | self.pointing_device.click() | 65 | self.pointing_device.click() |
331 | 66 | 66 | ||
332 | @@ -73,10 +73,15 @@ | |||
333 | 73 | # After some seconds the focus ring should fade out | 73 | # After some seconds the focus ring should fade out |
334 | 74 | self.assertThat(focus_ring.opacity, Eventually(Equals(0.0))) | 74 | self.assertThat(focus_ring.opacity, Eventually(Equals(0.0))) |
335 | 75 | 75 | ||
337 | 76 | @unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro') | 76 | @unittest.skipIf( |
338 | 77 | model() == 'Galaxy Nexus', | ||
339 | 78 | 'Unusable with Mir enabled on maguro' | ||
340 | 79 | ) | ||
341 | 77 | def test_focus_invalid(self): | 80 | def test_focus_invalid(self): |
342 | 78 | """Tests clicking outside of the viewfinder image area, where it should | 81 | """Tests clicking outside of the viewfinder image area, where it should |
344 | 79 | not focus.""" | 82 | not focus. |
345 | 83 | |||
346 | 84 | """ | ||
347 | 80 | toolbar = self.main_window.get_toolbar() | 85 | toolbar = self.main_window.get_toolbar() |
348 | 81 | zoom = self.main_window.get_zoom_control() | 86 | zoom = self.main_window.get_zoom_control() |
349 | 82 | feed = self.main_window.get_viewfinder_geometry() | 87 | feed = self.main_window.get_viewfinder_geometry() |
350 | @@ -98,8 +103,8 @@ | |||
351 | 98 | 103 | ||
352 | 99 | # Check if there's a gap between the viewfinder feed and the zoom | 104 | # Check if there's a gap between the viewfinder feed and the zoom |
353 | 100 | # control. If there is, test that focusing there won't show the focus | 105 | # control. If there is, test that focusing there won't show the focus |
356 | 101 | #ring. | 106 | # ring. |
357 | 102 | if zoom.y > feed.height: # Feed is aligned to the top of the window | 107 | if zoom.y > feed.height: # Feed is aligned to the top of the window |
358 | 103 | x, y, h, w = zoom.globalRect | 108 | x, y, h, w = zoom.globalRect |
359 | 104 | click_coords = [x + (h / 2), y - 2] | 109 | click_coords = [x + (h / 2), y - 2] |
360 | 105 | self.pointing_device.move(click_coords[0], click_coords[1]) | 110 | self.pointing_device.move(click_coords[0], click_coords[1]) |
361 | @@ -119,9 +124,12 @@ | |||
362 | 119 | self.pointing_device.click() | 124 | self.pointing_device.click() |
363 | 120 | self.assertThat(focus_ring.opacity, Eventually(Equals(0.0))) | 125 | self.assertThat(focus_ring.opacity, Eventually(Equals(0.0))) |
364 | 121 | 126 | ||
367 | 122 | """Tests dragging the focus ring""" | 127 | @unittest.skipIf( |
368 | 123 | @unittest.skipIf(model() == 'Galaxy Nexus', 'Unusable with Mir enabled on maguro') | 128 | model() == 'Galaxy Nexus', |
369 | 129 | 'Unusable with Mir enabled on maguro' | ||
370 | 130 | ) | ||
371 | 124 | def test_move_focus_ring(self): | 131 | def test_move_focus_ring(self): |
372 | 132 | """Tests dragging the focus ring.""" | ||
373 | 125 | focus_ring = self.main_window.get_focus_ring() | 133 | focus_ring = self.main_window.get_focus_ring() |
374 | 126 | feed = self.main_window.get_viewfinder_geometry() | 134 | feed = self.main_window.get_viewfinder_geometry() |
375 | 127 | switch_cameras = self.main_window.get_swap_camera_button() | 135 | switch_cameras = self.main_window.get_swap_camera_button() |
376 | 128 | 136 | ||
377 | === modified file 'tests/autopilot/camera_app/tests/test_zoom.py' | |||
378 | --- tests/autopilot/camera_app/tests/test_zoom.py 2013-11-18 13:34:43 +0000 | |||
379 | +++ tests/autopilot/camera_app/tests/test_zoom.py 2013-11-22 11:05:37 +0000 | |||
380 | @@ -12,25 +12,20 @@ | |||
381 | 12 | 12 | ||
382 | 13 | from camera_app.tests import CameraAppTestCase | 13 | from camera_app.tests import CameraAppTestCase |
383 | 14 | 14 | ||
384 | 15 | import time | ||
385 | 16 | import unittest | 15 | import unittest |
386 | 17 | 16 | ||
387 | 18 | 17 | ||
388 | 19 | class TestCameraZoom(CameraAppTestCase): | 18 | class TestCameraZoom(CameraAppTestCase): |
390 | 20 | """Tests the main camera features""" | 19 | """ Tests the main camera features. """ |
391 | 21 | 20 | ||
392 | 22 | """ This is needed to wait for the application to start. | ||
393 | 23 | In the testfarm, the application may take some time to show up.""" | ||
394 | 24 | def setUp(self): | 21 | def setUp(self): |
395 | 25 | super(TestCameraZoom, self).setUp() | 22 | super(TestCameraZoom, self).setUp() |
396 | 26 | self.assertThat( | ||
397 | 27 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) | ||
398 | 28 | 23 | ||
399 | 29 | def tearDown(self): | 24 | def tearDown(self): |
400 | 30 | super(TestCameraZoom, self).tearDown() | 25 | super(TestCameraZoom, self).tearDown() |
401 | 31 | 26 | ||
402 | 32 | """Tests the zoom slider""" | ||
403 | 33 | def test_slider(self): | 27 | def test_slider(self): |
404 | 28 | """Tests the zoom slider.""" | ||
405 | 34 | zoom_control = self.main_window.get_zoom_control() | 29 | zoom_control = self.main_window.get_zoom_control() |
406 | 35 | zoom_button = self.main_window.get_zoom_slider_button() | 30 | zoom_button = self.main_window.get_zoom_slider_button() |
407 | 36 | 31 | ||
408 | @@ -106,7 +101,9 @@ | |||
409 | 106 | self.pointing_device.move_to_object(minus) | 101 | self.pointing_device.move_to_object(minus) |
410 | 107 | self.pointing_device.click() | 102 | self.pointing_device.click() |
411 | 108 | self.assertThat( | 103 | self.assertThat( |
413 | 109 | zoom_control.value, Eventually(NotEquals(zoom_control.maximumValue))) | 104 | zoom_control.value, |
414 | 105 | Eventually(NotEquals(zoom_control.maximumValue)) | ||
415 | 106 | ) | ||
416 | 110 | 107 | ||
417 | 111 | value_before_plus = zoom_control.value | 108 | value_before_plus = zoom_control.value |
418 | 112 | 109 | ||
419 | @@ -115,7 +112,8 @@ | |||
420 | 115 | self.assertThat( | 112 | self.assertThat( |
421 | 116 | zoom_control.value, Eventually(GreaterThan(value_before_plus))) | 113 | zoom_control.value, Eventually(GreaterThan(value_before_plus))) |
422 | 117 | 114 | ||
424 | 118 | # Test that keeping the minus button pressed eventually reaches min zoom | 115 | # Test that keeping the minus button pressed eventually reaches |
425 | 116 | # min zoom. | ||
426 | 119 | self.pointing_device.move_to_object(minus) | 117 | self.pointing_device.move_to_object(minus) |
427 | 120 | self.pointing_device.press() | 118 | self.pointing_device.press() |
428 | 121 | self.assertThat(zoom_control.value, Eventually(Equals(1.0))) | 119 | self.assertThat(zoom_control.value, Eventually(Equals(1.0))) |
PASSED: Continuous integration, rev:231 jenkins. qa.ubuntu. com/job/ camera- app-ci/ 150/ jenkins. qa.ubuntu. com/job/ camera- app-trusty- amd64-ci/ 8 jenkins. qa.ubuntu. com/job/ camera- app-trusty- armhf-ci/ 8 jenkins. qa.ubuntu. com/job/ camera- app-trusty- armhf-ci/ 8/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ camera- app-trusty- i386-ci/ 8 jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty/ 804 jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- touch/792 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-trusty/ 729 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/804 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/804/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/792 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/792/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/3407 s-jenkins: 8080/job/ touch-flash- device/ 1495
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ camera- app-ci/ 150/rebuild
http://