Merge lp:~javier.collado/mediaplayer-app/test-static-analysis into lp:mediaplayer-app

Proposed by Javier Collado
Status: Approved
Approved by: Renato Araujo Oliveira Filho
Approved revision: 112
Proposed branch: lp:~javier.collado/mediaplayer-app/test-static-analysis
Merge into: lp:mediaplayer-app
Diff against target: 271 lines (+61/-58)
3 files modified
tests/autopilot/mediaplayer_app/tests/__init__.py (+2/-2)
tests/autopilot/mediaplayer_app/tests/test_player.py (+6/-11)
tests/autopilot/mediaplayer_app/tests/test_player_with_video.py (+53/-45)
To merge this branch: bzr merge lp:~javier.collado/mediaplayer-app/test-static-analysis
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+170863@code.launchpad.net

Commit message

Fixed static analysis problems in autopilot test cases source code.

Description of the change

This branch fixes some static analysis problems found in the autopilot test
cases source code.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

looks good.

review: Approve
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator? YES

Did CI run pass? YES

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut? YES

review: Approve

Unmerged revisions

112. By Javier Collado

Fixed type (buttom -> button)

111. By Javier Collado

Fixed strings

Moved docstrings to the right location and marked comments as such

110. By Javier Collado

Fixed long lines

109. By Javier Collado

Removed unused imports

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/mediaplayer_app/tests/__init__.py'
2--- tests/autopilot/mediaplayer_app/tests/__init__.py 2013-05-27 11:23:52 +0000
3+++ tests/autopilot/mediaplayer_app/tests/__init__.py 2013-06-21 15:56:31 +0000
4@@ -7,7 +7,6 @@
5
6 """mediaplayer-app autopilot tests."""
7
8-from os import remove
9 import os.path
10 import os
11
12@@ -68,7 +67,8 @@
13 "mediaplayer-app",
14 "file:///usr/share/mediaplayer-app/videos/" + movie_file,
15 "--fullscreen",
16- "--desktop_file_hint=/usr/share/applications/mediaplayer-app.desktop",
17+ ("--desktop_file_hint="
18+ "/usr/share/applications/mediaplayer-app.desktop"),
19 app_type='qt')
20
21 @property
22
23=== modified file 'tests/autopilot/mediaplayer_app/tests/test_player.py'
24--- tests/autopilot/mediaplayer_app/tests/test_player.py 2013-05-27 11:23:52 +0000
25+++ tests/autopilot/mediaplayer_app/tests/test_player.py 2013-06-21 15:56:31 +0000
26@@ -14,39 +14,34 @@
27
28 from mediaplayer_app.tests import MediaplayerAppTestCase
29
30-import unittest
31-import time
32-import os
33-from os import path
34-
35
36 class TestPlayer(MediaplayerAppTestCase):
37 """Tests the main media player features"""
38
39- """ This is needed to wait for the application to start.
40- In the testfarm, the application may take some time to show up."""
41 def setUp(self):
42 super(TestPlayer, self).setUp()
43 self.launch_app()
44+ # This is needed to wait for the application to start.
45+ # In the testfarm, the application may take some time to show up.
46 self.assertThat(
47 self.main_window.get_qml_view().visible, Eventually(Equals(True)))
48
49 def tearDown(self):
50 super(TestPlayer, self).tearDown()
51
52- """ Test if the toolbar appears with mouse click over the video area """
53 def test_controls_visibility(self):
54+ """Test if the toolbar appears with mouse click over the video area."""
55 controls = self.main_window.get_object("Controls", "controls")
56
57- """ The toolbar is invisible by default """
58+ # The toolbar is invisible by default
59 self.assertProperty(controls, visible=False)
60
61- """ Toolbar must apper when clicked in the video area """
62+ # Toolbar must apper when clicked in the video area
63 video_area = self.main_window.get_object("VideoPlayer", "player")
64 self.pointing_device.move_to_object(video_area)
65 self.pointing_device.click()
66 self.assertProperty(controls, visible=True)
67
68- """ Toolbar must disappear when clicked in the video area again """
69+ # Toolbar must disappear when clicked in the video area again
70 self.pointing_device.click()
71 self.assertProperty(controls, visible=True)
72
73=== modified file 'tests/autopilot/mediaplayer_app/tests/test_player_with_video.py'
74--- tests/autopilot/mediaplayer_app/tests/test_player_with_video.py 2013-06-07 13:51:58 +0000
75+++ tests/autopilot/mediaplayer_app/tests/test_player_with_video.py 2013-06-21 15:56:31 +0000
76@@ -22,11 +22,11 @@
77 class TestPlayerWithVideo(MediaplayerAppTestCase):
78 """Tests the main media player features while playing a video """
79
80- """ This is needed to wait for the application to start.
81- In the testfarm, the application may take some time to show up."""
82 def setUp(self):
83 super(TestPlayerWithVideo, self).setUp()
84 self.launch_app("small.mp4")
85+ # This is needed to wait for the application to start.
86+ # In the testfarm, the application may take some time to show up.
87 self.assertThat(
88 self.main_window.get_qml_view().visible, Eventually(Equals(True)))
89
90@@ -41,88 +41,97 @@
91 self.assertThat(toolbar.ready, Eventually(Equals(True)))
92
93 def pause_video(self):
94- playback_buttom = self.main_window.get_object("IconButton", "Controls.PlayBackButton")
95- self.pointing_device.move_to_object(playback_buttom)
96+ playback_button = self.main_window.get_object(
97+ "IconButton", "Controls.PlayBackButton")
98+ self.pointing_device.move_to_object(playback_button)
99 self.pointing_device.click()
100
101- def test_playback_buttom_states(self):
102+ def test_playback_button_states(self):
103 self.show_controls()
104
105- playback_buttom = self.main_window.get_object("IconButton", "Controls.PlayBackButton")
106+ playback_button = self.main_window.get_object(
107+ "IconButton", "Controls.PlayBackButton")
108 player = self.main_window.get_object("VideoPlayer", "player")
109
110- """ Default state after load the video is playing and with pause
111- icon.
112- """
113+ # Default state after load the video is playing and with pause icon.
114 self.assertProperty(player, playing=True, paused=False)
115- self.assertProperty(playback_buttom, icon="pause")
116+ self.assertProperty(playback_button, icon="pause")
117
118- self.pointing_device.move_to_object(playback_buttom)
119+ self.pointing_device.move_to_object(playback_button)
120 self.pointing_device.click()
121
122- """ First click must pause the video, change playing state and show
123- play icon. """
124+ # First click must pause the video, change playing state
125+ # and show play icon.
126 self.assertProperty(player, playing=False, paused=True)
127- self.assertProperty(playback_buttom, icon="play")
128+ self.assertProperty(playback_button, icon="play")
129
130 self.pointing_device.click()
131
132- """ Second click should change the state to playing again """
133+ # Second click should change the state to playing again
134 self.assertProperty(player, playing=True, paused=False)
135- self.assertProperty(playback_buttom, icon="pause")
136+ self.assertProperty(playback_button, icon="pause")
137
138- @skipIf(model() == 'Nexus 4' or model() == 'Galaxy Nexus', 'Screen width not enough for seekbar')
139+ @skipIf(model() == 'Nexus 4' or model() == 'Galaxy Nexus',
140+ 'Screen width not enough for seekbar')
141 def test_scene_selector_visibility(self):
142 self.show_controls()
143 self.pause_video()
144
145- scene_selector = self.main_window.get_object("SceneSelector", "Controls.SceneSelector")
146+ scene_selector = self.main_window.get_object(
147+ "SceneSelector", "Controls.SceneSelector")
148 slider = self.main_window.get_object("Slider", "TimeLine.Slider")
149
150- """ Default state is hide """
151+ # Default state is hide
152 self.assertProperty(scene_selector, visible=False)
153
154- """ Scene selector must apper when clicking int the slider handler """
155+ # Scene selector must apper when clicking int the slider handler
156 self.pointing_device.move_to_object(slider)
157 self.pointing_device.click()
158 self.assertProperty(scene_selector, visible=True)
159
160- """ click again must dismiss the scene selector """
161+ # click again must dismiss the scene selector
162 self.pointing_device.click()
163 self.assertProperty(scene_selector, visible=False)
164
165- @skip("fails on touch and is not reliable on different screen resolutions. bug 1183245")
166+ @skip("fails on touch and is not reliable on different screen resolutions."
167+ " bug 1183245")
168 def test_scene_selector_operation(self):
169 self.show_controls()
170 self.pause_video()
171
172 slider = self.main_window.get_object("Slider", "TimeLine.Slider")
173 time_line = self.main_window.get_object("TimeLine", "TimeLine")
174- selector = self.main_window.get_object("SceneSelector", "Controls.SceneSelector")
175+ selector = self.main_window.get_object(
176+ "SceneSelector", "Controls.SceneSelector")
177 self.assertThat(selector.count, Eventually(GreaterThan(3)))
178
179- """ Show scene selector """
180+ # Show scene selector
181 self.pointing_device.move_to_object(slider)
182 self.pointing_device.click()
183
184- """ Make sure that the scenes are in correct place """
185- scene_0 = self.main_window.get_object("SceneFrame", "SceneSelector.Scene0")
186+ # Make sure that the scenes are in correct place
187+ scene_0 = self.main_window.get_object(
188+ "SceneFrame", "SceneSelector.Scene0")
189 selectorRect = selector.globalRect
190 self.pointing_device.drag(
191- selectorRect[0], selectorRect[1] + selectorRect[3] / 2,
192- selectorRect[0] + selectorRect[2], selectorRect[1] + selectorRect[3] / 2)
193+ selectorRect[0],
194+ selectorRect[1] + selectorRect[3] / 2,
195+ selectorRect[0] + selectorRect[2],
196+ selectorRect[1] + selectorRect[3] / 2)
197 self.assertThat(selector.moving, Eventually(Equals(False)))
198 self.assertThat(scene_0.x, Eventually(Equals(0)))
199
200- """ Click in the second scene """
201- scene_2 = self.main_window.get_object("SceneFrame", "SceneSelector.Scene2")
202+ # Click in the second scene
203+ scene_2 = self.main_window.get_object(
204+ "SceneFrame", "SceneSelector.Scene2")
205 self.assertThat(scene_2.ready, Eventually(Equals(True)))
206 self.pointing_device.move_to_object(scene_2)
207 self.pointing_device.click()
208 self.assertThat(selector.currentIndex, Eventually(Equals(2)))
209 self.assertProperty(time_line, value=1.107)
210
211- @skipIf(model() == 'Nexus 4' or model() == 'Galaxy Nexus', 'Screen width not enough for seekbar')
212+ @skipIf(model() == 'Nexus 4' or model() == 'Galaxy Nexus',
213+ 'Screen width not enough for seekbar')
214 def test_time_display_behavior(self):
215 self.show_controls()
216 self.pause_video()
217@@ -130,41 +139,40 @@
218 time_line = self.main_window.get_object("Slider", "TimeLine.Slider")
219 time_label = self.main_window.get_object("Label", "TimeLine.TimeLabel")
220
221- """ Seek to the midle of the movie """
222+ # Seek to the midle of the movie
223 self.pointing_device.move_to_object(time_line)
224 self.pointing_device.click()
225
226- """ Time label must show the current video time
227- - Depends on the resolution the current time can be different due
228- the slider size, because of that we avoid compare the secs
229- """
230+ # Time label must show the current video time
231+ # - Depends on the resolution the current time can be different due
232+ # the slider size, because of that we avoid compare the secs
233 self.assertEqual(time_label.text[0:7], "00:00:0")
234
235- """ Click in the label to change the state """
236+ # Click in the label to change the state
237 self.pointing_device.move_to_object(time_label)
238 self.pointing_device.click()
239
240- """ After the click the label must show the remaning time
241- - Depends on the resolution the current time can be different due
242- the slider size, because of that we avoid compare the secs
243- """
244+ # After the click the label must show the remaning time
245+ # - Depends on the resolution the current time can be different due
246+ # the slider size, because of that we avoid compare the secs
247 self.assertEqual(time_label.text[0:9], "- 00:00:0")
248
249- @skipIf(model() == 'Nexus 4' or model() == 'Galaxy Nexus', 'Screen width not enough for seekbar')
250+ @skipIf(model() == 'Nexus 4' or model() == 'Galaxy Nexus',
251+ 'Screen width not enough for seekbar')
252 def test_show_controls_at_end(self):
253 self.show_controls()
254 time_line = self.main_window.get_object("Slider", "TimeLine.Slider")
255
256- """ Seek to the midle of the video """
257+ # Seek to the midle of the video
258 self.pointing_device.move_to_object(time_line)
259 self.pointing_device.click()
260
261- """ hide controls """
262+ # hide controls
263 video_area = self.main_window.get_object("VideoPlayer", "player")
264 self.pointing_device.move_to_object(video_area)
265 self.pointing_device.click()
266
267- """ wait for video ends and control appears"""
268+ # wait for video ends and control appears
269 controls = self.main_window.get_object("Controls", "controls")
270 self.assertProperty(controls, visible=False)
271 self.assertThat(controls.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches