Merge lp:~canonical-platform-qa/camera-app/fix1444170-flake8 into lp:camera-app
- fix1444170-flake8
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Florian Boucault | ||||
Approved revision: | 559 | ||||
Merged at revision: | 569 | ||||
Proposed branch: | lp:~canonical-platform-qa/camera-app/fix1444170-flake8 | ||||
Merge into: | lp:camera-app | ||||
Prerequisite: | lp:~canonical-platform-qa/camera-app/fix_base_class | ||||
Diff against target: |
680 lines (+118/-85) 13 files modified
debian/control (+1/-0) debian/rules (+4/-0) tests/autopilot/camera_app/emulators/main_window.py (+5/-5) tests/autopilot/camera_app/emulators/panel.py (+5/-3) tests/autopilot/camera_app/tests/__init__.py (+2/-5) tests/autopilot/camera_app/tests/test_capture.py (+35/-20) tests/autopilot/camera_app/tests/test_diskspace.py (+22/-17) tests/autopilot/camera_app/tests/test_flash.py (+12/-9) tests/autopilot/camera_app/tests/test_focus.py (+3/-3) tests/autopilot/camera_app/tests/test_gallery_view.py (+10/-6) tests/autopilot/camera_app/tests/test_options.py (+6/-3) tests/autopilot/camera_app/tests/test_photo_editor.py (+11/-12) tests/autopilot/camera_app/tests/test_zoom.py (+2/-2) |
||||
To merge this branch: | bzr merge lp:~canonical-platform-qa/camera-app/fix1444170-flake8 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Ubuntu Phablet Team | Pending | ||
Review via email: mp+257806@code.launchpad.net |
This proposal supersedes a proposal from 2015-04-29.
Commit message
Fixed the static errors reported by flake8.
Added the check to the debian build tests.
Added python3-flake8 as a build dependency.
Description of the change
Leo Arias (elopio) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:557
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:558
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:559
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2015-03-12 22:20:24 +0000 | |||
3 | +++ debian/control 2015-05-15 07:29:30 +0000 | |||
4 | @@ -9,6 +9,7 @@ | |||
5 | 9 | libgles2-mesa-dev | libgles2-dev, | 9 | libgles2-mesa-dev | libgles2-dev, |
6 | 10 | pkg-config, | 10 | pkg-config, |
7 | 11 | python3:any, | 11 | python3:any, |
8 | 12 | python3-flake8, | ||
9 | 12 | qtbase5-dev, | 13 | qtbase5-dev, |
10 | 13 | qtdeclarative5-dev, | 14 | qtdeclarative5-dev, |
11 | 14 | qtdeclarative5-qtquick2-plugin, | 15 | qtdeclarative5-qtquick2-plugin, |
12 | 15 | 16 | ||
13 | === modified file 'debian/rules' | |||
14 | --- debian/rules 2013-06-11 16:05:35 +0000 | |||
15 | +++ debian/rules 2015-05-15 07:29:30 +0000 | |||
16 | @@ -8,6 +8,10 @@ | |||
17 | 8 | %: | 8 | %: |
18 | 9 | dh $@ --parallel --with translations | 9 | dh $@ --parallel --with translations |
19 | 10 | 10 | ||
20 | 11 | override_dh_auto_test: | ||
21 | 12 | python3 -m flake8 . | ||
22 | 13 | dh_auto_test | ||
23 | 14 | |||
24 | 11 | override_dh_install: | 15 | override_dh_install: |
25 | 12 | dh_install --fail-missing | 16 | dh_install --fail-missing |
26 | 13 | 17 | ||
27 | 14 | 18 | ||
28 | === modified file 'tests/autopilot/camera_app/emulators/main_window.py' | |||
29 | --- tests/autopilot/camera_app/emulators/main_window.py 2015-03-10 16:14:20 +0000 | |||
30 | +++ tests/autopilot/camera_app/emulators/main_window.py 2015-05-15 07:29:30 +0000 | |||
31 | @@ -1,12 +1,10 @@ | |||
32 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
34 | 2 | # Copyright 2014 Canonical | 2 | # Copyright 2014, 2015 Canonical |
35 | 3 | # | 3 | # |
36 | 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 |
37 | 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 |
38 | 6 | # by the Free Software Foundation. | 6 | # by the Free Software Foundation. |
39 | 7 | 7 | ||
40 | 8 | import sys | ||
41 | 9 | |||
42 | 10 | from camera_app.emulators.panel import Panel | 8 | from camera_app.emulators.panel import Panel |
43 | 11 | from autopilot.matchers import Eventually | 9 | from autopilot.matchers import Eventually |
44 | 12 | from testtools.matchers import Equals | 10 | from testtools.matchers import Equals |
45 | @@ -47,7 +45,8 @@ | |||
46 | 47 | return self.app.wait_select_single("ShootButton") | 45 | return self.app.wait_select_single("ShootButton") |
47 | 48 | 46 | ||
48 | 49 | def get_photo_roll_hint(self): | 47 | def get_photo_roll_hint(self): |
50 | 50 | """Returns the layer that serves at hinting to the existence of the photo roll""" | 48 | """Returns the layer that serves at hinting to the existence of the |
51 | 49 | photo roll""" | ||
52 | 51 | return self.app.wait_select_single("PhotoRollHint") | 50 | return self.app.wait_select_single("PhotoRollHint") |
53 | 52 | 51 | ||
54 | 53 | def get_record_control(self): | 52 | def get_record_control(self): |
55 | @@ -154,6 +153,7 @@ | |||
56 | 154 | tx = x + (w // 2) | 153 | tx = x + (w // 2) |
57 | 155 | ty = y + (h // 2) | 154 | ty = y + (h // 2) |
58 | 156 | 155 | ||
60 | 157 | testCase.pointing_device.drag(tx, ty, (tx + main_view.width // 2), ty, rate=1) | 156 | testCase.pointing_device.drag( |
61 | 157 | tx, ty, (tx + main_view.width // 2), ty, rate=1) | ||
62 | 158 | viewfinder = self.get_viewfinder() | 158 | viewfinder = self.get_viewfinder() |
63 | 159 | testCase.assertThat(viewfinder.inView, Eventually(Equals(True))) | 159 | testCase.assertThat(viewfinder.inView, Eventually(Equals(True))) |
64 | 160 | 160 | ||
65 | === modified file 'tests/autopilot/camera_app/emulators/panel.py' | |||
66 | --- tests/autopilot/camera_app/emulators/panel.py 2015-04-28 15:45:33 +0000 | |||
67 | +++ tests/autopilot/camera_app/emulators/panel.py 2015-05-15 07:29:30 +0000 | |||
68 | @@ -1,5 +1,5 @@ | |||
69 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
71 | 2 | # Copyright 2014 Canonical | 2 | # Copyright 2014, 2015 Canonical |
72 | 3 | # | 3 | # |
73 | 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 |
74 | 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 |
75 | @@ -39,7 +39,8 @@ | |||
76 | 39 | start_y = y + self.height - 1 | 39 | start_y = y + self.height - 1 |
77 | 40 | stop_y = y | 40 | stop_y = y |
78 | 41 | 41 | ||
80 | 42 | self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize) | 42 | self.pointing_device.drag( |
81 | 43 | line_x, start_y, line_x, stop_y, rate=sys.maxsize) | ||
82 | 43 | 44 | ||
83 | 44 | @autopilot_logging.log_action(logger.info) | 45 | @autopilot_logging.log_action(logger.info) |
84 | 45 | def close(self): | 46 | def close(self): |
85 | @@ -56,4 +57,5 @@ | |||
86 | 56 | start_y = y | 57 | start_y = y |
87 | 57 | stop_y = y + self.height - 1 | 58 | stop_y = y + self.height - 1 |
88 | 58 | 59 | ||
90 | 59 | self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize) | 60 | self.pointing_device.drag( |
91 | 61 | line_x, start_y, line_x, stop_y, rate=sys.maxsize) | ||
92 | 60 | 62 | ||
93 | === modified file 'tests/autopilot/camera_app/tests/__init__.py' | |||
94 | --- tests/autopilot/camera_app/tests/__init__.py 2015-05-14 15:10:19 +0000 | |||
95 | +++ tests/autopilot/camera_app/tests/__init__.py 2015-05-15 07:29:30 +0000 | |||
96 | @@ -10,15 +10,12 @@ | |||
97 | 10 | import os | 10 | import os |
98 | 11 | import time | 11 | import time |
99 | 12 | import shutil | 12 | import shutil |
100 | 13 | from time import sleep | ||
101 | 14 | from pkg_resources import resource_filename | 13 | from pkg_resources import resource_filename |
102 | 15 | 14 | ||
103 | 16 | import ubuntuuitoolkit | 15 | import ubuntuuitoolkit |
104 | 17 | from autopilot.input import Mouse, Touch, Pointer | 16 | from autopilot.input import Mouse, Touch, Pointer |
105 | 18 | from autopilot.platform import model | 17 | from autopilot.platform import model |
106 | 19 | from autopilot.testcase import AutopilotTestCase | 18 | from autopilot.testcase import AutopilotTestCase |
107 | 20 | from autopilot.matchers import Eventually | ||
108 | 21 | from testtools.matchers import Equals | ||
109 | 22 | 19 | ||
110 | 23 | from camera_app.emulators.main_window import MainWindow | 20 | from camera_app.emulators.main_window import MainWindow |
111 | 24 | 21 | ||
112 | @@ -94,10 +91,10 @@ | |||
113 | 94 | 91 | ||
114 | 95 | def delete_all_media(self): | 92 | def delete_all_media(self): |
115 | 96 | if os.path.exists(self.pictures_dir): | 93 | if os.path.exists(self.pictures_dir): |
117 | 97 | delete_all_files_in_directory(self.pictures_dir) | 94 | self.delete_all_files_in_directory(self.pictures_dir) |
118 | 98 | 95 | ||
119 | 99 | if os.path.exists(self.videos_dir): | 96 | if os.path.exists(self.videos_dir): |
121 | 100 | delete_all_files_in_directory(self.videos_dir) | 97 | self.delete_all_files_in_directory(self.videos_dir) |
122 | 101 | 98 | ||
123 | 102 | def delete_all_files_in_directory(self, directory): | 99 | def delete_all_files_in_directory(self, directory): |
124 | 103 | files = os.listdir(directory) | 100 | files = os.listdir(directory) |
125 | 104 | 101 | ||
126 | === modified file 'tests/autopilot/camera_app/tests/test_capture.py' | |||
127 | --- tests/autopilot/camera_app/tests/test_capture.py 2015-03-10 14:22:52 +0000 | |||
128 | +++ tests/autopilot/camera_app/tests/test_capture.py 2015-05-15 07:29:30 +0000 | |||
129 | @@ -1,5 +1,5 @@ | |||
130 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
132 | 2 | # Copyright 2012 Canonical | 2 | # Copyright 2012, 2015 Canonical |
133 | 3 | # | 3 | # |
134 | 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 |
135 | 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 |
136 | @@ -8,7 +8,6 @@ | |||
137 | 8 | """Tests for the Camera App""" | 8 | """Tests for the Camera App""" |
138 | 9 | 9 | ||
139 | 10 | from autopilot.matchers import Eventually | 10 | from autopilot.matchers import Eventually |
140 | 11 | from autopilot.platform import model | ||
141 | 12 | from testtools.matchers import Equals, NotEquals | 11 | from testtools.matchers import Equals, NotEquals |
142 | 13 | from wand.image import Image | 12 | from wand.image import Image |
143 | 14 | from MediaInfoDLL3 import MediaInfo, Stream | 13 | from MediaInfoDLL3 import MediaInfo, Stream |
144 | @@ -26,8 +25,10 @@ | |||
145 | 26 | """ This is needed to wait for the application to start. | 25 | """ This is needed to wait for the application to start. |
146 | 27 | In the testfarm, the application may take some time to show up.""" | 26 | In the testfarm, the application may take some time to show up.""" |
147 | 28 | def setUp(self): | 27 | def setUp(self): |
150 | 29 | # Remove configuration file where knowledge of the photo roll hint's necessity is stored | 28 | # Remove configuration file where knowledge of the photo roll hint's |
151 | 30 | config_file = os.path.expanduser("~/.config/com.ubuntu.camera/com.ubuntu.camera.conf") | 29 | # necessity is stored |
152 | 30 | config_file = os.path.expanduser( | ||
153 | 31 | "~/.config/com.ubuntu.camera/com.ubuntu.camera.conf") | ||
154 | 31 | if os.path.exists(config_file): | 32 | if os.path.exists(config_file): |
155 | 32 | os.remove(config_file) | 33 | os.remove(config_file) |
156 | 33 | 34 | ||
157 | @@ -82,8 +83,12 @@ | |||
158 | 82 | # check that the camera is able to capture another photo | 83 | # check that the camera is able to capture another photo |
159 | 83 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) | 84 | self.assertThat(exposure_button.enabled, Eventually(Equals(True))) |
160 | 84 | 85 | ||
161 | 85 | """Tests clicking on the record control and checks if the recording time appears""" | ||
162 | 86 | def test_record_video(self): | 86 | def test_record_video(self): |
163 | 87 | """Test clicking on the record control. | ||
164 | 88 | |||
165 | 89 | Check if the recording time appears. | ||
166 | 90 | |||
167 | 91 | """ | ||
168 | 87 | # Get all the elements | 92 | # Get all the elements |
169 | 88 | record_control = self.main_window.get_record_control() | 93 | record_control = self.main_window.get_record_control() |
170 | 89 | stop_watch = self.main_window.get_stop_watch() | 94 | stop_watch = self.main_window.get_stop_watch() |
171 | @@ -164,10 +169,10 @@ | |||
172 | 164 | # Check that the photo roll hint is hidden | 169 | # Check that the photo roll hint is hidden |
173 | 165 | self.assertEquals(hint.visible, False) | 170 | self.assertEquals(hint.visible, False) |
174 | 166 | 171 | ||
175 | 167 | """Test that the shoot button gets disabled for a while then re-enabled | ||
176 | 168 | after shooting""" | ||
177 | 169 | @unittest.skip("Disabled this test due race condition see bug 1227373") | 172 | @unittest.skip("Disabled this test due race condition see bug 1227373") |
178 | 170 | def test_shoot_button_disable(self): | 173 | def test_shoot_button_disable(self): |
179 | 174 | """Test that the shoot button gets disabled for a while then re-enabled | ||
180 | 175 | after shooting""" | ||
181 | 171 | exposure_button = self.main_window.get_exposure_button() | 176 | exposure_button = self.main_window.get_exposure_button() |
182 | 172 | 177 | ||
183 | 173 | # The focus ring should be invisible in the beginning | 178 | # The focus ring should be invisible in the beginning |
184 | @@ -186,8 +191,7 @@ | |||
185 | 186 | def test_picture_quality_setting(self): | 191 | def test_picture_quality_setting(self): |
186 | 187 | qualities = [("Basic Quality", 60), | 192 | qualities = [("Basic Quality", 60), |
187 | 188 | ("Normal Quality", 80), | 193 | ("Normal Quality", 80), |
190 | 189 | ("Fine Quality", 95) | 194 | ("Fine Quality", 95)] |
189 | 190 | ] | ||
191 | 191 | for quality, expectedCompression in qualities: | 195 | for quality, expectedCompression in qualities: |
192 | 192 | self.delete_all_photos() | 196 | self.delete_all_photos() |
193 | 193 | self.set_compression_quality(quality) | 197 | self.set_compression_quality(quality) |
194 | @@ -244,12 +248,15 @@ | |||
195 | 244 | bottom_edge = self.main_window.get_bottom_edge() | 248 | bottom_edge = self.main_window.get_bottom_edge() |
196 | 245 | bottom_edge.open() | 249 | bottom_edge.open() |
197 | 246 | 250 | ||
200 | 247 | # open encoding quality option value selector showing the possible values | 251 | # open encoding quality option value selector showing the possible |
201 | 248 | encoding_quality_button = self.main_window.get_encoding_quality_button() | 252 | # values |
202 | 253 | encoding_quality_button = ( | ||
203 | 254 | self.main_window.get_encoding_quality_button()) | ||
204 | 249 | self.pointing_device.move_to_object(encoding_quality_button) | 255 | self.pointing_device.move_to_object(encoding_quality_button) |
205 | 250 | self.pointing_device.click() | 256 | self.pointing_device.click() |
206 | 251 | option_value_selector = self.main_window.get_option_value_selector() | 257 | option_value_selector = self.main_window.get_option_value_selector() |
208 | 252 | self.assertThat(option_value_selector.visible, Eventually(Equals(True))) | 258 | self.assertThat( |
209 | 259 | option_value_selector.visible, Eventually(Equals(True))) | ||
210 | 253 | 260 | ||
211 | 254 | # tap on chosen compression quality option | 261 | # tap on chosen compression quality option |
212 | 255 | option = self.main_window.get_option_value_button(quality) | 262 | option = self.main_window.get_option_value_button(quality) |
213 | @@ -281,7 +288,8 @@ | |||
214 | 281 | self.record_video(2) | 288 | self.record_video(2) |
215 | 282 | video_file = self.get_first_video() | 289 | video_file = self.get_first_video() |
216 | 283 | height = self.read_video_height(video_file) | 290 | height = self.read_video_height(video_file) |
218 | 284 | expected_height = self.height_from_resolution_label(expected_resolution) | 291 | expected_height = self.height_from_resolution_label( |
219 | 292 | expected_resolution) | ||
220 | 285 | self.assertThat(height, Equals(expected_height)) | 293 | self.assertThat(height, Equals(expected_height)) |
221 | 286 | 294 | ||
222 | 287 | def switch_cameras(self): | 295 | def switch_cameras(self): |
223 | @@ -303,7 +311,8 @@ | |||
224 | 303 | self.record_video(2) | 311 | self.record_video(2) |
225 | 304 | video_file = self.get_first_video() | 312 | video_file = self.get_first_video() |
226 | 305 | height = self.read_video_height(video_file) | 313 | height = self.read_video_height(video_file) |
228 | 306 | expected_height = self.height_from_resolution_label(resolution_label) | 314 | expected_height = self.height_from_resolution_label( |
229 | 315 | resolution_label) | ||
230 | 307 | self.assertThat(height, Equals(expected_height)) | 316 | self.assertThat(height, Equals(expected_height)) |
231 | 308 | self.dismiss_first_photo_hint() | 317 | self.dismiss_first_photo_hint() |
232 | 309 | 318 | ||
233 | @@ -322,12 +331,15 @@ | |||
234 | 322 | bottom_edge = self.main_window.get_bottom_edge() | 331 | bottom_edge = self.main_window.get_bottom_edge() |
235 | 323 | bottom_edge.open() | 332 | bottom_edge.open() |
236 | 324 | 333 | ||
239 | 325 | # open video resolution option value selector showing the possible values | 334 | # open video resolution option value selector showing the possible |
240 | 326 | video_resolution_button = self.main_window.get_video_resolution_button() | 335 | # values |
241 | 336 | video_resolution_button = ( | ||
242 | 337 | self.main_window.get_video_resolution_button()) | ||
243 | 327 | self.pointing_device.move_to_object(video_resolution_button) | 338 | self.pointing_device.move_to_object(video_resolution_button) |
244 | 328 | self.pointing_device.click() | 339 | self.pointing_device.click() |
245 | 329 | option_value_selector = self.main_window.get_option_value_selector() | 340 | option_value_selector = self.main_window.get_option_value_selector() |
247 | 330 | self.assertThat(option_value_selector.visible, Eventually(Equals(True))) | 341 | self.assertThat( |
248 | 342 | option_value_selector.visible, Eventually(Equals(True))) | ||
249 | 331 | optionButtons = option_value_selector.select_many("OptionValueButton") | 343 | optionButtons = option_value_selector.select_many("OptionValueButton") |
250 | 332 | resolutions = [button.label for button in optionButtons] | 344 | resolutions = [button.label for button in optionButtons] |
251 | 333 | 345 | ||
252 | @@ -344,12 +356,15 @@ | |||
253 | 344 | bottom_edge = self.main_window.get_bottom_edge() | 356 | bottom_edge = self.main_window.get_bottom_edge() |
254 | 345 | bottom_edge.open() | 357 | bottom_edge.open() |
255 | 346 | 358 | ||
258 | 347 | # open video resolution option value selector showing the possible values | 359 | # open video resolution option value selector showing the possible |
259 | 348 | video_resolution_button = self.main_window.get_video_resolution_button() | 360 | # values |
260 | 361 | video_resolution_button = ( | ||
261 | 362 | self.main_window.get_video_resolution_button()) | ||
262 | 349 | self.pointing_device.move_to_object(video_resolution_button) | 363 | self.pointing_device.move_to_object(video_resolution_button) |
263 | 350 | self.pointing_device.click() | 364 | self.pointing_device.click() |
264 | 351 | option_value_selector = self.main_window.get_option_value_selector() | 365 | option_value_selector = self.main_window.get_option_value_selector() |
266 | 352 | self.assertThat(option_value_selector.visible, Eventually(Equals(True))) | 366 | self.assertThat( |
267 | 367 | option_value_selector.visible, Eventually(Equals(True))) | ||
268 | 353 | 368 | ||
269 | 354 | # tap on chosen video resolution option | 369 | # tap on chosen video resolution option |
270 | 355 | option = self.main_window.get_option_value_button(resolution_label) | 370 | option = self.main_window.get_option_value_button(resolution_label) |
271 | 356 | 371 | ||
272 | === modified file 'tests/autopilot/camera_app/tests/test_diskspace.py' | |||
273 | --- tests/autopilot/camera_app/tests/test_diskspace.py 2015-01-24 22:26:48 +0000 | |||
274 | +++ tests/autopilot/camera_app/tests/test_diskspace.py 2015-05-15 07:29:30 +0000 | |||
275 | @@ -1,5 +1,5 @@ | |||
276 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
278 | 2 | # Copyright 2012 Canonical | 2 | # Copyright 2012, 2015 Canonical |
279 | 3 | # | 3 | # |
280 | 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 |
281 | 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 |
282 | @@ -12,7 +12,6 @@ | |||
283 | 12 | 12 | ||
284 | 13 | from camera_app.tests import CameraAppTestCase | 13 | from camera_app.tests import CameraAppTestCase |
285 | 14 | 14 | ||
286 | 15 | import unittest | ||
287 | 16 | import os.path | 15 | import os.path |
288 | 17 | import os | 16 | import os |
289 | 18 | from ctypes import CDLL, c_longlong as ll | 17 | from ctypes import CDLL, c_longlong as ll |
290 | @@ -21,13 +20,12 @@ | |||
291 | 21 | LOW_THRESHOLD = 200 * MEGABYTE | 20 | LOW_THRESHOLD = 200 * MEGABYTE |
292 | 22 | CRITICAL_THRESHOLD = 50 * MEGABYTE | 21 | CRITICAL_THRESHOLD = 50 * MEGABYTE |
293 | 23 | 22 | ||
294 | 23 | |||
295 | 24 | class TestCameraDiskSpace(CameraAppTestCase): | 24 | class TestCameraDiskSpace(CameraAppTestCase): |
296 | 25 | """Tests low disk space situations""" | 25 | """Tests low disk space situations""" |
297 | 26 | 26 | ||
298 | 27 | def diskSpaceAvailable(self): | 27 | def diskSpaceAvailable(self): |
299 | 28 | """Check the amount of free disk space""" | 28 | """Check the amount of free disk space""" |
300 | 29 | |||
301 | 30 | |||
302 | 31 | stats = os.statvfs(os.path.expanduser(self.videoPath)) | 29 | stats = os.statvfs(os.path.expanduser(self.videoPath)) |
303 | 32 | return stats.f_bavail * stats.f_frsize | 30 | return stats.f_bavail * stats.f_frsize |
304 | 33 | 31 | ||
305 | @@ -36,9 +34,11 @@ | |||
306 | 36 | 34 | ||
307 | 37 | # Take into account the currently existing filler file, if any, as we | 35 | # Take into account the currently existing filler file, if any, as we |
308 | 38 | # will be overwriting it to the new size. | 36 | # will be overwriting it to the new size. |
310 | 39 | fillerSize = (self.diskSpaceAvailable() + self.currentFillerSize) - size | 37 | fillerSize = ( |
311 | 38 | self.diskSpaceAvailable() + self.currentFillerSize) - size | ||
312 | 40 | fd = open(self.diskFiller, "w") | 39 | fd = open(self.diskFiller, "w") |
314 | 41 | ret = CDLL("libc.so.6").posix_fallocate64(fd.fileno(), ll(0), ll(fillerSize)) | 40 | ret = CDLL("libc.so.6").posix_fallocate64( |
315 | 41 | fd.fileno(), ll(0), ll(fillerSize)) | ||
316 | 42 | self.assertThat(ret, Equals(0)) | 42 | self.assertThat(ret, Equals(0)) |
317 | 43 | self.currentFillerSize = fillerSize | 43 | self.currentFillerSize = fillerSize |
318 | 44 | 44 | ||
319 | @@ -53,11 +53,12 @@ | |||
320 | 53 | self.diskFiller = os.path.join(self.videoPath, "filler") | 53 | self.diskFiller = os.path.join(self.videoPath, "filler") |
321 | 54 | self.currentFillerSize = 0 | 54 | self.currentFillerSize = 0 |
322 | 55 | 55 | ||
324 | 56 | # remove the filler file before starting, in case a previous test crashed | 56 | # remove the filler file before starting, in case a previous test |
325 | 57 | # crashed | ||
326 | 57 | os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None | 58 | os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None |
327 | 58 | 59 | ||
330 | 59 | # we can't start tests when the disk space is already below the threshold | 60 | # we can't start tests when the disk space is already below the |
331 | 60 | # as they all expect a normal situation at the start | 61 | # threshold as they all expect a normal situation at the start |
332 | 61 | self.assertThat(self.diskSpaceAvailable(), GreaterThan(LOW_THRESHOLD)) | 62 | self.assertThat(self.diskSpaceAvailable(), GreaterThan(LOW_THRESHOLD)) |
333 | 62 | 63 | ||
334 | 63 | self.assertThat( | 64 | self.assertThat( |
335 | @@ -68,7 +69,8 @@ | |||
336 | 68 | os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None | 69 | os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None |
337 | 69 | 70 | ||
338 | 70 | def test_critically_low_disk(self): | 71 | def test_critically_low_disk(self): |
340 | 71 | """Verify proper behavior when disk space becomes critically low and back""" | 72 | """Verify proper behavior when disk space becomes critically low and |
341 | 73 | back""" | ||
342 | 72 | 74 | ||
343 | 73 | exposure_button = self.main_window.get_exposure_button() | 75 | exposure_button = self.main_window.get_exposure_button() |
344 | 74 | no_space_hint = self.main_window.get_no_space_hint() | 76 | no_space_hint = self.main_window.get_no_space_hint() |
345 | @@ -77,22 +79,23 @@ | |||
346 | 77 | self.assertThat(no_space_hint.visible, Equals(False)) | 79 | self.assertThat(no_space_hint.visible, Equals(False)) |
347 | 78 | 80 | ||
348 | 79 | self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE) | 81 | self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE) |
350 | 80 | self.assertThat(self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD)) | 82 | self.assertThat( |
351 | 83 | self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD)) | ||
352 | 81 | 84 | ||
353 | 82 | self.assertThat(exposure_button.enabled, Eventually(Equals(False))) | 85 | self.assertThat(exposure_button.enabled, Eventually(Equals(False))) |
354 | 83 | self.assertThat(no_space_hint.visible, Eventually(Equals(True))) | 86 | self.assertThat(no_space_hint.visible, Eventually(Equals(True))) |
355 | 84 | 87 | ||
356 | 85 | self.setFreeSpaceTo(CRITICAL_THRESHOLD + MEGABYTE) | 88 | self.setFreeSpaceTo(CRITICAL_THRESHOLD + MEGABYTE) |
358 | 86 | self.assertThat(self.diskSpaceAvailable(), GreaterThan(CRITICAL_THRESHOLD)) | 89 | self.assertThat( |
359 | 90 | self.diskSpaceAvailable(), GreaterThan(CRITICAL_THRESHOLD)) | ||
360 | 87 | 91 | ||
361 | 88 | self.assertThat(exposure_button.enabled, Equals(True)) | 92 | self.assertThat(exposure_button.enabled, Equals(True)) |
362 | 89 | self.assertThat(no_space_hint.visible, Equals(False)) | 93 | self.assertThat(no_space_hint.visible, Equals(False)) |
363 | 90 | 94 | ||
364 | 91 | def test_low_disk(self): | 95 | def test_low_disk(self): |
365 | 92 | """Verify proper behavior when disk space becomes low""" | 96 | """Verify proper behavior when disk space becomes low""" |
369 | 93 | 97 | self.main_window.get_exposure_button() | |
370 | 94 | exposure_button = self.main_window.get_exposure_button() | 98 | self.main_window.get_no_space_hint() |
368 | 95 | no_space_hint = self.main_window.get_no_space_hint() | ||
371 | 96 | dialog = self.main_window.get_low_space_dialog() | 99 | dialog = self.main_window.get_low_space_dialog() |
372 | 97 | self.assertThat(dialog, Equals(None)) | 100 | self.assertThat(dialog, Equals(None)) |
373 | 98 | 101 | ||
374 | @@ -109,7 +112,8 @@ | |||
375 | 109 | stop_watch = self.main_window.get_stop_watch() | 112 | stop_watch = self.main_window.get_stop_watch() |
376 | 110 | exposure_button = self.main_window.get_exposure_button() | 113 | exposure_button = self.main_window.get_exposure_button() |
377 | 111 | 114 | ||
379 | 112 | # Click the record button to toggle photo/video mode then start recording | 115 | # Click the record button to toggle photo/video mode then start |
380 | 116 | # recording | ||
381 | 113 | self.pointing_device.move_to_object(record_control) | 117 | self.pointing_device.move_to_object(record_control) |
382 | 114 | self.pointing_device.click() | 118 | self.pointing_device.click() |
383 | 115 | self.pointing_device.move_to_object(exposure_button) | 119 | self.pointing_device.move_to_object(exposure_button) |
384 | @@ -121,5 +125,6 @@ | |||
385 | 121 | 125 | ||
386 | 122 | # Now reduce the space to critically low, then see if recording stops | 126 | # Now reduce the space to critically low, then see if recording stops |
387 | 123 | self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE) | 127 | self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE) |
389 | 124 | self.assertThat(self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD)) | 128 | self.assertThat( |
390 | 129 | self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD)) | ||
391 | 125 | self.assertThat(stop_watch.opacity, Eventually(Equals(0.0))) | 130 | self.assertThat(stop_watch.opacity, Eventually(Equals(0.0))) |
392 | 126 | 131 | ||
393 | === modified file 'tests/autopilot/camera_app/tests/test_flash.py' | |||
394 | --- tests/autopilot/camera_app/tests/test_flash.py 2015-02-17 18:04:01 +0000 | |||
395 | +++ tests/autopilot/camera_app/tests/test_flash.py 2015-05-15 07:29:30 +0000 | |||
396 | @@ -1,5 +1,5 @@ | |||
397 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
399 | 2 | # Copyright 2012 Canonical | 2 | # Copyright 2012, 2015 Canonical |
400 | 3 | # | 3 | # |
401 | 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 |
402 | 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 |
403 | @@ -7,13 +7,11 @@ | |||
404 | 7 | 7 | ||
405 | 8 | """Tests for the Camera App flash""" | 8 | """Tests for the Camera App flash""" |
406 | 9 | 9 | ||
408 | 10 | from testtools.matchers import Equals, NotEquals | 10 | from testtools.matchers import Equals |
409 | 11 | from autopilot.matchers import Eventually | 11 | from autopilot.matchers import Eventually |
410 | 12 | 12 | ||
411 | 13 | from camera_app.tests import CameraAppTestCase | 13 | from camera_app.tests import CameraAppTestCase |
412 | 14 | 14 | ||
413 | 15 | import unittest | ||
414 | 16 | |||
415 | 17 | 15 | ||
416 | 18 | class TestCameraFlash(CameraAppTestCase): | 16 | class TestCameraFlash(CameraAppTestCase): |
417 | 19 | """Tests the flash""" | 17 | """Tests the flash""" |
418 | @@ -104,7 +102,8 @@ | |||
419 | 104 | # open option value selector showing the possible values | 102 | # open option value selector showing the possible values |
420 | 105 | self.pointing_device.move_to_object(flash_button) | 103 | self.pointing_device.move_to_object(flash_button) |
421 | 106 | self.pointing_device.click() | 104 | self.pointing_device.click() |
423 | 107 | self.assertThat(option_value_selector.visible, Eventually(Equals(True))) | 105 | self.assertThat( |
424 | 106 | option_value_selector.visible, Eventually(Equals(True))) | ||
425 | 108 | 107 | ||
426 | 109 | # set flash to "on" | 108 | # set flash to "on" |
427 | 110 | option = self.main_window.get_option_value_button("On") | 109 | option = self.main_window.get_option_value_button("On") |
428 | @@ -115,9 +114,11 @@ | |||
429 | 115 | # closes the flash options menu and open the hdr options menu | 114 | # closes the flash options menu and open the hdr options menu |
430 | 116 | self.pointing_device.move_to_object(hdr_button) | 115 | self.pointing_device.move_to_object(hdr_button) |
431 | 117 | self.pointing_device.click() | 116 | self.pointing_device.click() |
433 | 118 | self.assertThat(option_value_selector.visible, Eventually(Equals(False))) | 117 | self.assertThat( |
434 | 118 | option_value_selector.visible, Eventually(Equals(False))) | ||
435 | 119 | self.pointing_device.click() | 119 | self.pointing_device.click() |
437 | 120 | self.assertThat(option_value_selector.visible, Eventually(Equals(True))) | 120 | self.assertThat( |
438 | 121 | option_value_selector.visible, Eventually(Equals(True))) | ||
439 | 121 | 122 | ||
440 | 122 | # set hdr to "on" and verify that flash is "off" | 123 | # set hdr to "on" and verify that flash is "off" |
441 | 123 | option = self.main_window.get_option_value_button("On") | 124 | option = self.main_window.get_option_value_button("On") |
442 | @@ -129,9 +130,11 @@ | |||
443 | 129 | # closes the hdr options menu and open the flash options menu | 130 | # closes the hdr options menu and open the flash options menu |
444 | 130 | self.pointing_device.move_to_object(flash_button) | 131 | self.pointing_device.move_to_object(flash_button) |
445 | 131 | self.pointing_device.click() | 132 | self.pointing_device.click() |
447 | 132 | self.assertThat(option_value_selector.visible, Eventually(Equals(False))) | 133 | self.assertThat( |
448 | 134 | option_value_selector.visible, Eventually(Equals(False))) | ||
449 | 133 | self.pointing_device.click() | 135 | self.pointing_device.click() |
451 | 134 | self.assertThat(option_value_selector.visible, Eventually(Equals(True))) | 136 | self.assertThat( |
452 | 137 | option_value_selector.visible, Eventually(Equals(True))) | ||
453 | 135 | 138 | ||
454 | 136 | # set flash to "on" and verify that hdr is "off" | 139 | # set flash to "on" and verify that hdr is "off" |
455 | 137 | option = self.main_window.get_option_value_button("On") | 140 | option = self.main_window.get_option_value_button("On") |
456 | 138 | 141 | ||
457 | === modified file 'tests/autopilot/camera_app/tests/test_focus.py' | |||
458 | --- tests/autopilot/camera_app/tests/test_focus.py 2014-06-30 07:57:09 +0000 | |||
459 | +++ tests/autopilot/camera_app/tests/test_focus.py 2015-05-15 07:29:30 +0000 | |||
460 | @@ -1,5 +1,5 @@ | |||
461 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
463 | 2 | # Copyright 2012 Canonical | 2 | # Copyright 2012, 2015 Canonical |
464 | 3 | # | 3 | # |
465 | 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 |
466 | 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 |
467 | @@ -45,7 +45,7 @@ | |||
468 | 45 | 45 | ||
469 | 46 | # The focus ring sould be visible and centered to the mouse click | 46 | # The focus ring sould be visible and centered to the mouse click |
470 | 47 | # coords now | 47 | # coords now |
472 | 48 | focus_ring_center = self.get_center(focus_ring) | 48 | # focus_ring_center = self.get_center(focus_ring) |
473 | 49 | self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5))) | 49 | self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5))) |
474 | 50 | # self.assertEquals(focus_ring_center, click_coords) | 50 | # self.assertEquals(focus_ring_center, click_coords) |
475 | 51 | 51 | ||
476 | @@ -65,7 +65,7 @@ | |||
477 | 65 | 65 | ||
478 | 66 | # The focus ring sould be visible and centered to the mouse | 66 | # The focus ring sould be visible and centered to the mouse |
479 | 67 | # click coords now | 67 | # click coords now |
481 | 68 | focus_ring_center = self.get_center(focus_ring) | 68 | # focus_ring_center = self.get_center(focus_ring) |
482 | 69 | self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5))) | 69 | self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5))) |
483 | 70 | # self.assertEquals(focus_ring_center, click_coords) | 70 | # self.assertEquals(focus_ring_center, click_coords) |
484 | 71 | 71 | ||
485 | 72 | 72 | ||
486 | === modified file 'tests/autopilot/camera_app/tests/test_gallery_view.py' | |||
487 | --- tests/autopilot/camera_app/tests/test_gallery_view.py 2015-03-10 16:33:24 +0000 | |||
488 | +++ tests/autopilot/camera_app/tests/test_gallery_view.py 2015-05-15 07:29:30 +0000 | |||
489 | @@ -1,5 +1,5 @@ | |||
490 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
492 | 2 | # Copyright 2014 Canonical | 2 | # Copyright 2014, 2015 Canonical |
493 | 3 | # | 3 | # |
494 | 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 |
495 | 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 |
496 | @@ -7,15 +7,14 @@ | |||
497 | 7 | 7 | ||
498 | 8 | """Tests for the Camera App zoom""" | 8 | """Tests for the Camera App zoom""" |
499 | 9 | 9 | ||
501 | 10 | from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan | 10 | from testtools.matchers import Equals |
502 | 11 | from autopilot.matchers import Eventually | 11 | from autopilot.matchers import Eventually |
503 | 12 | 12 | ||
504 | 13 | from camera_app.tests import CameraAppTestCase | 13 | from camera_app.tests import CameraAppTestCase |
505 | 14 | 14 | ||
506 | 15 | import unittest | ||
507 | 16 | import os | ||
508 | 17 | from time import sleep | 15 | from time import sleep |
509 | 18 | 16 | ||
510 | 17 | |||
511 | 19 | class TestCameraGalleryViewMixin(object): | 18 | class TestCameraGalleryViewMixin(object): |
512 | 20 | def move_from_slideshow_to_photogrid(self): | 19 | def move_from_slideshow_to_photogrid(self): |
513 | 21 | gallery = self.main_window.get_gallery() | 20 | gallery = self.main_window.get_gallery() |
514 | @@ -47,6 +46,7 @@ | |||
515 | 47 | sleep(1) | 46 | sleep(1) |
516 | 48 | self.pointing_device.release() | 47 | self.pointing_device.release() |
517 | 49 | 48 | ||
518 | 49 | |||
519 | 50 | class TestCameraGalleryView(CameraAppTestCase, TestCameraGalleryViewMixin): | 50 | class TestCameraGalleryView(CameraAppTestCase, TestCameraGalleryViewMixin): |
520 | 51 | """Tests the camera gallery view without media already present""" | 51 | """Tests the camera gallery view without media already present""" |
521 | 52 | 52 | ||
522 | @@ -104,7 +104,9 @@ | |||
523 | 104 | 104 | ||
524 | 105 | self.assertThat(hint.visible, Eventually(Equals(False))) | 105 | self.assertThat(hint.visible, Eventually(Equals(False))) |
525 | 106 | 106 | ||
527 | 107 | class TestCameraGalleryViewWithVideo(TestCameraGalleryViewMixin, CameraAppTestCase): | 107 | |
528 | 108 | class TestCameraGalleryViewWithVideo( | ||
529 | 109 | TestCameraGalleryViewMixin, CameraAppTestCase): | ||
530 | 108 | """Tests the camera gallery view with video already present""" | 110 | """Tests the camera gallery view with video already present""" |
531 | 109 | 111 | ||
532 | 110 | def setUp(self): | 112 | def setUp(self): |
533 | @@ -131,7 +133,9 @@ | |||
534 | 131 | spinner = gallery.wait_select_single("ActivityIndicator") | 133 | spinner = gallery.wait_select_single("ActivityIndicator") |
535 | 132 | self.assertThat(spinner.running, Eventually(Equals(False))) | 134 | self.assertThat(spinner.running, Eventually(Equals(False))) |
536 | 133 | 135 | ||
538 | 134 | class TestCameraGalleryViewWithPhoto(TestCameraGalleryViewMixin, CameraAppTestCase): | 136 | |
539 | 137 | class TestCameraGalleryViewWithPhoto( | ||
540 | 138 | TestCameraGalleryViewMixin, CameraAppTestCase): | ||
541 | 135 | """Tests the camera gallery view with photo already present""" | 139 | """Tests the camera gallery view with photo already present""" |
542 | 136 | 140 | ||
543 | 137 | def setUp(self): | 141 | def setUp(self): |
544 | 138 | 142 | ||
545 | === modified file 'tests/autopilot/camera_app/tests/test_options.py' | |||
546 | --- tests/autopilot/camera_app/tests/test_options.py 2014-12-08 12:04:21 +0000 | |||
547 | +++ tests/autopilot/camera_app/tests/test_options.py 2015-05-15 07:29:30 +0000 | |||
548 | @@ -1,5 +1,5 @@ | |||
549 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
551 | 2 | # Copyright 2014 Canonical | 2 | # Copyright 2014, 2015 Canonical |
552 | 3 | # | 3 | # |
553 | 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 |
554 | 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 |
555 | @@ -12,6 +12,7 @@ | |||
556 | 12 | 12 | ||
557 | 13 | from camera_app.tests import CameraAppTestCase | 13 | from camera_app.tests import CameraAppTestCase |
558 | 14 | 14 | ||
559 | 15 | |||
560 | 15 | class TestCameraOptions(CameraAppTestCase): | 16 | class TestCameraOptions(CameraAppTestCase): |
561 | 16 | """Tests the options overlay""" | 17 | """Tests the options overlay""" |
562 | 17 | 18 | ||
563 | @@ -43,7 +44,8 @@ | |||
564 | 43 | 44 | ||
565 | 44 | """Test toggling on/off grid lines option""" | 45 | """Test toggling on/off grid lines option""" |
566 | 45 | def test_toggle_grid_lines(self): | 46 | def test_toggle_grid_lines(self): |
568 | 46 | gridlines = self.app.wait_select_single("QQuickItem", objectName="gridlines") | 47 | gridlines = self.app.wait_select_single( |
569 | 48 | "QQuickItem", objectName="gridlines") | ||
570 | 47 | self.set_grid_lines_value("On") | 49 | self.set_grid_lines_value("On") |
571 | 48 | self.assertEquals(gridlines.visible, True) | 50 | self.assertEquals(gridlines.visible, True) |
572 | 49 | self.set_grid_lines_value("Off") | 51 | self.set_grid_lines_value("Off") |
573 | @@ -59,7 +61,8 @@ | |||
574 | 59 | self.pointing_device.move_to_object(grid_lines_button) | 61 | self.pointing_device.move_to_object(grid_lines_button) |
575 | 60 | self.pointing_device.click() | 62 | self.pointing_device.click() |
576 | 61 | option_value_selector = self.main_window.get_option_value_selector() | 63 | option_value_selector = self.main_window.get_option_value_selector() |
578 | 62 | self.assertThat(option_value_selector.visible, Eventually(Equals(True))) | 64 | self.assertThat( |
579 | 65 | option_value_selector.visible, Eventually(Equals(True))) | ||
580 | 63 | 66 | ||
581 | 64 | # tap on chosen value | 67 | # tap on chosen value |
582 | 65 | option = self.main_window.get_option_value_button(value) | 68 | option = self.main_window.get_option_value_button(value) |
583 | 66 | 69 | ||
584 | === modified file 'tests/autopilot/camera_app/tests/test_photo_editor.py' | |||
585 | --- tests/autopilot/camera_app/tests/test_photo_editor.py 2015-03-11 09:25:36 +0000 | |||
586 | +++ tests/autopilot/camera_app/tests/test_photo_editor.py 2015-05-15 07:29:30 +0000 | |||
587 | @@ -1,5 +1,5 @@ | |||
588 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
590 | 2 | # Copyright 2014 Canonical | 2 | # Copyright 2014, 2015 Canonical |
591 | 3 | # | 3 | # |
592 | 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 |
593 | 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 |
594 | @@ -7,16 +7,12 @@ | |||
595 | 7 | 7 | ||
596 | 8 | """Tests for the Camera photo editor""" | 8 | """Tests for the Camera photo editor""" |
597 | 9 | 9 | ||
599 | 10 | from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan | 10 | from testtools.matchers import Equals |
600 | 11 | from autopilot.matchers import Eventually | 11 | from autopilot.matchers import Eventually |
601 | 12 | from autopilot.exceptions import StateNotFoundError | 12 | from autopilot.exceptions import StateNotFoundError |
602 | 13 | 13 | ||
603 | 14 | from camera_app.tests import CameraAppTestCase | 14 | from camera_app.tests import CameraAppTestCase |
604 | 15 | 15 | ||
605 | 16 | import unittest | ||
606 | 17 | import os | ||
607 | 18 | from time import sleep | ||
608 | 19 | |||
609 | 20 | 16 | ||
610 | 21 | class TestCameraPhotoEditorWithPhoto(CameraAppTestCase): | 17 | class TestCameraPhotoEditorWithPhoto(CameraAppTestCase): |
611 | 22 | """Tests photo editor when a photo is present""" | 18 | """Tests photo editor when a photo is present""" |
612 | @@ -35,7 +31,7 @@ | |||
613 | 35 | """Tests editor opening and closing correctly for pictures""" | 31 | """Tests editor opening and closing correctly for pictures""" |
614 | 36 | def test_editor_appears(self): | 32 | def test_editor_appears(self): |
615 | 37 | 33 | ||
617 | 38 | viewfinder = self.main_window.get_viewfinder() | 34 | self.main_window.get_viewfinder() |
618 | 39 | gallery = self.main_window.get_gallery() | 35 | gallery = self.main_window.get_gallery() |
619 | 40 | 36 | ||
620 | 41 | self.main_window.swipe_to_gallery(self) | 37 | self.main_window.swipe_to_gallery(self) |
621 | @@ -48,8 +44,9 @@ | |||
622 | 48 | self.pointing_device.click() | 44 | self.pointing_device.click() |
623 | 49 | 45 | ||
624 | 50 | # If the editor button is not there when in the gallery view, then | 46 | # If the editor button is not there when in the gallery view, then |
627 | 51 | # we are not on a system that has the UI extras package installed or has | 47 | # we are not on a system that has the UI extras package installed or |
628 | 52 | # an older version than the one we need. Skip the test in this case. | 48 | # has an older version than the one we need. Skip the test in this |
629 | 49 | # case. | ||
630 | 53 | try: | 50 | try: |
631 | 54 | edit = gallery.wait_select_single(objectName="actionButtonEdit") | 51 | edit = gallery.wait_select_single(objectName="actionButtonEdit") |
632 | 55 | except: | 52 | except: |
633 | @@ -81,6 +78,7 @@ | |||
634 | 81 | disappeared = True | 78 | disappeared = True |
635 | 82 | self.assertThat(disappeared, Equals(True)) | 79 | self.assertThat(disappeared, Equals(True)) |
636 | 83 | 80 | ||
637 | 81 | |||
638 | 84 | class TestCameraPhotoEditorWithVideo(CameraAppTestCase): | 82 | class TestCameraPhotoEditorWithVideo(CameraAppTestCase): |
639 | 85 | """Tests photo editor when a video is present""" | 83 | """Tests photo editor when a video is present""" |
640 | 86 | 84 | ||
641 | @@ -99,7 +97,7 @@ | |||
642 | 99 | def test_editor_not_on_videos(self): | 97 | def test_editor_not_on_videos(self): |
643 | 100 | self.add_sample_video() | 98 | self.add_sample_video() |
644 | 101 | 99 | ||
646 | 102 | viewfinder = self.main_window.get_viewfinder() | 100 | self.main_window.get_viewfinder() |
647 | 103 | gallery = self.main_window.get_gallery() | 101 | gallery = self.main_window.get_gallery() |
648 | 104 | 102 | ||
649 | 105 | self.main_window.swipe_to_gallery(self) | 103 | self.main_window.swipe_to_gallery(self) |
650 | @@ -112,8 +110,9 @@ | |||
651 | 112 | self.pointing_device.click() | 110 | self.pointing_device.click() |
652 | 113 | 111 | ||
653 | 114 | # If the editor button is not there when in the gallery view, then | 112 | # If the editor button is not there when in the gallery view, then |
656 | 115 | # we are not on a system that has the UI extras package installed or has | 113 | # we are not on a system that has the UI extras package installed or |
657 | 116 | # an older version than the one we need. Skip the test in this case. | 114 | # has an older version than the one we need. Skip the test in this |
658 | 115 | # case. | ||
659 | 117 | try: | 116 | try: |
660 | 118 | edit = gallery.wait_select_single(objectName="actionButtonEdit") | 117 | edit = gallery.wait_select_single(objectName="actionButtonEdit") |
661 | 119 | except: | 118 | except: |
662 | 120 | 119 | ||
663 | === modified file 'tests/autopilot/camera_app/tests/test_zoom.py' | |||
664 | --- tests/autopilot/camera_app/tests/test_zoom.py 2014-09-08 14:12:42 +0000 | |||
665 | +++ tests/autopilot/camera_app/tests/test_zoom.py 2015-05-15 07:29:30 +0000 | |||
666 | @@ -1,5 +1,5 @@ | |||
667 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
669 | 2 | # Copyright 2014 Canonical | 2 | # Copyright 2014, 2015 Canonical |
670 | 3 | # | 3 | # |
671 | 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 |
672 | 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 |
673 | @@ -7,7 +7,7 @@ | |||
674 | 7 | 7 | ||
675 | 8 | """Tests for the Camera App zoom""" | 8 | """Tests for the Camera App zoom""" |
676 | 9 | 9 | ||
678 | 10 | from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan | 10 | from testtools.matchers import Equals |
679 | 11 | from autopilot.matchers import Eventually | 11 | from autopilot.matchers import Eventually |
680 | 12 | from autopilot.gestures import pinch | 12 | from autopilot.gestures import pinch |
681 | 13 | 13 |
Initial cleanup to make the tests more readable and maintainable.