ee6653abcb4f4f520d183c8dcc1fb8991c093ad2
4 * python main.py --functional-test 1 --functional-ref
5 * python main.py --functional-test 2 --functional-ref
6 * M-x fla-unset-fun-test'''
8 from os
import getcwd
, system
9 from logging
import debug
, info
10 from pathlib
import Path
11 from shutil
import rmtree
12 from os
import makedirs
13 from os
.path
import join
, exists
16 from panda3d
.core
import Filename
17 from direct
.gui
.OnscreenText
import OnscreenText
18 from lib
.gameobject
import GameObject
19 from lib
.build
.build
import _branch
22 class FunctionalTest(GameObject
):
28 def __init__(self
, idx
, ref
):
30 self
.txt
= OnscreenText('', fg
=(1, 0, 0, 1), scale
=.16)
32 #if self.eng.is_appimage:
33 self
._path
= str(Filename().get_user_appdata_directory())
34 self
._path
+= '/pmachines/'
35 self
._path
+= 'tests/functional%s/' % ('_ref' if ref
else '')
36 home
= '/home/flavio' # we must force this for wine
37 # if self._path.startswith('/c/users/') and exists(str(Path.home()) + '/.local/share/flatpak-wine601/default/'):
38 # self._path = str(Path.home()) + '/.local/share/flatpak-wine601/default/drive_' + self._path[1:]
39 if self
._path
.startswith('/c/users/') and exists(home
+ '/.wine/'):
40 self
._path
= home
+ '/.wine/drive_' + self
._path
[1:]
43 Filename().get_user_appdata_directory(),
44 'pmachines/tests/functional_ref_%s/' % _branch())
47 rmtree(self
._path
, ignore_errors
=True)
48 info('creating dir: %s' % self
._path
)
49 makedirs(self
._path
, exist_ok
=True)
53 #self.eng.attach_obs(self.on_frame_unpausable)
54 taskMgr
.add(self
.on_frame_unpausable
, 'on-frame-unpausable')
55 self
.__mouse
_move
((0, 0)) # otherwise it has not the pointer
56 self
._do
_screenshots
(idx
)
58 def _do_screenshot(self
, path
=None):
59 time
= datetime
.datetime
.now().strftime('%y%m%d%H%M%S')
60 #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
61 #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
62 res
= base
.screenshot(path
or ("pmachines%s.png" % time
), False)
63 info('screenshot %s (%s; %s)' % (path
or ("pmachines%s.png" % time
), res
, getcwd()))
65 def _screenshot(self
, time
, name
):
66 self
._fnames
+= [self
._path
+ name
+ '.png']
68 self
._curr
_time
+ time
,
69 lambda: self
._do
_screenshot
(self
._path
+ name
+ '.png'),
70 'screenshot: %s' % name
)]
72 self
.txt
['text'] = name
73 (self
.txt
.show
if show_hide
else self
.txt
.hide
)()
75 self
._curr
_time
+ time
+ .1,
77 'screenshot: %s (show)' % name
)]
79 self
._curr
_time
+ time
+ FunctionalTest
.evt_time
- .1,
81 'screenshot: %s (hide)' % name
)]
82 self
._curr
_time
+= time
84 def __keypress(self
, key
):
85 '''Emulates a keypress'''
86 dev
= base
.win
.getInputDevice(0)
90 def __char_entered(self
, char
):
91 '''Emulates a character being entered.'''
92 dev
= base
.win
.getInputDevice(0)
93 dev
.keystroke(ord(char
))
95 def __mouse_click(self
, pos
, btn
):
96 base
.win
.move_pointer(0, pos
[0], pos
[1])
97 self
.__keypress
('mouse%s' % (3 if btn
== 'right' else 1))
99 def __mouse_move(self
, pos
):
100 center
= base
.pipe
.get_display_width() / 2, \
101 base
.pipe
.get_display_height() / 2
102 tgt
= pos
[0] + center
[0], pos
[1] + center
[1]
103 system('xdotool mousemove %s %s' % tgt
)
105 def __mouse_drag(self
, start
, end
, btn
):
106 btn
= 'mouse%s' % (3 if btn
== 'right' else 1)
107 dev
= base
.win
.get_input_device(0)
108 base
.win
.move_pointer(0, start
[0], start
[1])
111 base
.win
.move_pointer(0, end
[0], end
[1])
114 taskMgr
.do_method_later(.01, drop_up
, 'drop_up')
115 taskMgr
.do_method_later(.01, drop
, 'drop')
117 def _event(self
, time
, evt
, messenger_evt
=False, append_up
=True, mouse_args
=None):
118 def _append_up(evt_name
):
119 return evt
+ ('' if evt
.endswith('-up') or not append_up
else '-up')
120 def cback_char(_evt
):
121 self
.__char
_entered
(_evt
)
122 def cback_keyp(_evt
):
123 self
.__keypress
(_evt
)
124 self
.__keypress
('raw-' + _evt
)
125 cback
= lambda: (cback_char(evt
) if len(evt
) == 1 else cback_keyp(evt
))
126 if evt
in ['mousemove', 'mouseclick', 'mousedrag']:
127 if evt
== 'mousemove':
128 cback
= lambda: self
.__mouse
_move
(*mouse_args
)
129 elif evt
== 'mouseclick':
130 cback
= lambda: self
.__mouse
_click
(*mouse_args
)
131 elif evt
== 'mousedrag':
132 cback
= lambda: self
.__mouse
_drag
(*mouse_args
)
134 cback
= lambda: messenger
.send(_append_up(evt
))
136 self
._curr
_time
+ time
,
140 self
.txt
['text'] = evt
141 (self
.txt
.show
if show_hide
else self
.txt
.hide
)()
143 self
._curr
_time
+ time
+ .2,
145 'event: %s (show)' % evt
)]
147 self
._curr
_time
+ time
+ .8,
149 'event: %s (hide)' % evt
)]
150 self
._curr
_time
+= time
154 files
= glob(self
._path
+ '*')
155 for fname
in self
._fnames
:
156 info('verifying %s' % fname
)
170 def on_frame_unpausable(self
, task
):
171 for tsk
in self
._tasks
:
172 #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
173 if self
._prev
_time
<= tsk
[0] < globalClock
.getFrameTime():
174 debug('%s %s' % (tsk
[0], tsk
[2]))
176 self
._prev
_time
= globalClock
.getFrameTime() # self.eng.event.unpaused_time
179 def _do_screenshots_1(self
):
180 info('_do_screenshots_1')
181 self
._screenshot
(FunctionalTest
.start_time
, 'main_menu')
182 self
._do
_screenshots
_credits
()
183 self
._do
_screenshots
_options
()
184 self
._do
_screenshots
_exit
()
186 def _do_screenshots_credits(self
):
187 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 410), 'left'])
188 self
._screenshot
(FunctionalTest
.screenshot_time
, 'credits_menu')
189 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 630), 'left'])
190 self
._screenshot
(FunctionalTest
.screenshot_time
, 'main_menu_back_from_credits')
192 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
193 # self._event(FunctionalTest.evt_time, 'arrow_down')
194 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
195 # self._event(FunctionalTest.evt_time, 'arrow_down')
196 # self._screenshot(FunctionalTest.screenshot_time, 'main_menu_highlight')
197 # self._event(FunctionalTest.evt_time, 'rcontrol')
198 # self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
200 # self._event(FunctionalTest.evt_time, 'joypad0-face_a', True)
201 # self._screenshot(FunctionalTest.screenshot_time, 'supporters_menu')
203 # self._event(FunctionalTest.evt_time, 'rcontrol')
204 # self._event(FunctionalTest.evt_time, 'joypad0-face_b', True)
205 # self._event(FunctionalTest.evt_time, 'arrow_up')
206 # self._event(FunctionalTest.evt_time, 'arrow_up')
207 # self._event(FunctionalTest.evt_time, 'arrow_up')
208 # self._event(FunctionalTest.evt_time, 'arrow_up')
210 def _do_screenshots_options(self
):
211 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 270), 'left'])
212 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu')
214 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 50), 'left'])
215 self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages')
216 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(930, 110), 'left'])
217 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_italian')
219 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(703, 153), 'left'])
220 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_1')
222 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 420), 'left'])
223 self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_no')
225 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 510), 'left'])
226 self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_no')
227 # test aa and shadows
228 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 630), 'left']) # back
229 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 130), 'left']) # play
230 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(220, 150), 'left']) # domino
231 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(845, 455), 'left']) # close instructions
232 self
._screenshot
(FunctionalTest
.screenshot_time
, 'aa_no_shadows_no')
233 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(25, 695), 'left']) # home
235 def _do_screenshots_restore_options(self
):
236 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 270), 'left'])
237 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_restored')
239 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 50), 'left'])
240 self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages_restored')
241 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(930, 30), 'left'])
242 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_english')
244 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(677, 153), 'left'])
245 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_2')
247 # the first one is because of the windowed mode in test
248 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
249 # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
250 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
251 # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
252 # self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
253 # self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
255 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 330), 'left'])
256 self
._screenshot
(FunctionalTest
.screenshot_time
, 'resolutions')
257 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(950, 470), 'left'])
258 self
._screenshot
(FunctionalTest
.screenshot_time
, '1440x900')
259 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(720, 410), 'left'])
260 self
._screenshot
(FunctionalTest
.screenshot_time
, 'resolutions_2')
261 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1120, 420), 'left'])
262 self
._screenshot
(FunctionalTest
.screenshot_time
, '1280x720')
264 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 420), 'left'])
265 self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_yes')
267 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 510), 'left'])
268 self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_yes')
269 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 630), 'left']) # back
272 # self._event(FunctionalTest.evt_time, 'arrow_down')
273 # self._event(FunctionalTest.evt_time, 'arrow_down')
274 # self._event(FunctionalTest.evt_time, 'rcontrol')
275 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
277 # self._event(FunctionalTest.evt_time, 'rcontrol')
278 # self._screenshot(FunctionalTest.screenshot_time, 'language_open')
279 # self._event(FunctionalTest.evt_time, 'arrow_down')
280 # self._screenshot(FunctionalTest.screenshot_time, 'language_highlight')
281 # self._event(FunctionalTest.evt_time, 'rcontrol')
282 # self._screenshot(FunctionalTest.screenshot_time, 'language_it')
284 # self._event(FunctionalTest.evt_time, 'arrow_down')
285 # self._event(FunctionalTest.evt_time, 'arrow_right')
286 # self._event(FunctionalTest.evt_time, 'arrow_right')
287 # self._screenshot(FunctionalTest.screenshot_time, 'volume')
289 # self._event(FunctionalTest.evt_time, 'arrow_down')
290 # self._event(FunctionalTest.evt_time, 'rcontrol')
291 # self._screenshot(FunctionalTest.screenshot_time, 'cars_open')
292 # self._event(FunctionalTest.evt_time, 'rcontrol')
293 # self._screenshot(FunctionalTest.screenshot_time, 'cars_changed')
295 # self._event(FunctionalTest.evt_time, 'arrow_down')
296 # self._event(FunctionalTest.evt_time, 'arrow_down')
297 # self._event(FunctionalTest.evt_time, 'arrow_down')
298 # self._event(FunctionalTest.evt_time, 'rcontrol')
299 # self._event(FunctionalTest.evt_time, 'arrow_up')
300 # self._event(FunctionalTest.evt_time, 'arrow_up')
302 def _do_screenshots_play(self
):
303 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 130), 'left']) # play
304 self
._screenshot
(FunctionalTest
.screenshot_time
, 'play_menu')
305 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(220, 150), 'left']) # domino scene
306 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_instructions')
307 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(800, 455), 'left']) # close instructions
308 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino')
309 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(25, 695), 'left']) # home
310 self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_scene')
311 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 130), 'left']) # play
312 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(220, 150), 'left']) # domino
313 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(800, 455), 'left']) # close instructions
314 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(60, 695), 'left']) # info
315 self
._screenshot
(FunctionalTest
.screenshot_time
, 'info')
316 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(800, 455), 'left']) # close instructions
317 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (370, 220), 'left']) # drag a piece
318 self
._screenshot
(FunctionalTest
.screenshot_time
, 'domino_dragged')
319 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(500, 340), 'left']) # rewind
320 self
._screenshot
(FunctionalTest
.screenshot_time
, 'rewind')
321 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (525, 350), 'left']) # drag a piece
322 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 510), (670, 350), 'left']) # drag a piece
323 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
324 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino')
325 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(590, 420), 'left']) # home
326 self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_fail')
327 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 130), 'left']) # play
328 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(220, 150), 'left']) # domino
329 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(800, 455), 'left']) # close instructions
330 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (525, 350), 'left']) # drag a piece
331 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (670, 350), 'left']) # drag a piece
332 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
333 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino_2')
334 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 420), 'left']) # replay
335 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (540, 140), 'left']) # drag a piece
336 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(540, 130), (600, 130), 'right']) # rotate the piece
337 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (665, 355), 'left']) # drag a piece
338 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
339 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino')
340 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(690, 420), 'left']) # next
341 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box')
343 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(830, 455), 'left']) # close instructions
344 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (660, 585), 'left']) # drag a box
345 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (660, 515), 'left']) # drag a box
346 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
347 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box')
348 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 420), 'left']) # replay
349 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (660, 585), 'left']) # drag a box
350 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (660, 515), 'left']) # drag a box
351 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (660, 430), 'left']) # drag a box
352 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
353 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_box')
354 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(690, 420), 'left']) # next
355 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box_domino')
357 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(875, 455), 'left']) # close instructions
358 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (865, 415), 'left']) # drag a box
359 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (865, 330), 'left']) # drag a box
360 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
361 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box_domino')
362 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 420), 'left']) # replay
363 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (860, 415), 'left']) # drag a box
364 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (775, 235), 'left']) # drag a box
365 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
366 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_box_domino')
367 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(690, 420), 'left']) # next
368 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_basketball')
370 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(820, 455), 'left']) # close instructions
371 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (630, 300), 'left']) # drag a ball
372 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
373 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_basketball')
374 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 420), 'left']) # replay
375 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (360, 150), 'left']) # drag a ball
376 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
377 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_basketball')
378 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(690, 420), 'left']) # next
379 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_box_basketball')
381 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(815, 455), 'left']) # close instructions
382 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (550, 415), 'left']) # drag a box
383 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (560, 340), 'left']) # drag a piece
384 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
385 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino_box_basketball')
386 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 420), 'left']) # replay
387 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(60, 60), (550, 415), 'left']) # drag a box
388 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 50), (618, 412), 'left']) # drag a piece
389 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(620, 430), (660, 425), 'right']) # rotate a piece
390 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(615, 415), (615, 420), 'left']) # drag a piece
391 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1260, 695), 'left']) # play
392 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino_box_basketball')
393 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left']) # next
394 # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
396 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left']) # close instructions
397 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 300), 'left']) # drag a box
398 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
399 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
400 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left']) # replay
401 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 150), 'left']) # drag a box
402 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(515, 115), (515, 122), 'right']) # rotate a box
403 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
404 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
405 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left']) # next
406 # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
408 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 455), 'left']) # close instructions
409 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (155, 180), 'left']) # drag a box
410 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
411 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
412 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left']) # replay
413 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (170, 80), 'left']) # drag a box
414 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(195, 50), (195, 80), 'right']) # rotate a box
415 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
416 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
417 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(590, 420), 'left']) # home
418 self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_from_play')
420 def _do_screenshots_exit(self
):
421 # self._event(FunctionalTest.evt_time, 'arrow_down')
422 # self._event(FunctionalTest.evt_time, 'arrow_down')
423 # self._event(FunctionalTest.evt_time, 'arrow_down')
424 # self._event(FunctionalTest.evt_time, 'arrow_down')
425 # self._event(FunctionalTest.evt_time, 'arrow_down')
426 # self._event(FunctionalTest.evt_time, 'rcontrol')
427 # self._event(FunctionalTest.evt_time, 'arrow_down')
429 # self._event(FunctionalTest.evt_time, 'rcontrol')
431 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(640, 560), 'left'])
434 def _do_screenshots_2(self
):
435 info('_do_screenshots_2')
436 self
._screenshot
(FunctionalTest
.start_time
, 'main_menu_2')
437 self
._do
_screenshots
_restore
_options
()
438 self
._do
_screenshots
_play
()
439 self
._do
_screenshots
_exit
()
440 # self._do_screenshots_game()
441 # self._do_screenshots_end()
443 # def _do_screenshots_restore_options(self):
445 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
446 # self._event(FunctionalTest.evt_time, 'arrow_down')
447 # self._event(FunctionalTest.evt_time, 'rcontrol')
448 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
450 # self._event(FunctionalTest.evt_time, 'rcontrol')
451 # self._event(FunctionalTest.evt_time, 'arrow_up')
452 # self._event(FunctionalTest.evt_time, 'rcontrol')
453 # self._screenshot(FunctionalTest.screenshot_time, 'language_en_restored')
455 # self._event(FunctionalTest.evt_time, 'arrow_down')
456 # self._event(FunctionalTest.evt_time, 'arrow_left')
457 # self._event(FunctionalTest.evt_time, 'arrow_left')
458 # self._screenshot(FunctionalTest.screenshot_time, 'volume_restored')
460 # self._event(FunctionalTest.evt_time, 'arrow_down')
461 # self._event(FunctionalTest.evt_time, 'rcontrol')
462 # self._event(FunctionalTest.evt_time, 'arrow_down')
463 # self._event(FunctionalTest.evt_time, 'arrow_down')
464 # self._event(FunctionalTest.evt_time, 'arrow_down')
465 # self._event(FunctionalTest.evt_time, 'arrow_down')
466 # self._event(FunctionalTest.evt_time, 'rcontrol')
467 # self._screenshot(FunctionalTest.screenshot_time, 'cars_restored')
468 # # graphics settings
469 # self._event(FunctionalTest.evt_time, 'arrow_down')
470 # self._event(FunctionalTest.evt_time, 'rcontrol')
471 # self._screenshot(FunctionalTest.screenshot_time, 'graphics_settings')
472 # self._event(FunctionalTest.evt_time, 'arrow_down')
473 # self._event(FunctionalTest.evt_time, 'arrow_down')
474 # self._event(FunctionalTest.evt_time, 'rcontrol')
475 # self._screenshot(FunctionalTest.screenshot_time, 'antialiasing')
476 # self._event(FunctionalTest.evt_time, 'rcontrol')
477 # self._event(FunctionalTest.evt_time, 'arrow_down')
478 # self._event(FunctionalTest.evt_time, 'rcontrol')
479 # self._screenshot(FunctionalTest.screenshot_time, 'shadows')
480 # self._event(FunctionalTest.evt_time, 'rcontrol')
481 # self._event(FunctionalTest.evt_time, 'arrow_down')
482 # self._event(FunctionalTest.evt_time, 'rcontrol')
483 # self._screenshot(FunctionalTest.screenshot_time, 'fog')
484 # self._event(FunctionalTest.evt_time, 'rcontrol')
485 # self._event(FunctionalTest.evt_time, 'arrow_down')
486 # self._event(FunctionalTest.evt_time, 'rcontrol')
487 # self._screenshot(FunctionalTest.screenshot_time, 'normal_mapping')
488 # self._event(FunctionalTest.evt_time, 'rcontrol')
489 # self._event(FunctionalTest.evt_time, 'arrow_down')
490 # self._event(FunctionalTest.evt_time, 'rcontrol')
491 # self._screenshot(FunctionalTest.screenshot_time, 'occlusion')
492 # self._event(FunctionalTest.evt_time, 'rcontrol')
493 # self._event(FunctionalTest.evt_time, 'arrow_down')
494 # self._event(FunctionalTest.evt_time, 'rcontrol')
496 # self._event(FunctionalTest.evt_time, 'arrow_down')
497 # self._event(FunctionalTest.evt_time, 'rcontrol')
498 # self._screenshot(FunctionalTest.screenshot_time, 'input')
499 # self._event(FunctionalTest.evt_time, 'rcontrol')
500 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1')
501 # self._event(FunctionalTest.evt_time, 'rcontrol')
502 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_rec')
503 # self._event(FunctionalTest.evt_time, '8', True, False)
504 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_changed')
505 # self._event(FunctionalTest.evt_time, 'rcontrol')
506 # self._event(FunctionalTest.evt_time, 'arrow_up', True, False)
507 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_restored')
508 # self._event(FunctionalTest.evt_time, 'rcontrol')
509 # self._event(FunctionalTest.evt_time, 'w', True, False)
510 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already')
511 # self._event(FunctionalTest.evt_time, 'rcontrol')
512 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already_closed')
513 # self._event(FunctionalTest.evt_time, 'arrow_down')
514 # self._event(FunctionalTest.evt_time, 'arrow_down')
515 # self._event(FunctionalTest.evt_time, 'arrow_down')
516 # self._event(FunctionalTest.evt_time, 'arrow_down')
517 # self._event(FunctionalTest.evt_time, 'rcontrol')
518 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p2')
519 # self._event(FunctionalTest.evt_time, 'arrow_down')
520 # self._event(FunctionalTest.evt_time, 'arrow_down')
521 # self._event(FunctionalTest.evt_time, 'arrow_down')
522 # self._event(FunctionalTest.evt_time, 'arrow_down')
523 # self._event(FunctionalTest.evt_time, 'rcontrol')
524 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p3')
525 # self._event(FunctionalTest.evt_time, 'arrow_down')
526 # self._event(FunctionalTest.evt_time, 'arrow_down')
527 # self._event(FunctionalTest.evt_time, 'arrow_down')
528 # self._event(FunctionalTest.evt_time, 'arrow_down')
529 # self._event(FunctionalTest.evt_time, 'rcontrol')
530 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p4')
531 # self._event(FunctionalTest.evt_time, 'arrow_down')
532 # self._event(FunctionalTest.evt_time, 'arrow_down')
533 # self._event(FunctionalTest.evt_time, 'arrow_down')
534 # self._event(FunctionalTest.evt_time, 'arrow_down')
535 # self._event(FunctionalTest.evt_time, 'rcontrol')
536 # self._event(FunctionalTest.evt_time, 'arrow_down')
537 # self._event(FunctionalTest.evt_time, 'rcontrol')
538 # self._event(FunctionalTest.evt_time, 'arrow_down')
539 # self._event(FunctionalTest.evt_time, 'rcontrol')
540 # self._event(FunctionalTest.evt_time, 'arrow_down')
541 # self._event(FunctionalTest.evt_time, 'rcontrol')
542 # self._event(FunctionalTest.evt_time, 'arrow_down')
543 # self._event(FunctionalTest.evt_time, 'rcontrol')
544 # self._event(FunctionalTest.evt_time, 'arrow_down')
545 # self._event(FunctionalTest.evt_time, 'rcontrol')
546 # self._event(FunctionalTest.evt_time, 'arrow_up')
547 # self._event(FunctionalTest.evt_time, 'arrow_up')
549 # def _do_screenshots_game(self):
551 # self._event(FunctionalTest.evt_time, 'rcontrol')
552 # self._screenshot(FunctionalTest.screenshot_time, 'single_player_menu')
553 # self._event(FunctionalTest.evt_time, 'rcontrol')
554 # self._screenshot(FunctionalTest.screenshot_time, 'track_page')
555 # self._event(FunctionalTest.evt_time, 'rcontrol')
556 # self._screenshot(FunctionalTest.screenshot_time, 'car_page_start')
557 # self._event(FunctionalTest.evt_time, 'arrow_left')
558 # self._screenshot(FunctionalTest.screenshot_time, 'car_page_sel')
559 # self._event(FunctionalTest.evt_time, 'rcontrol')
560 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_start')
561 # self._event(FunctionalTest.evt_time, 'arrow_down')
562 # self._event(FunctionalTest.evt_time, 'arrow_down')
563 # self._event(FunctionalTest.evt_time, 'rcontrol')
564 # self._event(FunctionalTest.evt_time, 'arrow_down')
565 # self._event(FunctionalTest.evt_time, 'arrow_down')
566 # self._event(FunctionalTest.evt_time, 'rcontrol')
567 # self._event(FunctionalTest.evt_time, 'arrow_down')
568 # self._event(FunctionalTest.evt_time, 'rcontrol')
569 # self._event(FunctionalTest.evt_time, 'arrow_up')
570 # self._event(FunctionalTest.evt_time, 'rcontrol')
571 # self._event(FunctionalTest.evt_time, 'rcontrol')
572 # self._event(FunctionalTest.evt_time, 'arrow_left')
573 # self._event(FunctionalTest.evt_time, 'rcontrol')
574 # self._event(FunctionalTest.evt_time, 'rcontrol')
575 # self._event(FunctionalTest.evt_time, 'rcontrol')
576 # self._event(FunctionalTest.evt_time, 'rcontrol')
577 # self._event(FunctionalTest.evt_time, 'rcontrol')
578 # self._event(FunctionalTest.evt_time, 'arrow_left')
579 # self._event(FunctionalTest.evt_time, 'rcontrol')
580 # self._event(FunctionalTest.evt_time, 'arrow_up')
581 # self._event(FunctionalTest.evt_time, 'rcontrol')
582 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry')
583 # self._event(FunctionalTest.evt_time, 'backspace')
584 # self._event(FunctionalTest.evt_time, 'backspace')
585 # self._event(FunctionalTest.evt_time, 'backspace')
586 # self._event(FunctionalTest.evt_time, 'backspace')
587 # self._event(FunctionalTest.evt_time, 'backspace')
588 # self._event(FunctionalTest.evt_time, 'backspace')
589 # self._event(FunctionalTest.evt_time, 'backspace')
590 # self._event(FunctionalTest.evt_time, 'backspace')
591 # self._event(FunctionalTest.evt_time, 'backspace')
592 # self._event(FunctionalTest.evt_time, 'backspace')
593 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_empty')
594 # self._event(FunctionalTest.evt_time, 'f')
595 # self._event(FunctionalTest.evt_time, 'l')
596 # self._event(FunctionalTest.evt_time, 'a')
597 # self._event(FunctionalTest.evt_time, 'v')
598 # self._event(FunctionalTest.evt_time, 'i')
599 # self._event(FunctionalTest.evt_time, 'o')
600 # self._event(FunctionalTest.evt_time, 'enter')
601 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_full')
602 # self._event(FunctionalTest.evt_time, 'arrow_down')
603 # self._event(FunctionalTest.evt_time, 'arrow_right')
604 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_sel')
606 # self._event(FunctionalTest.evt_time, 'rcontrol')
607 # self._event(40, 'escape-up')
608 # self._screenshot(FunctionalTest.screenshot_time, 'ingame_menu')
609 # self._event(FunctionalTest.evt_time, 'rcontrol')
610 # self._screenshot(FunctionalTest.screenshot_time, 'race_back')
611 # self._event(FunctionalTest.evt_time, 'escape-up')
612 # self._event(FunctionalTest.evt_time, 'arrow_down')
613 # self._screenshot(FunctionalTest.screenshot_time, 'ingame_sel')
614 # self._event(FunctionalTest.evt_time, 'rcontrol')
615 # self._screenshot(FunctionalTest.screenshot_time, 'main_page_back_race')
617 # def _do_screenshots_end(self):
618 # self._event(FunctionalTest.evt_time, 'arrow_down')
619 # self._event(FunctionalTest.evt_time, 'arrow_down')
620 # self._event(FunctionalTest.evt_time, 'arrow_down')
621 # self._event(FunctionalTest.evt_time, 'arrow_down')
622 # self._event(FunctionalTest.evt_time, 'arrow_down')
623 # self._event(FunctionalTest.evt_time, 'rcontrol')
624 # self._screenshot(FunctionalTest.screenshot_time, 'exit_page')
625 # self._event(FunctionalTest.evt_time, 'arrow_down')
626 # self._screenshot(FunctionalTest.screenshot_time, 'exit_page_sel')
628 # self._event(FunctionalTest.evt_time, 'rcontrol')
631 def _do_screenshots(self
, idx
):
632 [self
._do
_screenshots
_1, self
._do
_screenshots
_2][int(idx
) - 1]()