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