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

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
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.

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

Initial cleanup to make the tests more readable and maintainable.

558. By Leo Arias

Added the flake8 check to debian rules.

559. By Leo Arias

Fixed error in trunk.

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
=== removed file 'tests/autopilot/camera_app/emulators/baseemulator.py'
--- tests/autopilot/camera_app/emulators/baseemulator.py 2014-06-26 11:49:31 +0000
+++ tests/autopilot/camera_app/emulators/baseemulator.py 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2014 Canonical
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
7
8import autopilot
9from autopilot import (
10 input,
11 platform
12)
13from autopilot.introspection import dbus
14
15
16def get_pointing_device():
17 """Return the pointing device depending on the platform.
18
19 If the platform is `Desktop`, the pointing device will be a `Mouse`.
20 If not, the pointing device will be `Touch`.
21
22 """
23 if platform.model() == 'Desktop':
24 input_device_class = input.Mouse
25 else:
26 input_device_class = input.Touch
27 return input.Pointer(device=input_device_class.create())
28
29
30class CameraCustomProxyObjectBase(dbus.CustomEmulatorBase):
31 """A base class for all the Camera App emulators."""
32
33 def __init__(self, *args):
34 super(CameraCustomProxyObjectBase, self).__init__(*args)
35 self.pointing_device = get_pointing_device()
360
=== modified file 'tests/autopilot/camera_app/emulators/main_window.py'
--- tests/autopilot/camera_app/emulators/main_window.py 2015-03-10 16:14:20 +0000
+++ tests/autopilot/camera_app/emulators/main_window.py 2015-04-29 17:40:44 +0000
@@ -1,12 +1,10 @@
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 -*-
2# Copyright 2014 Canonical2# Copyright 2014, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.6# by the Free Software Foundation.
77
8import sys
9
10from camera_app.emulators.panel import Panel8from camera_app.emulators.panel import Panel
11from autopilot.matchers import Eventually9from autopilot.matchers import Eventually
12from testtools.matchers import Equals10from testtools.matchers import Equals
@@ -47,7 +45,8 @@
47 return self.app.wait_select_single("ShootButton")45 return self.app.wait_select_single("ShootButton")
4846
49 def get_photo_roll_hint(self):47 def get_photo_roll_hint(self):
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
49 photo roll"""
51 return self.app.wait_select_single("PhotoRollHint")50 return self.app.wait_select_single("PhotoRollHint")
5251
53 def get_record_control(self):52 def get_record_control(self):
@@ -154,6 +153,7 @@
154 tx = x + (w // 2)153 tx = x + (w // 2)
155 ty = y + (h // 2)154 ty = y + (h // 2)
156155
157 testCase.pointing_device.drag(tx, ty, (tx + main_view.width // 2), ty, rate=1)156 testCase.pointing_device.drag(
157 tx, ty, (tx + main_view.width // 2), ty, rate=1)
158 viewfinder = self.get_viewfinder()158 viewfinder = self.get_viewfinder()
159 testCase.assertThat(viewfinder.inView, Eventually(Equals(True)))159 testCase.assertThat(viewfinder.inView, Eventually(Equals(True)))
160160
=== modified file 'tests/autopilot/camera_app/emulators/panel.py'
--- tests/autopilot/camera_app/emulators/panel.py 2015-03-10 09:46:26 +0000
+++ tests/autopilot/camera_app/emulators/panel.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2014 Canonical2# Copyright 2014, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -8,14 +8,14 @@
8import logging8import logging
9import sys9import sys
1010
11import ubuntuuitoolkit
11from autopilot import logging as autopilot_logging12from autopilot import logging as autopilot_logging
12from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase
1313
1414
15logger = logging.getLogger(__name__)15logger = logging.getLogger(__name__)
1616
1717
18class Panel(CameraCustomProxyObjectBase):18class Panel(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
19 """Panel Autopilot emulator."""19 """Panel Autopilot emulator."""
2020
21 @autopilot_logging.log_action(logger.info)21 @autopilot_logging.log_action(logger.info)
@@ -39,7 +39,8 @@
39 start_y = y + self.height - 139 start_y = y + self.height - 1
40 stop_y = y40 stop_y = y
4141
42 self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize)42 self.pointing_device.drag(
43 line_x, start_y, line_x, stop_y, rate=sys.maxsize)
4344
44 @autopilot_logging.log_action(logger.info)45 @autopilot_logging.log_action(logger.info)
45 def close(self):46 def close(self):
@@ -56,4 +57,5 @@
56 start_y = y57 start_y = y
57 stop_y = y + self.height - 158 stop_y = y + self.height - 1
5859
59 self.pointing_device.drag(line_x, start_y, line_x, stop_y, rate=sys.maxsize)60 self.pointing_device.drag(
61 line_x, start_y, line_x, stop_y, rate=sys.maxsize)
6062
=== modified file 'tests/autopilot/camera_app/tests/__init__.py'
--- tests/autopilot/camera_app/tests/__init__.py 2015-03-10 13:52:56 +0000
+++ tests/autopilot/camera_app/tests/__init__.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2012 Canonical2# Copyright 2012, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -10,17 +10,17 @@
10import os10import os
11import time11import time
12import shutil12import shutil
13from time import sleep
14from pkg_resources import resource_filename13from pkg_resources import resource_filename
1514
15import ubuntuuitoolkit
16from autopilot.input import Mouse, Touch, Pointer16from autopilot.input import Mouse, Touch, Pointer
17from autopilot.platform import model17from autopilot.platform import model
18from autopilot.testcase import AutopilotTestCase18from autopilot.testcase import AutopilotTestCase
19from autopilot.matchers import Eventually
20from testtools.matchers import Equals
2119
22from camera_app.emulators.main_window import MainWindow20from camera_app.emulators.main_window import MainWindow
23from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase21
22
23CUSTOM_PROXY_OBJECT_BASE = ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
2424
2525
26class CameraAppTestCase(AutopilotTestCase):26class CameraAppTestCase(AutopilotTestCase):
@@ -60,13 +60,13 @@
60 def launch_test_local(self):60 def launch_test_local(self):
61 self.app = self.launch_test_application(61 self.app = self.launch_test_application(
62 self.local_location,62 self.local_location,
63 emulator_base=CameraCustomProxyObjectBase)63 emulator_base=CUSTOM_PROXY_OBJECT_BASE)
6464
65 def launch_test_installed(self):65 def launch_test_installed(self):
66 if model() == 'Desktop':66 if model() == 'Desktop':
67 self.app = self.launch_test_application(67 self.app = self.launch_test_application(
68 "camera-app",68 "camera-app",
69 emulator_base=CameraCustomProxyObjectBase)69 emulator_base=CUSTOM_PROXY_OBJECT_BASE)
70 else:70 else:
71 self.app = self.launch_test_application(71 self.app = self.launch_test_application(
72 "camera-app",72 "camera-app",
@@ -74,12 +74,12 @@
74 "--desktop_file_hint="74 "--desktop_file_hint="
75 "/usr/share/applications/camera-app.desktop",75 "/usr/share/applications/camera-app.desktop",
76 app_type='qt',76 app_type='qt',
77 emulator_base=CameraCustomProxyObjectBase)77 emulator_base=CUSTOM_PROXY_OBJECT_BASE)
7878
79 def launch_click_installed(self):79 def launch_click_installed(self):
80 self.app = self.launch_click_package(80 self.app = self.launch_click_package(
81 "com.ubuntu.camera",81 "com.ubuntu.camera",
82 emulator_base=CameraCustomProxyObjectBase)82 emulator_base=CUSTOM_PROXY_OBJECT_BASE)
8383
84 def get_center(self, object_proxy):84 def get_center(self, object_proxy):
85 x, y, w, h = object_proxy.globalRect85 x, y, w, h = object_proxy.globalRect
8686
=== modified file 'tests/autopilot/camera_app/tests/test_capture.py'
--- tests/autopilot/camera_app/tests/test_capture.py 2015-03-10 14:22:52 +0000
+++ tests/autopilot/camera_app/tests/test_capture.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2012 Canonical2# Copyright 2012, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -8,7 +8,6 @@
8"""Tests for the Camera App"""8"""Tests for the Camera App"""
99
10from autopilot.matchers import Eventually10from autopilot.matchers import Eventually
11from autopilot.platform import model
12from testtools.matchers import Equals, NotEquals11from testtools.matchers import Equals, NotEquals
13from wand.image import Image12from wand.image import Image
14from MediaInfoDLL3 import MediaInfo, Stream13from MediaInfoDLL3 import MediaInfo, Stream
@@ -26,8 +25,10 @@
26 """ This is needed to wait for the application to start.25 """ This is needed to wait for the application to start.
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."""
28 def setUp(self):27 def setUp(self):
29 # Remove configuration file where knowledge of the photo roll hint's necessity is stored28 # Remove configuration file where knowledge of the photo roll hint's
30 config_file = os.path.expanduser("~/.config/com.ubuntu.camera/com.ubuntu.camera.conf")29 # necessity is stored
30 config_file = os.path.expanduser(
31 "~/.config/com.ubuntu.camera/com.ubuntu.camera.conf")
31 if os.path.exists(config_file):32 if os.path.exists(config_file):
32 os.remove(config_file)33 os.remove(config_file)
3334
@@ -82,8 +83,12 @@
82 # check that the camera is able to capture another photo83 # check that the camera is able to capture another photo
83 self.assertThat(exposure_button.enabled, Eventually(Equals(True)))84 self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
8485
85 """Tests clicking on the record control and checks if the recording time appears"""
86 def test_record_video(self):86 def test_record_video(self):
87 """Test clicking on the record control.
88
89 Check if the recording time appears.
90
91 """
87 # Get all the elements92 # Get all the elements
88 record_control = self.main_window.get_record_control()93 record_control = self.main_window.get_record_control()
89 stop_watch = self.main_window.get_stop_watch()94 stop_watch = self.main_window.get_stop_watch()
@@ -164,10 +169,10 @@
164 # Check that the photo roll hint is hidden169 # Check that the photo roll hint is hidden
165 self.assertEquals(hint.visible, False)170 self.assertEquals(hint.visible, False)
166171
167 """Test that the shoot button gets disabled for a while then re-enabled
168 after shooting"""
169 @unittest.skip("Disabled this test due race condition see bug 1227373")172 @unittest.skip("Disabled this test due race condition see bug 1227373")
170 def test_shoot_button_disable(self):173 def test_shoot_button_disable(self):
174 """Test that the shoot button gets disabled for a while then re-enabled
175 after shooting"""
171 exposure_button = self.main_window.get_exposure_button()176 exposure_button = self.main_window.get_exposure_button()
172177
173 # The focus ring should be invisible in the beginning178 # The focus ring should be invisible in the beginning
@@ -186,8 +191,7 @@
186 def test_picture_quality_setting(self):191 def test_picture_quality_setting(self):
187 qualities = [("Basic Quality", 60),192 qualities = [("Basic Quality", 60),
188 ("Normal Quality", 80),193 ("Normal Quality", 80),
189 ("Fine Quality", 95)194 ("Fine Quality", 95)]
190 ]
191 for quality, expectedCompression in qualities:195 for quality, expectedCompression in qualities:
192 self.delete_all_photos()196 self.delete_all_photos()
193 self.set_compression_quality(quality)197 self.set_compression_quality(quality)
@@ -244,12 +248,15 @@
244 bottom_edge = self.main_window.get_bottom_edge()248 bottom_edge = self.main_window.get_bottom_edge()
245 bottom_edge.open()249 bottom_edge.open()
246250
247 # open encoding quality option value selector showing the possible values251 # open encoding quality option value selector showing the possible
248 encoding_quality_button = self.main_window.get_encoding_quality_button()252 # values
253 encoding_quality_button = (
254 self.main_window.get_encoding_quality_button())
249 self.pointing_device.move_to_object(encoding_quality_button)255 self.pointing_device.move_to_object(encoding_quality_button)
250 self.pointing_device.click()256 self.pointing_device.click()
251 option_value_selector = self.main_window.get_option_value_selector()257 option_value_selector = self.main_window.get_option_value_selector()
252 self.assertThat(option_value_selector.visible, Eventually(Equals(True)))258 self.assertThat(
259 option_value_selector.visible, Eventually(Equals(True)))
253260
254 # tap on chosen compression quality option261 # tap on chosen compression quality option
255 option = self.main_window.get_option_value_button(quality)262 option = self.main_window.get_option_value_button(quality)
@@ -281,7 +288,8 @@
281 self.record_video(2)288 self.record_video(2)
282 video_file = self.get_first_video()289 video_file = self.get_first_video()
283 height = self.read_video_height(video_file)290 height = self.read_video_height(video_file)
284 expected_height = self.height_from_resolution_label(expected_resolution)291 expected_height = self.height_from_resolution_label(
292 expected_resolution)
285 self.assertThat(height, Equals(expected_height))293 self.assertThat(height, Equals(expected_height))
286294
287 def switch_cameras(self):295 def switch_cameras(self):
@@ -303,7 +311,8 @@
303 self.record_video(2)311 self.record_video(2)
304 video_file = self.get_first_video()312 video_file = self.get_first_video()
305 height = self.read_video_height(video_file)313 height = self.read_video_height(video_file)
306 expected_height = self.height_from_resolution_label(resolution_label)314 expected_height = self.height_from_resolution_label(
315 resolution_label)
307 self.assertThat(height, Equals(expected_height))316 self.assertThat(height, Equals(expected_height))
308 self.dismiss_first_photo_hint()317 self.dismiss_first_photo_hint()
309318
@@ -322,12 +331,15 @@
322 bottom_edge = self.main_window.get_bottom_edge()331 bottom_edge = self.main_window.get_bottom_edge()
323 bottom_edge.open()332 bottom_edge.open()
324333
325 # open video resolution option value selector showing the possible values334 # open video resolution option value selector showing the possible
326 video_resolution_button = self.main_window.get_video_resolution_button()335 # values
336 video_resolution_button = (
337 self.main_window.get_video_resolution_button())
327 self.pointing_device.move_to_object(video_resolution_button)338 self.pointing_device.move_to_object(video_resolution_button)
328 self.pointing_device.click()339 self.pointing_device.click()
329 option_value_selector = self.main_window.get_option_value_selector()340 option_value_selector = self.main_window.get_option_value_selector()
330 self.assertThat(option_value_selector.visible, Eventually(Equals(True)))341 self.assertThat(
342 option_value_selector.visible, Eventually(Equals(True)))
331 optionButtons = option_value_selector.select_many("OptionValueButton")343 optionButtons = option_value_selector.select_many("OptionValueButton")
332 resolutions = [button.label for button in optionButtons]344 resolutions = [button.label for button in optionButtons]
333345
@@ -344,12 +356,15 @@
344 bottom_edge = self.main_window.get_bottom_edge()356 bottom_edge = self.main_window.get_bottom_edge()
345 bottom_edge.open()357 bottom_edge.open()
346358
347 # open video resolution option value selector showing the possible values359 # open video resolution option value selector showing the possible
348 video_resolution_button = self.main_window.get_video_resolution_button()360 # values
361 video_resolution_button = (
362 self.main_window.get_video_resolution_button())
349 self.pointing_device.move_to_object(video_resolution_button)363 self.pointing_device.move_to_object(video_resolution_button)
350 self.pointing_device.click()364 self.pointing_device.click()
351 option_value_selector = self.main_window.get_option_value_selector()365 option_value_selector = self.main_window.get_option_value_selector()
352 self.assertThat(option_value_selector.visible, Eventually(Equals(True)))366 self.assertThat(
367 option_value_selector.visible, Eventually(Equals(True)))
353368
354 # tap on chosen video resolution option369 # tap on chosen video resolution option
355 option = self.main_window.get_option_value_button(resolution_label)370 option = self.main_window.get_option_value_button(resolution_label)
356371
=== modified file 'tests/autopilot/camera_app/tests/test_diskspace.py'
--- tests/autopilot/camera_app/tests/test_diskspace.py 2015-01-24 22:26:48 +0000
+++ tests/autopilot/camera_app/tests/test_diskspace.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2012 Canonical2# Copyright 2012, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -12,7 +12,6 @@
1212
13from camera_app.tests import CameraAppTestCase13from camera_app.tests import CameraAppTestCase
1414
15import unittest
16import os.path15import os.path
17import os16import os
18from ctypes import CDLL, c_longlong as ll17from ctypes import CDLL, c_longlong as ll
@@ -21,13 +20,12 @@
21LOW_THRESHOLD = 200 * MEGABYTE20LOW_THRESHOLD = 200 * MEGABYTE
22CRITICAL_THRESHOLD = 50 * MEGABYTE21CRITICAL_THRESHOLD = 50 * MEGABYTE
2322
23
24class TestCameraDiskSpace(CameraAppTestCase):24class TestCameraDiskSpace(CameraAppTestCase):
25 """Tests low disk space situations"""25 """Tests low disk space situations"""
2626
27 def diskSpaceAvailable(self):27 def diskSpaceAvailable(self):
28 """Check the amount of free disk space"""28 """Check the amount of free disk space"""
29
30
31 stats = os.statvfs(os.path.expanduser(self.videoPath))29 stats = os.statvfs(os.path.expanduser(self.videoPath))
32 return stats.f_bavail * stats.f_frsize30 return stats.f_bavail * stats.f_frsize
3331
@@ -36,9 +34,11 @@
3634
37 # Take into account the currently existing filler file, if any, as we35 # Take into account the currently existing filler file, if any, as we
38 # will be overwriting it to the new size.36 # will be overwriting it to the new size.
39 fillerSize = (self.diskSpaceAvailable() + self.currentFillerSize) - size37 fillerSize = (
38 self.diskSpaceAvailable() + self.currentFillerSize) - size
40 fd = open(self.diskFiller, "w")39 fd = open(self.diskFiller, "w")
41 ret = CDLL("libc.so.6").posix_fallocate64(fd.fileno(), ll(0), ll(fillerSize))40 ret = CDLL("libc.so.6").posix_fallocate64(
41 fd.fileno(), ll(0), ll(fillerSize))
42 self.assertThat(ret, Equals(0))42 self.assertThat(ret, Equals(0))
43 self.currentFillerSize = fillerSize43 self.currentFillerSize = fillerSize
4444
@@ -53,11 +53,12 @@
53 self.diskFiller = os.path.join(self.videoPath, "filler")53 self.diskFiller = os.path.join(self.videoPath, "filler")
54 self.currentFillerSize = 054 self.currentFillerSize = 0
5555
56 # remove the filler file before starting, in case a previous test crashed56 # remove the filler file before starting, in case a previous test
57 # crashed
57 os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None58 os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None
5859
59 # we can't start tests when the disk space is already below the threshold60 # we can't start tests when the disk space is already below the
60 # as they all expect a normal situation at the start61 # threshold as they all expect a normal situation at the start
61 self.assertThat(self.diskSpaceAvailable(), GreaterThan(LOW_THRESHOLD))62 self.assertThat(self.diskSpaceAvailable(), GreaterThan(LOW_THRESHOLD))
6263
63 self.assertThat(64 self.assertThat(
@@ -68,7 +69,8 @@
68 os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None69 os.remove(self.diskFiller) if os.path.exists(self.diskFiller) else None
6970
70 def test_critically_low_disk(self):71 def test_critically_low_disk(self):
71 """Verify proper behavior when disk space becomes critically low and back"""72 """Verify proper behavior when disk space becomes critically low and
73 back"""
7274
73 exposure_button = self.main_window.get_exposure_button()75 exposure_button = self.main_window.get_exposure_button()
74 no_space_hint = self.main_window.get_no_space_hint()76 no_space_hint = self.main_window.get_no_space_hint()
@@ -77,22 +79,23 @@
77 self.assertThat(no_space_hint.visible, Equals(False))79 self.assertThat(no_space_hint.visible, Equals(False))
7880
79 self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE)81 self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE)
80 self.assertThat(self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))82 self.assertThat(
83 self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))
8184
82 self.assertThat(exposure_button.enabled, Eventually(Equals(False)))85 self.assertThat(exposure_button.enabled, Eventually(Equals(False)))
83 self.assertThat(no_space_hint.visible, Eventually(Equals(True)))86 self.assertThat(no_space_hint.visible, Eventually(Equals(True)))
8487
85 self.setFreeSpaceTo(CRITICAL_THRESHOLD + MEGABYTE)88 self.setFreeSpaceTo(CRITICAL_THRESHOLD + MEGABYTE)
86 self.assertThat(self.diskSpaceAvailable(), GreaterThan(CRITICAL_THRESHOLD))89 self.assertThat(
90 self.diskSpaceAvailable(), GreaterThan(CRITICAL_THRESHOLD))
8791
88 self.assertThat(exposure_button.enabled, Equals(True))92 self.assertThat(exposure_button.enabled, Equals(True))
89 self.assertThat(no_space_hint.visible, Equals(False))93 self.assertThat(no_space_hint.visible, Equals(False))
9094
91 def test_low_disk(self):95 def test_low_disk(self):
92 """Verify proper behavior when disk space becomes low"""96 """Verify proper behavior when disk space becomes low"""
9397 self.main_window.get_exposure_button()
94 exposure_button = self.main_window.get_exposure_button()98 self.main_window.get_no_space_hint()
95 no_space_hint = self.main_window.get_no_space_hint()
96 dialog = self.main_window.get_low_space_dialog()99 dialog = self.main_window.get_low_space_dialog()
97 self.assertThat(dialog, Equals(None))100 self.assertThat(dialog, Equals(None))
98101
@@ -109,7 +112,8 @@
109 stop_watch = self.main_window.get_stop_watch()112 stop_watch = self.main_window.get_stop_watch()
110 exposure_button = self.main_window.get_exposure_button()113 exposure_button = self.main_window.get_exposure_button()
111114
112 # Click the record button to toggle photo/video mode then start recording115 # Click the record button to toggle photo/video mode then start
116 # recording
113 self.pointing_device.move_to_object(record_control)117 self.pointing_device.move_to_object(record_control)
114 self.pointing_device.click()118 self.pointing_device.click()
115 self.pointing_device.move_to_object(exposure_button)119 self.pointing_device.move_to_object(exposure_button)
@@ -121,5 +125,6 @@
121125
122 # Now reduce the space to critically low, then see if recording stops126 # Now reduce the space to critically low, then see if recording stops
123 self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE)127 self.setFreeSpaceTo(CRITICAL_THRESHOLD - MEGABYTE)
124 self.assertThat(self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))128 self.assertThat(
129 self.diskSpaceAvailable(), LessThan(CRITICAL_THRESHOLD))
125 self.assertThat(stop_watch.opacity, Eventually(Equals(0.0)))130 self.assertThat(stop_watch.opacity, Eventually(Equals(0.0)))
126131
=== modified file 'tests/autopilot/camera_app/tests/test_flash.py'
--- tests/autopilot/camera_app/tests/test_flash.py 2015-02-17 18:04:01 +0000
+++ tests/autopilot/camera_app/tests/test_flash.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2012 Canonical2# Copyright 2012, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -7,13 +7,11 @@
77
8"""Tests for the Camera App flash"""8"""Tests for the Camera App flash"""
99
10from testtools.matchers import Equals, NotEquals10from testtools.matchers import Equals
11from autopilot.matchers import Eventually11from autopilot.matchers import Eventually
1212
13from camera_app.tests import CameraAppTestCase13from camera_app.tests import CameraAppTestCase
1414
15import unittest
16
1715
18class TestCameraFlash(CameraAppTestCase):16class TestCameraFlash(CameraAppTestCase):
19 """Tests the flash"""17 """Tests the flash"""
@@ -104,7 +102,8 @@
104 # open option value selector showing the possible values102 # open option value selector showing the possible values
105 self.pointing_device.move_to_object(flash_button)103 self.pointing_device.move_to_object(flash_button)
106 self.pointing_device.click()104 self.pointing_device.click()
107 self.assertThat(option_value_selector.visible, Eventually(Equals(True)))105 self.assertThat(
106 option_value_selector.visible, Eventually(Equals(True)))
108107
109 # set flash to "on"108 # set flash to "on"
110 option = self.main_window.get_option_value_button("On")109 option = self.main_window.get_option_value_button("On")
@@ -115,9 +114,11 @@
115 # closes the flash options menu and open the hdr options menu114 # closes the flash options menu and open the hdr options menu
116 self.pointing_device.move_to_object(hdr_button)115 self.pointing_device.move_to_object(hdr_button)
117 self.pointing_device.click()116 self.pointing_device.click()
118 self.assertThat(option_value_selector.visible, Eventually(Equals(False)))117 self.assertThat(
118 option_value_selector.visible, Eventually(Equals(False)))
119 self.pointing_device.click()119 self.pointing_device.click()
120 self.assertThat(option_value_selector.visible, Eventually(Equals(True)))120 self.assertThat(
121 option_value_selector.visible, Eventually(Equals(True)))
121122
122 # set hdr to "on" and verify that flash is "off"123 # set hdr to "on" and verify that flash is "off"
123 option = self.main_window.get_option_value_button("On")124 option = self.main_window.get_option_value_button("On")
@@ -129,9 +130,11 @@
129 # closes the hdr options menu and open the flash options menu130 # closes the hdr options menu and open the flash options menu
130 self.pointing_device.move_to_object(flash_button)131 self.pointing_device.move_to_object(flash_button)
131 self.pointing_device.click()132 self.pointing_device.click()
132 self.assertThat(option_value_selector.visible, Eventually(Equals(False)))133 self.assertThat(
134 option_value_selector.visible, Eventually(Equals(False)))
133 self.pointing_device.click()135 self.pointing_device.click()
134 self.assertThat(option_value_selector.visible, Eventually(Equals(True)))136 self.assertThat(
137 option_value_selector.visible, Eventually(Equals(True)))
135138
136 # set flash to "on" and verify that hdr is "off"139 # set flash to "on" and verify that hdr is "off"
137 option = self.main_window.get_option_value_button("On")140 option = self.main_window.get_option_value_button("On")
138141
=== modified file 'tests/autopilot/camera_app/tests/test_focus.py'
--- tests/autopilot/camera_app/tests/test_focus.py 2014-06-30 07:57:09 +0000
+++ tests/autopilot/camera_app/tests/test_focus.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2012 Canonical2# Copyright 2012, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -45,7 +45,7 @@
4545
46 # The focus ring sould be visible and centered to the mouse click46 # The focus ring sould be visible and centered to the mouse click
47 # coords now47 # coords now
48 focus_ring_center = self.get_center(focus_ring)48 # focus_ring_center = self.get_center(focus_ring)
49 self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5)))49 self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5)))
50# self.assertEquals(focus_ring_center, click_coords)50# self.assertEquals(focus_ring_center, click_coords)
5151
@@ -65,7 +65,7 @@
6565
66 # The focus ring sould be visible and centered to the mouse66 # The focus ring sould be visible and centered to the mouse
67 # click coords now67 # click coords now
68 focus_ring_center = self.get_center(focus_ring)68 # focus_ring_center = self.get_center(focus_ring)
69 self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5)))69 self.assertThat(focus_ring.opacity, Eventually(GreaterThan(0.5)))
70# self.assertEquals(focus_ring_center, click_coords)70# self.assertEquals(focus_ring_center, click_coords)
7171
7272
=== modified file 'tests/autopilot/camera_app/tests/test_gallery_view.py'
--- tests/autopilot/camera_app/tests/test_gallery_view.py 2015-03-10 16:33:24 +0000
+++ tests/autopilot/camera_app/tests/test_gallery_view.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2014 Canonical2# Copyright 2014, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -7,15 +7,14 @@
77
8"""Tests for the Camera App zoom"""8"""Tests for the Camera App zoom"""
99
10from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan10from testtools.matchers import Equals
11from autopilot.matchers import Eventually11from autopilot.matchers import Eventually
1212
13from camera_app.tests import CameraAppTestCase13from camera_app.tests import CameraAppTestCase
1414
15import unittest
16import os
17from time import sleep15from time import sleep
1816
17
19class TestCameraGalleryViewMixin(object):18class TestCameraGalleryViewMixin(object):
20 def move_from_slideshow_to_photogrid(self):19 def move_from_slideshow_to_photogrid(self):
21 gallery = self.main_window.get_gallery()20 gallery = self.main_window.get_gallery()
@@ -47,6 +46,7 @@
47 sleep(1)46 sleep(1)
48 self.pointing_device.release()47 self.pointing_device.release()
4948
49
50class TestCameraGalleryView(CameraAppTestCase, TestCameraGalleryViewMixin):50class TestCameraGalleryView(CameraAppTestCase, TestCameraGalleryViewMixin):
51 """Tests the camera gallery view without media already present"""51 """Tests the camera gallery view without media already present"""
5252
@@ -104,7 +104,9 @@
104104
105 self.assertThat(hint.visible, Eventually(Equals(False)))105 self.assertThat(hint.visible, Eventually(Equals(False)))
106106
107class TestCameraGalleryViewWithVideo(TestCameraGalleryViewMixin, CameraAppTestCase):107
108class TestCameraGalleryViewWithVideo(
109 TestCameraGalleryViewMixin, CameraAppTestCase):
108 """Tests the camera gallery view with video already present"""110 """Tests the camera gallery view with video already present"""
109111
110 def setUp(self):112 def setUp(self):
@@ -131,7 +133,9 @@
131 spinner = gallery.wait_select_single("ActivityIndicator")133 spinner = gallery.wait_select_single("ActivityIndicator")
132 self.assertThat(spinner.running, Eventually(Equals(False)))134 self.assertThat(spinner.running, Eventually(Equals(False)))
133135
134class TestCameraGalleryViewWithPhoto(TestCameraGalleryViewMixin, CameraAppTestCase):136
137class TestCameraGalleryViewWithPhoto(
138 TestCameraGalleryViewMixin, CameraAppTestCase):
135 """Tests the camera gallery view with photo already present"""139 """Tests the camera gallery view with photo already present"""
136140
137 def setUp(self):141 def setUp(self):
138142
=== modified file 'tests/autopilot/camera_app/tests/test_options.py'
--- tests/autopilot/camera_app/tests/test_options.py 2014-12-08 12:04:21 +0000
+++ tests/autopilot/camera_app/tests/test_options.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2014 Canonical2# Copyright 2014, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -12,6 +12,7 @@
1212
13from camera_app.tests import CameraAppTestCase13from camera_app.tests import CameraAppTestCase
1414
15
15class TestCameraOptions(CameraAppTestCase):16class TestCameraOptions(CameraAppTestCase):
16 """Tests the options overlay"""17 """Tests the options overlay"""
1718
@@ -43,7 +44,8 @@
4344
44 """Test toggling on/off grid lines option"""45 """Test toggling on/off grid lines option"""
45 def test_toggle_grid_lines(self):46 def test_toggle_grid_lines(self):
46 gridlines = self.app.wait_select_single("QQuickItem", objectName="gridlines")47 gridlines = self.app.wait_select_single(
48 "QQuickItem", objectName="gridlines")
47 self.set_grid_lines_value("On")49 self.set_grid_lines_value("On")
48 self.assertEquals(gridlines.visible, True)50 self.assertEquals(gridlines.visible, True)
49 self.set_grid_lines_value("Off")51 self.set_grid_lines_value("Off")
@@ -59,7 +61,8 @@
59 self.pointing_device.move_to_object(grid_lines_button)61 self.pointing_device.move_to_object(grid_lines_button)
60 self.pointing_device.click()62 self.pointing_device.click()
61 option_value_selector = self.main_window.get_option_value_selector()63 option_value_selector = self.main_window.get_option_value_selector()
62 self.assertThat(option_value_selector.visible, Eventually(Equals(True)))64 self.assertThat(
65 option_value_selector.visible, Eventually(Equals(True)))
6366
64 # tap on chosen value67 # tap on chosen value
65 option = self.main_window.get_option_value_button(value)68 option = self.main_window.get_option_value_button(value)
6669
=== modified file 'tests/autopilot/camera_app/tests/test_photo_editor.py'
--- tests/autopilot/camera_app/tests/test_photo_editor.py 2015-03-11 09:25:36 +0000
+++ tests/autopilot/camera_app/tests/test_photo_editor.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2014 Canonical2# Copyright 2014, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -7,16 +7,12 @@
77
8"""Tests for the Camera photo editor"""8"""Tests for the Camera photo editor"""
99
10from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan10from testtools.matchers import Equals
11from autopilot.matchers import Eventually11from autopilot.matchers import Eventually
12from autopilot.exceptions import StateNotFoundError12from autopilot.exceptions import StateNotFoundError
1313
14from camera_app.tests import CameraAppTestCase14from camera_app.tests import CameraAppTestCase
1515
16import unittest
17import os
18from time import sleep
19
2016
21class TestCameraPhotoEditorWithPhoto(CameraAppTestCase):17class TestCameraPhotoEditorWithPhoto(CameraAppTestCase):
22 """Tests photo editor when a photo is present"""18 """Tests photo editor when a photo is present"""
@@ -35,7 +31,7 @@
35 """Tests editor opening and closing correctly for pictures"""31 """Tests editor opening and closing correctly for pictures"""
36 def test_editor_appears(self):32 def test_editor_appears(self):
3733
38 viewfinder = self.main_window.get_viewfinder()34 self.main_window.get_viewfinder()
39 gallery = self.main_window.get_gallery()35 gallery = self.main_window.get_gallery()
4036
41 self.main_window.swipe_to_gallery(self)37 self.main_window.swipe_to_gallery(self)
@@ -48,8 +44,9 @@
48 self.pointing_device.click()44 self.pointing_device.click()
4945
50 # If the editor button is not there when in the gallery view, then46 # If the editor button is not there when in the gallery view, then
51 # we are not on a system that has the UI extras package installed or has47 # we are not on a system that has the UI extras package installed or
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
49 # case.
53 try:50 try:
54 edit = gallery.wait_select_single(objectName="actionButtonEdit")51 edit = gallery.wait_select_single(objectName="actionButtonEdit")
55 except:52 except:
@@ -81,6 +78,7 @@
81 disappeared = True78 disappeared = True
82 self.assertThat(disappeared, Equals(True))79 self.assertThat(disappeared, Equals(True))
8380
81
84class TestCameraPhotoEditorWithVideo(CameraAppTestCase):82class TestCameraPhotoEditorWithVideo(CameraAppTestCase):
85 """Tests photo editor when a video is present"""83 """Tests photo editor when a video is present"""
8684
@@ -99,7 +97,7 @@
99 def test_editor_not_on_videos(self):97 def test_editor_not_on_videos(self):
100 self.add_sample_video()98 self.add_sample_video()
10199
102 viewfinder = self.main_window.get_viewfinder()100 self.main_window.get_viewfinder()
103 gallery = self.main_window.get_gallery()101 gallery = self.main_window.get_gallery()
104102
105 self.main_window.swipe_to_gallery(self)103 self.main_window.swipe_to_gallery(self)
@@ -112,8 +110,9 @@
112 self.pointing_device.click()110 self.pointing_device.click()
113111
114 # If the editor button is not there when in the gallery view, then112 # If the editor button is not there when in the gallery view, then
115 # we are not on a system that has the UI extras package installed or has113 # we are not on a system that has the UI extras package installed or
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
115 # case.
117 try:116 try:
118 edit = gallery.wait_select_single(objectName="actionButtonEdit")117 edit = gallery.wait_select_single(objectName="actionButtonEdit")
119 except:118 except:
120119
=== modified file 'tests/autopilot/camera_app/tests/test_zoom.py'
--- tests/autopilot/camera_app/tests/test_zoom.py 2014-09-08 14:12:42 +0000
+++ tests/autopilot/camera_app/tests/test_zoom.py 2015-04-29 17:40:44 +0000
@@ -1,5 +1,5 @@
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 -*-
2# Copyright 2014 Canonical2# Copyright 2014, 2015 Canonical
3#3#
4# This program is free software: you can redistribute it and/or modify it4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published5# under the terms of the GNU General Public License version 3, as published
@@ -7,7 +7,7 @@
77
8"""Tests for the Camera App zoom"""8"""Tests for the Camera App zoom"""
99
10from testtools.matchers import Equals, NotEquals, GreaterThan, LessThan10from testtools.matchers import Equals
11from autopilot.matchers import Eventually11from autopilot.matchers import Eventually
12from autopilot.gestures import pinch12from autopilot.gestures import pinch
1313

Subscribers

People subscribed via source and target branches