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