bab0cc3988e74daf33bd2c7a896648269d8306c1
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))
98 offset_x
= int((1920 - 1360) / 2) + 1 # xfce decorations
99 offset_y
= int((1080 - 768) / 2) + 24 # xfce decorations
100 btn
= 3 if btn
== 'right' else 1
101 system('xdotool mousemove %s %s' % (offset_x
+ pos
[0], offset_y
+ pos
[1]))
103 system('xdotool click %s' % btn
)
104 taskMgr
.do_method_later(.01, click
, 'click')
106 def __mouse_move(self
, pos
):
107 center
= base
.pipe
.get_display_width() / 2, \
108 base
.pipe
.get_display_height() / 2
109 tgt
= pos
[0] + center
[0], pos
[1] + center
[1]
110 system('xdotool mousemove %s %s' % tgt
)
112 def __mouse_drag(self
, start
, end
, btn
):
113 # btn = 'mouse%s' % (3 if btn == 'right' else 1)
114 # dev = base.win.get_input_device(0)
115 # base.win.move_pointer(0, start[0], start[1])
116 # dev.buttonDown(btn)
118 # base.win.move_pointer(0, end[0], end[1])
121 # taskMgr.do_method_later(.01, drop_up, 'drop_up')
122 # taskMgr.do_method_later(.01, drop, 'drop')
123 offset_x
= int((1920 - 1360) / 2) + 1 # xfce decorations
124 offset_y
= int((1080 - 768) / 2) + 24 # xfce decorations
125 btn
= 3 if btn
== 'right' else 1
126 system('xdotool mousemove %s %s' % (offset_x
+ start
[0], offset_y
+ start
[1]))
128 system('xdotool mousedown %s' % btn
)
130 system('xdotool mousemove %s %s' % (offset_x
+ end
[0], offset_y
+ end
[1]))
132 system('xdotool mouseup %s' % btn
)
133 taskMgr
.do_method_later(.01, mouseup
, 'mouseup')
134 taskMgr
.do_method_later(.01, mousemove
, 'mousemove')
135 taskMgr
.do_method_later(.01, mousedown
, 'mousedown')
137 def _event(self
, time
, evt
, messenger_evt
=False, append_up
=True, mouse_args
=None):
138 def _append_up(evt_name
):
139 return evt
+ ('' if evt
.endswith('-up') or not append_up
else '-up')
140 def cback_char(_evt
):
141 self
.__char
_entered
(_evt
)
142 def cback_keyp(_evt
):
143 self
.__keypress
(_evt
)
144 self
.__keypress
('raw-' + _evt
)
145 cback
= lambda: (cback_char(evt
) if len(evt
) == 1 else cback_keyp(evt
))
146 if evt
in ['mousemove', 'mouseclick', 'mousedrag']:
147 if evt
== 'mousemove':
148 cback
= lambda: self
.__mouse
_move
(*mouse_args
)
149 elif evt
== 'mouseclick':
150 cback
= lambda: self
.__mouse
_click
(*mouse_args
)
151 elif evt
== 'mousedrag':
152 cback
= lambda: self
.__mouse
_drag
(*mouse_args
)
154 cback
= lambda: messenger
.send(_append_up(evt
))
156 self
._curr
_time
+ time
,
160 self
.txt
['text'] = evt
161 (self
.txt
.show
if show_hide
else self
.txt
.hide
)()
163 self
._curr
_time
+ time
+ .2,
165 'event: %s (show)' % evt
)]
167 self
._curr
_time
+ time
+ .8,
169 'event: %s (hide)' % evt
)]
170 self
._curr
_time
+= time
172 def _enforce_res(self
, time
, res
):
173 cback
= lambda: messenger
.send('enforce_res', [res
])
175 self
._curr
_time
+ time
,
177 'enforce res: %s' % res
)]
178 self
._curr
_time
+= time
182 files
= glob(self
._path
+ '*')
183 for fname
in self
._fnames
:
184 info('verifying %s' % fname
)
198 def on_frame_unpausable(self
, task
):
199 for tsk
in self
._tasks
:
200 #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
201 if self
._prev
_time
<= tsk
[0] < globalClock
.getFrameTime():
202 debug('%s %s' % (tsk
[0], tsk
[2]))
204 self
._prev
_time
= globalClock
.getFrameTime() # self.eng.event.unpaused_time
207 def _do_screenshots_1(self
):
208 info('_do_screenshots_1')
209 self
._screenshot
(FunctionalTest
.start_time
, 'main_menu')
210 self
._do
_screenshots
_credits
()
211 self
._do
_screenshots
_options
()
212 self
._do
_screenshots
_exit
()
214 def _do_screenshots_credits(self
):
215 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 450), 'left'])
216 self
._screenshot
(FunctionalTest
.screenshot_time
, 'credits_menu')
217 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 680), 'left'])
218 self
._screenshot
(FunctionalTest
.screenshot_time
, 'main_menu_back_from_credits')
220 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
221 # self._event(FunctionalTest.evt_time, 'arrow_down')
222 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
223 # self._event(FunctionalTest.evt_time, 'arrow_down')
224 # self._screenshot(FunctionalTest.screenshot_time, 'main_menu_highlight')
225 # self._event(FunctionalTest.evt_time, 'rcontrol')
226 # self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
228 # self._event(FunctionalTest.evt_time, 'joypad0-face_a', True)
229 # self._screenshot(FunctionalTest.screenshot_time, 'supporters_menu')
231 # self._event(FunctionalTest.evt_time, 'rcontrol')
232 # self._event(FunctionalTest.evt_time, 'joypad0-face_b', True)
233 # self._event(FunctionalTest.evt_time, 'arrow_up')
234 # self._event(FunctionalTest.evt_time, 'arrow_up')
235 # self._event(FunctionalTest.evt_time, 'arrow_up')
236 # self._event(FunctionalTest.evt_time, 'arrow_up')
238 def _do_screenshots_options(self
):
239 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 300), 'left'])
240 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu')
242 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 60), 'left'])
243 self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages')
244 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(980, 120), 'left'])
245 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_italian')
247 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(740, 163), 'left'])
248 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_1')
250 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 440), 'left'])
251 self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_no')
253 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 540), 'left'])
254 self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_no')
255 # test aa and shadows
256 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 680), 'left']) # back
257 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 140), 'left']) # play
258 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(230, 160), 'left']) # domino
259 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(900, 490), 'left']) # close instructions
260 self
._screenshot
(FunctionalTest
.screenshot_time
, 'aa_no_shadows_no')
261 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(25, 740), 'left']) # home
263 def _do_screenshots_restore_options(self
):
264 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 300), 'left'])
265 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_restored')
267 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 60), 'left'])
268 self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages_restored')
269 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(980, 20), 'left'])
270 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_english')
272 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(719, 163), 'left'])
273 self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_2')
275 # the first one is because of the windowed mode in test
276 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
277 # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
278 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
279 # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
280 # self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
281 # self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
283 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 340), 'left'])
284 # self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
285 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1020, 160), 'left'])
286 # self._screenshot(FunctionalTest.screenshot_time, '1440x900')
287 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(740, 400), 'left'])
288 # self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
289 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1110, 80), 'left'])
290 # self._screenshot(FunctionalTest.screenshot_time, '1360x768')
292 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 440), 'left'])
293 self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_yes')
295 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 540), 'left'])
296 self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_yes')
297 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 680), 'left']) # back
300 # self._event(FunctionalTest.evt_time, 'arrow_down')
301 # self._event(FunctionalTest.evt_time, 'arrow_down')
302 # self._event(FunctionalTest.evt_time, 'rcontrol')
303 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
305 # self._event(FunctionalTest.evt_time, 'rcontrol')
306 # self._screenshot(FunctionalTest.screenshot_time, 'language_open')
307 # self._event(FunctionalTest.evt_time, 'arrow_down')
308 # self._screenshot(FunctionalTest.screenshot_time, 'language_highlight')
309 # self._event(FunctionalTest.evt_time, 'rcontrol')
310 # self._screenshot(FunctionalTest.screenshot_time, 'language_it')
312 # self._event(FunctionalTest.evt_time, 'arrow_down')
313 # self._event(FunctionalTest.evt_time, 'arrow_right')
314 # self._event(FunctionalTest.evt_time, 'arrow_right')
315 # self._screenshot(FunctionalTest.screenshot_time, 'volume')
317 # self._event(FunctionalTest.evt_time, 'arrow_down')
318 # self._event(FunctionalTest.evt_time, 'rcontrol')
319 # self._screenshot(FunctionalTest.screenshot_time, 'cars_open')
320 # self._event(FunctionalTest.evt_time, 'rcontrol')
321 # self._screenshot(FunctionalTest.screenshot_time, 'cars_changed')
323 # self._event(FunctionalTest.evt_time, 'arrow_down')
324 # self._event(FunctionalTest.evt_time, 'arrow_down')
325 # self._event(FunctionalTest.evt_time, 'arrow_down')
326 # self._event(FunctionalTest.evt_time, 'rcontrol')
327 # self._event(FunctionalTest.evt_time, 'arrow_up')
328 # self._event(FunctionalTest.evt_time, 'arrow_up')
330 def _do_screenshots_play(self
):
331 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 140), 'left']) # play
332 self
._screenshot
(FunctionalTest
.screenshot_time
, 'play_menu')
333 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 680), 'left']) # back
334 self
._screenshot
(FunctionalTest
.screenshot_time
, 'back_from_play')
335 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 140), 'left']) # play
336 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(230, 160), 'left']) # domino scene
337 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_instructions')
338 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
339 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino')
340 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(25, 740), 'left']) # home
341 self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_scene')
342 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 140), 'left']) # play
343 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(230, 160), 'left']) # domino
344 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
345 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(70, 740), 'left']) # info
346 self
._screenshot
(FunctionalTest
.screenshot_time
, 'info')
347 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
348 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(35, 60), (430, 280), 'left']) # drag a piece
349 self
._screenshot
(FunctionalTest
.screenshot_time
, 'domino_dragged')
350 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1220, 740), 'left']) # rewind
351 self
._screenshot
(FunctionalTest
.screenshot_time
, 'rewind')
352 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(35, 60), (550, 380), 'left']) # drag a piece
353 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left']) # drag a piece
354 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
355 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino')
356 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(630, 450), 'left']) # home
357 self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_fail')
358 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 140), 'left']) # play
359 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(230, 160), 'left']) # domino
360 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
361 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(35, 60), (550, 380), 'left']) # drag a piece
362 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(35, 60), (715, 380), 'left']) # drag a piece
363 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
364 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino_2')
365 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 450), 'left']) # replay
366 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(35, 60), (570, 380), 'left']) # drag a piece
367 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(570, 355), (605, 355), 'right']) # rotate the piece
368 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(35, 60), (715, 380), 'left']) # drag a piece
369 self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
370 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
371 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino')
372 self
._enforce
_res
(FunctionalTest
.evt_time
, '')
373 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(735, 450), 'left']) # next
374 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box')
376 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(880, 490), 'left']) # close instructions
377 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (710, 620), 'left']) # drag a box
378 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (710, 540), 'left']) # drag a box
379 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
380 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box')
381 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 450), 'left']) # replay
382 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (710, 620), 'left']) # drag a box
383 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (710, 540), 'left']) # drag a box
384 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (705, 460), 'left']) # drag a box
385 self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
386 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
387 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_box')
388 self
._enforce
_res
(FunctionalTest
.evt_time
, '')
389 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(735, 450), 'left']) # next
390 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box_domino')
392 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(930, 485), 'left']) # close instructions
393 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (910, 440), 'left']) # drag a box
394 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (910, 360), 'left']) # drag a box
395 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
396 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box_domino')
397 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 450), 'left']) # replay
398 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (910, 440), 'left']) # drag a box
399 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (835, 250), 'left']) # drag a box
400 self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
401 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
402 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_box_domino')
403 self
._enforce
_res
(FunctionalTest
.evt_time
, '')
404 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(735, 450), 'left']) # next
405 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_basketball')
407 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(870, 490), 'left']) # close instructions
408 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(55, 50), (650, 310), 'left']) # drag a ball
409 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
410 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_basketball')
411 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 450), 'left']) # replay
412 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(55, 50), (380, 50), 'left']) # drag a ball
413 self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
414 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
415 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_basketball')
416 self
._enforce
_res
(FunctionalTest
.evt_time
, '')
417 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(735, 450), 'left']) # next
418 self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_box_basketball')
420 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(865, 490), 'left']) # close instructions
421 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (580, 440), 'left']) # drag a box
422 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 60), (590, 370), 'left']) # drag a piece
423 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
424 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino_box_basketball')
425 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 450), 'left']) # replay
426 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(65, 60), (580, 440), 'left']) # drag a box
427 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(30, 60), (660, 440), 'left']) # drag a piece
428 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(660, 425), (625, 425), 'right']) # rotate a piece
429 self
._event
(FunctionalTest
.evt_time
, 'mousedrag', False, False, [(660, 435), (650, 445), 'left']) # drag a piece
430 self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
431 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(1340, 740), 'left']) # play
432 self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino_box_basketball')
433 self
._enforce
_res
(FunctionalTest
.evt_time
, '')
434 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left']) # next
435 # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
437 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left']) # close instructions
438 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 300), 'left']) # drag a box
439 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
440 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
441 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left']) # replay
442 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 150), 'left']) # drag a box
443 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(515, 115), (515, 122), 'right']) # rotate a box
444 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
445 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
446 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left']) # next
447 # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
449 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 455), 'left']) # close instructions
450 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (155, 180), 'left']) # drag a box
451 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
452 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
453 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left']) # replay
454 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (170, 80), 'left']) # drag a box
455 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(195, 50), (195, 80), 'right']) # rotate a box
456 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
457 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
458 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(630, 450), 'left']) # home
459 self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_from_play')
461 def _do_screenshots_exit(self
):
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, 'arrow_down')
467 # self._event(FunctionalTest.evt_time, 'rcontrol')
468 # self._event(FunctionalTest.evt_time, 'arrow_down')
470 # self._event(FunctionalTest.evt_time, 'rcontrol')
472 self
._event
(FunctionalTest
.evt_time
, 'mouseclick', False, False, [(680, 600), 'left'])
475 def _do_screenshots_2(self
):
476 info('_do_screenshots_2')
477 self
._screenshot
(FunctionalTest
.start_time
, 'main_menu_2')
478 self
._do
_screenshots
_restore
_options
()
479 self
._do
_screenshots
_play
()
480 self
._do
_screenshots
_exit
()
481 # self._do_screenshots_game()
482 # self._do_screenshots_end()
484 # def _do_screenshots_restore_options(self):
486 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
487 # self._event(FunctionalTest.evt_time, 'arrow_down')
488 # self._event(FunctionalTest.evt_time, 'rcontrol')
489 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
491 # self._event(FunctionalTest.evt_time, 'rcontrol')
492 # self._event(FunctionalTest.evt_time, 'arrow_up')
493 # self._event(FunctionalTest.evt_time, 'rcontrol')
494 # self._screenshot(FunctionalTest.screenshot_time, 'language_en_restored')
496 # self._event(FunctionalTest.evt_time, 'arrow_down')
497 # self._event(FunctionalTest.evt_time, 'arrow_left')
498 # self._event(FunctionalTest.evt_time, 'arrow_left')
499 # self._screenshot(FunctionalTest.screenshot_time, 'volume_restored')
501 # self._event(FunctionalTest.evt_time, 'arrow_down')
502 # self._event(FunctionalTest.evt_time, 'rcontrol')
503 # self._event(FunctionalTest.evt_time, 'arrow_down')
504 # self._event(FunctionalTest.evt_time, 'arrow_down')
505 # self._event(FunctionalTest.evt_time, 'arrow_down')
506 # self._event(FunctionalTest.evt_time, 'arrow_down')
507 # self._event(FunctionalTest.evt_time, 'rcontrol')
508 # self._screenshot(FunctionalTest.screenshot_time, 'cars_restored')
509 # # graphics settings
510 # self._event(FunctionalTest.evt_time, 'arrow_down')
511 # self._event(FunctionalTest.evt_time, 'rcontrol')
512 # self._screenshot(FunctionalTest.screenshot_time, 'graphics_settings')
513 # self._event(FunctionalTest.evt_time, 'arrow_down')
514 # self._event(FunctionalTest.evt_time, 'arrow_down')
515 # self._event(FunctionalTest.evt_time, 'rcontrol')
516 # self._screenshot(FunctionalTest.screenshot_time, 'antialiasing')
517 # self._event(FunctionalTest.evt_time, 'rcontrol')
518 # self._event(FunctionalTest.evt_time, 'arrow_down')
519 # self._event(FunctionalTest.evt_time, 'rcontrol')
520 # self._screenshot(FunctionalTest.screenshot_time, 'shadows')
521 # self._event(FunctionalTest.evt_time, 'rcontrol')
522 # self._event(FunctionalTest.evt_time, 'arrow_down')
523 # self._event(FunctionalTest.evt_time, 'rcontrol')
524 # self._screenshot(FunctionalTest.screenshot_time, 'fog')
525 # self._event(FunctionalTest.evt_time, 'rcontrol')
526 # self._event(FunctionalTest.evt_time, 'arrow_down')
527 # self._event(FunctionalTest.evt_time, 'rcontrol')
528 # self._screenshot(FunctionalTest.screenshot_time, 'normal_mapping')
529 # self._event(FunctionalTest.evt_time, 'rcontrol')
530 # self._event(FunctionalTest.evt_time, 'arrow_down')
531 # self._event(FunctionalTest.evt_time, 'rcontrol')
532 # self._screenshot(FunctionalTest.screenshot_time, 'occlusion')
533 # self._event(FunctionalTest.evt_time, 'rcontrol')
534 # self._event(FunctionalTest.evt_time, 'arrow_down')
535 # self._event(FunctionalTest.evt_time, 'rcontrol')
537 # self._event(FunctionalTest.evt_time, 'arrow_down')
538 # self._event(FunctionalTest.evt_time, 'rcontrol')
539 # self._screenshot(FunctionalTest.screenshot_time, 'input')
540 # self._event(FunctionalTest.evt_time, 'rcontrol')
541 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1')
542 # self._event(FunctionalTest.evt_time, 'rcontrol')
543 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_rec')
544 # self._event(FunctionalTest.evt_time, '8', True, False)
545 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_changed')
546 # self._event(FunctionalTest.evt_time, 'rcontrol')
547 # self._event(FunctionalTest.evt_time, 'arrow_up', True, False)
548 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_restored')
549 # self._event(FunctionalTest.evt_time, 'rcontrol')
550 # self._event(FunctionalTest.evt_time, 'w', True, False)
551 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already')
552 # self._event(FunctionalTest.evt_time, 'rcontrol')
553 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already_closed')
554 # self._event(FunctionalTest.evt_time, 'arrow_down')
555 # self._event(FunctionalTest.evt_time, 'arrow_down')
556 # self._event(FunctionalTest.evt_time, 'arrow_down')
557 # self._event(FunctionalTest.evt_time, 'arrow_down')
558 # self._event(FunctionalTest.evt_time, 'rcontrol')
559 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p2')
560 # self._event(FunctionalTest.evt_time, 'arrow_down')
561 # self._event(FunctionalTest.evt_time, 'arrow_down')
562 # self._event(FunctionalTest.evt_time, 'arrow_down')
563 # self._event(FunctionalTest.evt_time, 'arrow_down')
564 # self._event(FunctionalTest.evt_time, 'rcontrol')
565 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p3')
566 # self._event(FunctionalTest.evt_time, 'arrow_down')
567 # self._event(FunctionalTest.evt_time, 'arrow_down')
568 # self._event(FunctionalTest.evt_time, 'arrow_down')
569 # self._event(FunctionalTest.evt_time, 'arrow_down')
570 # self._event(FunctionalTest.evt_time, 'rcontrol')
571 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p4')
572 # self._event(FunctionalTest.evt_time, 'arrow_down')
573 # self._event(FunctionalTest.evt_time, 'arrow_down')
574 # self._event(FunctionalTest.evt_time, 'arrow_down')
575 # self._event(FunctionalTest.evt_time, 'arrow_down')
576 # self._event(FunctionalTest.evt_time, 'rcontrol')
577 # self._event(FunctionalTest.evt_time, 'arrow_down')
578 # self._event(FunctionalTest.evt_time, 'rcontrol')
579 # self._event(FunctionalTest.evt_time, 'arrow_down')
580 # self._event(FunctionalTest.evt_time, 'rcontrol')
581 # self._event(FunctionalTest.evt_time, 'arrow_down')
582 # self._event(FunctionalTest.evt_time, 'rcontrol')
583 # self._event(FunctionalTest.evt_time, 'arrow_down')
584 # self._event(FunctionalTest.evt_time, 'rcontrol')
585 # self._event(FunctionalTest.evt_time, 'arrow_down')
586 # self._event(FunctionalTest.evt_time, 'rcontrol')
587 # self._event(FunctionalTest.evt_time, 'arrow_up')
588 # self._event(FunctionalTest.evt_time, 'arrow_up')
590 # def _do_screenshots_game(self):
592 # self._event(FunctionalTest.evt_time, 'rcontrol')
593 # self._screenshot(FunctionalTest.screenshot_time, 'single_player_menu')
594 # self._event(FunctionalTest.evt_time, 'rcontrol')
595 # self._screenshot(FunctionalTest.screenshot_time, 'track_page')
596 # self._event(FunctionalTest.evt_time, 'rcontrol')
597 # self._screenshot(FunctionalTest.screenshot_time, 'car_page_start')
598 # self._event(FunctionalTest.evt_time, 'arrow_left')
599 # self._screenshot(FunctionalTest.screenshot_time, 'car_page_sel')
600 # self._event(FunctionalTest.evt_time, 'rcontrol')
601 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_start')
602 # self._event(FunctionalTest.evt_time, 'arrow_down')
603 # self._event(FunctionalTest.evt_time, 'arrow_down')
604 # self._event(FunctionalTest.evt_time, 'rcontrol')
605 # self._event(FunctionalTest.evt_time, 'arrow_down')
606 # self._event(FunctionalTest.evt_time, 'arrow_down')
607 # self._event(FunctionalTest.evt_time, 'rcontrol')
608 # self._event(FunctionalTest.evt_time, 'arrow_down')
609 # self._event(FunctionalTest.evt_time, 'rcontrol')
610 # self._event(FunctionalTest.evt_time, 'arrow_up')
611 # self._event(FunctionalTest.evt_time, 'rcontrol')
612 # self._event(FunctionalTest.evt_time, 'rcontrol')
613 # self._event(FunctionalTest.evt_time, 'arrow_left')
614 # self._event(FunctionalTest.evt_time, 'rcontrol')
615 # self._event(FunctionalTest.evt_time, 'rcontrol')
616 # self._event(FunctionalTest.evt_time, 'rcontrol')
617 # self._event(FunctionalTest.evt_time, 'rcontrol')
618 # self._event(FunctionalTest.evt_time, 'rcontrol')
619 # self._event(FunctionalTest.evt_time, 'arrow_left')
620 # self._event(FunctionalTest.evt_time, 'rcontrol')
621 # self._event(FunctionalTest.evt_time, 'arrow_up')
622 # self._event(FunctionalTest.evt_time, 'rcontrol')
623 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry')
624 # self._event(FunctionalTest.evt_time, 'backspace')
625 # self._event(FunctionalTest.evt_time, 'backspace')
626 # self._event(FunctionalTest.evt_time, 'backspace')
627 # self._event(FunctionalTest.evt_time, 'backspace')
628 # self._event(FunctionalTest.evt_time, 'backspace')
629 # self._event(FunctionalTest.evt_time, 'backspace')
630 # self._event(FunctionalTest.evt_time, 'backspace')
631 # self._event(FunctionalTest.evt_time, 'backspace')
632 # self._event(FunctionalTest.evt_time, 'backspace')
633 # self._event(FunctionalTest.evt_time, 'backspace')
634 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_empty')
635 # self._event(FunctionalTest.evt_time, 'f')
636 # self._event(FunctionalTest.evt_time, 'l')
637 # self._event(FunctionalTest.evt_time, 'a')
638 # self._event(FunctionalTest.evt_time, 'v')
639 # self._event(FunctionalTest.evt_time, 'i')
640 # self._event(FunctionalTest.evt_time, 'o')
641 # self._event(FunctionalTest.evt_time, 'enter')
642 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_full')
643 # self._event(FunctionalTest.evt_time, 'arrow_down')
644 # self._event(FunctionalTest.evt_time, 'arrow_right')
645 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_sel')
647 # self._event(FunctionalTest.evt_time, 'rcontrol')
648 # self._event(40, 'escape-up')
649 # self._screenshot(FunctionalTest.screenshot_time, 'ingame_menu')
650 # self._event(FunctionalTest.evt_time, 'rcontrol')
651 # self._screenshot(FunctionalTest.screenshot_time, 'race_back')
652 # self._event(FunctionalTest.evt_time, 'escape-up')
653 # self._event(FunctionalTest.evt_time, 'arrow_down')
654 # self._screenshot(FunctionalTest.screenshot_time, 'ingame_sel')
655 # self._event(FunctionalTest.evt_time, 'rcontrol')
656 # self._screenshot(FunctionalTest.screenshot_time, 'main_page_back_race')
658 # def _do_screenshots_end(self):
659 # self._event(FunctionalTest.evt_time, 'arrow_down')
660 # self._event(FunctionalTest.evt_time, 'arrow_down')
661 # self._event(FunctionalTest.evt_time, 'arrow_down')
662 # self._event(FunctionalTest.evt_time, 'arrow_down')
663 # self._event(FunctionalTest.evt_time, 'arrow_down')
664 # self._event(FunctionalTest.evt_time, 'rcontrol')
665 # self._screenshot(FunctionalTest.screenshot_time, 'exit_page')
666 # self._event(FunctionalTest.evt_time, 'arrow_down')
667 # self._screenshot(FunctionalTest.screenshot_time, 'exit_page_sel')
669 # self._event(FunctionalTest.evt_time, 'rcontrol')
672 def _do_screenshots(self
, idx
):
673 [self
._do
_screenshots
_1, self
._do
_screenshots
_2][int(idx
) - 1]()