Merge lp:~om26er/mediaplayer-app/port_autopilot_1.3 into lp:mediaplayer-app

Proposed by Omer Akram
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 81
Merged at revision: 81
Proposed branch: lp:~om26er/mediaplayer-app/port_autopilot_1.3
Merge into: lp:mediaplayer-app
Diff against target: 219 lines (+46/-39)
3 files modified
tests/autopilot/mediaplayer_app/tests/__init__.py (+19/-12)
tests/autopilot/mediaplayer_app/tests/test_player.py (+4/-4)
tests/autopilot/mediaplayer_app/tests/test_player_with_video.py (+23/-23)
To merge this branch: bzr merge lp:~om26er/mediaplayer-app/port_autopilot_1.3
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+161885@code.launchpad.net

Commit message

port the mediaplayer-app autopilot tests to 1.3

Description of the change

port the mediaplayer-app autopilot tests to 1.3

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

+1

review: Approve

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-03-04 14:17:19 +0000
3+++ tests/autopilot/mediaplayer_app/tests/__init__.py 2013-05-09 13:52:24 +0000
4@@ -11,16 +11,25 @@
5 import os.path
6 import os
7
8-from autopilot.introspection.qt import QtIntrospectionTestMixin
9+from autopilot.input import Mouse, Touch, Pointer
10+from autopilot.platform import model
11 from autopilot.testcase import AutopilotTestCase
12
13 from mediaplayer_app.emulators.main_window import MainWindow
14
15-class MediaplayerAppTestCase(AutopilotTestCase, QtIntrospectionTestMixin):
16+class MediaplayerAppTestCase(AutopilotTestCase):
17
18 """A common test case class that provides several useful methods for mediaplayer-app tests."""
19
20+ if model() == 'Desktop':
21+ scenarios = [
22+ ('with mouse', dict(input_device_class=Mouse)), ]
23+ else:
24+ scenarios = [
25+ ('with touch', dict(input_device_class=Touch)), ]
26+
27 def setUp(self):
28+ self.pointing_device = Pointer(self.input_device_class.create())
29 super(MediaplayerAppTestCase, self).setUp()
30
31 def launch_app(self, movie_file=None):
32@@ -43,20 +52,18 @@
33 self.app = None
34
35 def launch_test_installed(self, movie_file):
36- if self.running_on_device():
37- self.app = self.launch_test_application(
38- "media-player",
39- "--fullscreen ",
40- movie_file)
41- else:
42+ if model() == 'Desktop':
43 self.app = self.launch_test_application(
44 "media-player",
45 "-w",
46 "/usr/share/media-player/videos/" + movie_file)
47-
48- @staticmethod
49- def running_on_device():
50- return os.path.isfile('/system/usr/idc/autopilot-finger.idc')
51+ else:
52+ self.app = self.launch_test_application(
53+ "media-player",
54+ "--fullscreen ",
55+ movie_file,
56+ "--desktop_file_hint=/usr/share/applications/mediaplayer-app.desktop",
57+ app_type='qt')
58
59 @property
60 def main_window(self):
61
62=== modified file 'tests/autopilot/mediaplayer_app/tests/test_player.py'
63--- tests/autopilot/mediaplayer_app/tests/test_player.py 2013-03-05 20:22:15 +0000
64+++ tests/autopilot/mediaplayer_app/tests/test_player.py 2013-05-09 13:52:24 +0000
65@@ -9,8 +9,8 @@
66
67 from __future__ import absolute_import
68
69-from testtools.matchers import Equals, NotEquals, GreaterThan
70 from autopilot.matchers import Eventually
71+from testtools.matchers import Equals
72
73 from mediaplayer_app.tests import MediaplayerAppTestCase
74
75@@ -41,11 +41,11 @@
76
77 """ Toolbar must apper when clicked in the video area """
78 video_area = self.main_window.get_object("VideoPlayer", "player")
79- self.mouse.move_to_object(video_area)
80- self.mouse.click()
81+ self.pointing_device.move_to_object(video_area)
82+ self.pointing_device.click()
83 self.assertProperty(controls, visible=True)
84
85 """ Toolbar must disappear when clicked in the video area again """
86- self.mouse.click()
87+ self.pointing_device.click()
88 self.assertProperty(controls, visible=True)
89
90
91=== modified file 'tests/autopilot/mediaplayer_app/tests/test_player_with_video.py'
92--- tests/autopilot/mediaplayer_app/tests/test_player_with_video.py 2013-04-22 19:50:56 +0000
93+++ tests/autopilot/mediaplayer_app/tests/test_player_with_video.py 2013-05-09 13:52:24 +0000
94@@ -9,8 +9,8 @@
95
96 from __future__ import absolute_import
97
98+from autopilot.matchers import Eventually
99 from testtools.matchers import Equals, GreaterThan
100-from autopilot.matchers import Eventually
101
102 from mediaplayer_app.tests import MediaplayerAppTestCase
103
104@@ -29,15 +29,15 @@
105
106 def show_controls(self):
107 video_area = self.main_window.get_object("VideoPlayer", "player")
108- self.mouse.move_to_object(video_area)
109- self.mouse.click()
110+ self.pointing_device.move_to_object(video_area)
111+ self.pointing_device.click()
112 toolbar = self.main_window.get_object("GenericToolbar", "toolbar")
113 self.assertThat(toolbar.ready, Eventually(Equals(True)))
114
115 def pause_video(self):
116 playback_buttom = self.main_window.get_object("IconButton", "Controls.PlayBackButton")
117- self.mouse.move_to_object(playback_buttom)
118- self.mouse.click()
119+ self.pointing_device.move_to_object(playback_buttom)
120+ self.pointing_device.click()
121
122 def test_playback_buttom_states(self):
123 self.show_controls()
124@@ -49,14 +49,14 @@
125 self.assertProperty(player, playing=True, paused=False)
126 self.assertProperty(playback_buttom, icon="pause")
127
128- self.mouse.move_to_object(playback_buttom)
129- self.mouse.click()
130+ self.pointing_device.move_to_object(playback_buttom)
131+ self.pointing_device.click()
132
133 """ First click must pause the video, change playing state and show play icon """
134 self.assertProperty(player, playing=False, paused=True)
135 self.assertProperty(playback_buttom, icon="play")
136
137- self.mouse.click()
138+ self.pointing_device.click()
139
140 """ Second click should change the state to playing again """
141 self.assertProperty(player, playing=True, paused=False)
142@@ -74,12 +74,12 @@
143 self.assertProperty(scene_selector, visible=False)
144
145 """ Scene selector must apper when clicking int the slider handler """
146- self.mouse.move_to_object(slider)
147- self.mouse.click()
148+ self.pointing_device.move_to_object(slider)
149+ self.pointing_device.click()
150 self.assertProperty(scene_selector, visible=True)
151
152 """ click again must dismiss the scene selector """
153- self.mouse.click()
154+ self.pointing_device.click()
155 self.assertProperty(scene_selector, visible=False)
156
157 def test_scene_selector_operation(self):
158@@ -92,8 +92,8 @@
159 self.assertThat(selector.count, Eventually(GreaterThan(3)))
160
161 """ Show scene selector """
162- self.mouse.move_to_object(slider)
163- self.mouse.click()
164+ self.pointing_device.move_to_object(slider)
165+ self.pointing_device.click()
166
167 """ Make sure that the scenes are in correct place """
168 scene_0 = self.main_window.get_object("SceneFrame", "SceneSelector.Scene0")
169@@ -106,8 +106,8 @@
170 """ Click in the second scene """
171 scene_2 = self.main_window.get_object("SceneFrame", "SceneSelector.Scene2")
172 self.assertThat(scene_2.ready, Eventually(Equals(True)))
173- self.mouse.move_to_object(scene_2)
174- self.mouse.click()
175+ self.pointing_device.move_to_object(scene_2)
176+ self.pointing_device.click()
177 self.assertThat(selector.currentIndex, Eventually(Equals(2)))
178 self.assertProperty(time_line, value=1.113)
179
180@@ -119,8 +119,8 @@
181 time_label = self.main_window.get_object("Label", "TimeLine.TimeLabel")
182
183 """ Seek to the midle of the movie """
184- self.mouse.move_to_object(time_line)
185- self.mouse.click()
186+ self.pointing_device.move_to_object(time_line)
187+ self.pointing_device.click()
188
189 """ Time label must show the current video time
190 - Depends on the resolution the current time can be different due the slider size,
191@@ -129,8 +129,8 @@
192 self.assertEqual(time_label.text[0:7], "00:00:0")
193
194 """ Click in the label to change the state """
195- self.mouse.move_to_object(time_label)
196- self.mouse.click()
197+ self.pointing_device.move_to_object(time_label)
198+ self.pointing_device.click()
199
200 """ After the click the label must show the remaning time
201 - Depends on the resolution the current time can be different due the slider size,
202@@ -144,13 +144,13 @@
203 time_line = self.main_window.get_object("Slider", "TimeLine.Slider")
204
205 """ Seek to the midle of the video """
206- self.mouse.move_to_object(time_line)
207- self.mouse.click()
208+ self.pointing_device.move_to_object(time_line)
209+ self.pointing_device.click()
210
211 """ hide controls """
212 video_area = self.main_window.get_object("VideoPlayer", "player")
213- self.mouse.move_to_object(video_area)
214- self.mouse.click()
215+ self.pointing_device.move_to_object(video_area)
216+ self.pointing_device.click()
217
218 """ wait for video ends and control appears"""
219 controls = self.main_window.get_object("Controls", "controls")

Subscribers

People subscribed via source and target branches