Merge lp:~canonical-platform-qa/camera-app/use_app_for_pointing_device into lp:camera-app

Proposed by Brendan Donegan
Status: Superseded
Proposed branch: lp:~canonical-platform-qa/camera-app/use_app_for_pointing_device
Merge into: lp:camera-app
Diff against target: 689 lines (+119/-86)
13 files modified
debian/control (+1/-0)
debian/rules (+4/-0)
tests/autopilot/camera_app/emulators/main_window.py (+6/-6)
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/use_app_for_pointing_device
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Leo Arias (community) Approve
Ubuntu Phablet Team Pending
Review via email: mp+250155@code.launchpad.net

This proposal has been superseded by a proposal from 2015-05-15.

Commit message

Use app proxy instead of testCase for the pointing_device in MainWindow swipe_ functions

Description of the change

A couple of the functions in the MainWindow class oddly assume that the AutopilotTestCase has a pointing_device member. This is not necessarily the case but the app proxy is sure to have one, and the MainWindow class already stores the app proxy in self.app so we should really use that instead of the testCase to provide the pointing device

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

lgtm.
A future improvement is to make the MainWindow a custom proxy object, then there will be no need to save the app proxy as an instance var.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

The mako job failed due to a device having failed. The -ci job as been restarted.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
515. By Leo Arias

Merged with prerequisite.

Unmerged revisions

Preview Diff

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

Subscribers

People subscribed via source and target branches