2 from os
import getcwd
, system
3 from logging
import debug
, info
4 from pathlib
import Path
5 from shutil
import rmtree
6 from os
import makedirs
7 from os
.path
import join
, exists
10 from multiprocessing
.connection
import Listener
11 from threading
import Thread
12 from panda3d
.core
import Filename
13 from direct
.gui
.OnscreenText
import OnscreenText
14 from ya2
.patterns
.gameobject
import GameObject
15 from ya2
.build
.build
import _branch
18 class ListenerThread(Thread
):
20 def __init__(self
, callbacks
):
22 address
= ('localhost', 6000)
23 self
._listener
= Listener(address
)
24 self
._listener
._listener
._socket
.settimeout(15)
26 self
._conn
= self
._listener
.accept()
28 info('listener timeout')
29 self
._callbacks
= callbacks
32 running
= hasattr(self
, '_conn')
35 msg
= self
._conn
.recv()
36 if msg
[0] == 'screenshot':
37 taskMgr
.doMethodLater(.01, self
._callbacks
[0], 'cb0', [msg
[1]])
38 elif msg
[0] == 'enforce_res':
39 taskMgr
.doMethodLater(.01, self
._callbacks
[1], 'cb1', [msg
[1]])
40 elif msg
[0] == 'verify':
41 taskMgr
.doMethodLater(.01, self
._callbacks
[2], 'cb2')
42 elif msg
[0] == 'set_idx':
43 taskMgr
.doMethodLater(.01, self
._callbacks
[3], 'cb3', [msg
[1]])
44 elif msg
[0] == 'enforce_resolution':
45 taskMgr
.doMethodLater(.01, self
._callbacks
[4], 'cb4', [msg
[1]])
50 class FunctionalTest(GameObject
):
52 def __init__(self
, ref
):
54 self
._listener
= ListenerThread([self
._do
_screenshot
, self
._do
_enforce
_res
, self
.__verify
, self
._set
_idx
, self
._do
_enforce
_resolution
])
55 self
._listener
.start()
56 self
.txt
= OnscreenText('', fg
=(1, 0, 0, 1), scale
=.16)
58 #if self.eng.is_appimage:
59 self
._path
= str(Filename().get_user_appdata_directory())
60 self
._path
+= '/pmachines/'
61 self
._path
+= 'tests/functional%s/' % ('_ref' if ref
else '')
62 home
= '/home/flavio' # we must force this for wine
63 # if self._path.startswith('/c/users/') and exists(str(Path.home()) + '/.local/share/flatpak-wine601/default/'):
64 # self._path = str(Path.home()) + '/.local/share/flatpak-wine601/default/drive_' + self._path[1:]
65 if self
._path
.startswith('/c/users/') and exists(home
+ '/.wine/'):
66 self
._path
= home
+ '/.wine/drive_' + self
._path
[1:]
69 Filename().get_user_appdata_directory(),
70 'pmachines/tests/functional_ref_%s/' % _branch())
72 #taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
73 #self._do_screenshots(idx)
75 def _set_idx(self
, idx
):
77 rmtree(self
._path
, ignore_errors
=True)
78 info('creating dir: %s' % self
._path
)
79 makedirs(self
._path
, exist_ok
=True)
81 def _do_screenshot(self
, name
):
82 self
._fnames
+= [self
._path
+ name
]
83 #time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
84 #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
85 #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
86 res
= base
.screenshot(self
._path
+ name
, False)
87 info('screenshot %s (%s; %s)' % (self
._path
+ name
, res
, getcwd()))
89 def _do_enforce_res(self
, res
):
90 info('enforce_res %s' % res
)
91 messenger
.send('enforce_res', [res
])
93 def _do_enforce_resolution(self
, res
):
94 info('enforce resolution %s (callback)' % res
)
95 messenger
.send('enforce_resolution', [res
])
97 #def _screenshot(self, time, name):
98 #self._fnames += [self._path + name + '.png']
100 # self._curr_time + time,
101 # lambda: self._do_screenshot(self._path + name + '.png'),
102 # 'screenshot: %s' % name)]
104 # self.txt['text'] = name
105 # (self.txt.show if show_hide else self.txt.hide)()
107 # self._curr_time + time + .1,
109 # 'screenshot: %s (show)' % name)]
111 # self._curr_time + time + FunctionalTest.evt_time - .1,
112 # lambda: txt(False),
113 # 'screenshot: %s (hide)' % name)]
114 #self._curr_time += time
116 #def __keypress(self, key):
117 #'''Emulates a keypress'''
118 #dev = base.win.getInputDevice(0)
122 #def __char_entered(self, char):
123 #'''Emulates a character being entered.'''
124 #dev = base.win.getInputDevice(0)
125 #dev.keystroke(ord(char))
127 # def _event(self, time, evt, messenger_evt=False, append_up=True, mouse_args=None):
128 # def _append_up(evt_name):
129 # return evt + ('' if evt.endswith('-up') or not append_up else '-up')
130 # def cback_char(_evt):
131 # self.__char_entered(_evt)
132 # def cback_keyp(_evt):
133 # self.__keypress(_evt)
134 # self.__keypress('raw-' + _evt)
135 # cback = lambda: (cback_char(evt) if len(evt) == 1 else cback_keyp(evt))
136 # if evt in ['mousemove', 'mouseclick', 'mousedrag']:
137 # if evt == 'mousemove':
138 # cback = lambda: self.__mouse_move(*mouse_args)
139 # elif evt == 'mouseclick':
140 # cback = lambda: self.__mouse_click(*mouse_args)
141 # elif evt == 'mousedrag':
142 # cback = lambda: self.__mouse_drag(*mouse_args)
144 # cback = lambda: messenger.send(_append_up(evt))
146 # self._curr_time + time,
148 # 'event: %s' % evt)]
149 # def txt(show_hide):
150 # self.txt['text'] = evt
151 # (self.txt.show if show_hide else self.txt.hide)()
153 # self._curr_time + time + .2,
155 # 'event: %s (show)' % evt)]
157 # self._curr_time + time + .8,
158 # lambda: txt(False),
159 # 'event: %s (hide)' % evt)]
160 # self._curr_time += time
162 # def _enforce_res(self, time, res):
163 # cback = lambda: messenger.send('enforce_res', [res])
165 # self._curr_time + time,
167 # 'enforce res: %s' % res)]
168 # self._curr_time += time
170 def __verify(self
, task
):
171 files
= glob(self
._path
+ '*')
172 for fname
in self
._fnames
:
173 info('verifying %s' % fname
)
176 #def on_frame_unpausable(self, task):
177 #self._process_conn()
178 #for tsk in self._tasks:
179 # #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
180 # if self._prev_time <= tsk[0] < globalClock.getFrameTime():
181 # debug('%s %s' % (tsk[0], tsk[2]))
183 #self._prev_time = globalClock.getFrameTime() # self.eng.event.unpaused_time
186 # def _do_screenshots_1(self):
187 # info('_do_screenshots_1')
188 # self._screenshot(FunctionalTest.start_time, 'main_menu')
189 # self._do_screenshots_credits()
190 # self._do_screenshots_options()
191 # self._do_screenshots_exit()
193 # def _do_screenshots_credits(self):
194 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])
195 # self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
196 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])
197 # self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits')
199 # # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
200 # # self._event(FunctionalTest.evt_time, 'arrow_down')
201 # # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
202 # # self._event(FunctionalTest.evt_time, 'arrow_down')
203 # # self._screenshot(FunctionalTest.screenshot_time, 'main_menu_highlight')
204 # # self._event(FunctionalTest.evt_time, 'rcontrol')
205 # # self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
206 # # # go to supporters
207 # # self._event(FunctionalTest.evt_time, 'joypad0-face_a', True)
208 # # self._screenshot(FunctionalTest.screenshot_time, 'supporters_menu')
210 # # self._event(FunctionalTest.evt_time, 'rcontrol')
211 # # self._event(FunctionalTest.evt_time, 'joypad0-face_b', True)
212 # # self._event(FunctionalTest.evt_time, 'arrow_up')
213 # # self._event(FunctionalTest.evt_time, 'arrow_up')
214 # # self._event(FunctionalTest.evt_time, 'arrow_up')
215 # # self._event(FunctionalTest.evt_time, 'arrow_up')
217 # def _do_screenshots_options(self):
218 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 300), 'left'])
219 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
221 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 60), 'left'])
222 # self._screenshot(FunctionalTest.screenshot_time, 'open_languages')
223 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(980, 120), 'left'])
224 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
226 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(740, 163), 'left'])
227 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
229 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 440), 'left'])
230 # self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
232 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 540), 'left'])
233 # self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
234 # # test aa and shadows
235 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left']) # back
236 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left']) # play
237 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left']) # domino
238 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(900, 490), 'left']) # close instructions
239 # self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
240 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(25, 740), 'left']) # home
242 # def _do_screenshots_restore_options(self):
243 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 300), 'left'])
244 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
246 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 60), 'left'])
247 # self._screenshot(FunctionalTest.screenshot_time, 'open_languages_restored')
248 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(980, 20), 'left'])
249 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
251 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(719, 163), 'left'])
252 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
254 # # the first one is because of the windowed mode in test
255 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
256 # # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
257 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
258 # # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
259 # # self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
260 # # self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
262 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 340), 'left'])
263 # # self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
264 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1020, 160), 'left'])
265 # # self._screenshot(FunctionalTest.screenshot_time, '1440x900')
266 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(740, 400), 'left'])
267 # # self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
268 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1110, 80), 'left'])
269 # # self._screenshot(FunctionalTest.screenshot_time, '1360x768')
271 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 440), 'left'])
272 # self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_yes')
274 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 540), 'left'])
275 # self._screenshot(FunctionalTest.screenshot_time, 'shadows_yes')
276 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left']) # back
279 # # self._event(FunctionalTest.evt_time, 'arrow_down')
280 # # self._event(FunctionalTest.evt_time, 'arrow_down')
281 # # self._event(FunctionalTest.evt_time, 'rcontrol')
282 # # self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
284 # # self._event(FunctionalTest.evt_time, 'rcontrol')
285 # # self._screenshot(FunctionalTest.screenshot_time, 'language_open')
286 # # self._event(FunctionalTest.evt_time, 'arrow_down')
287 # # self._screenshot(FunctionalTest.screenshot_time, 'language_highlight')
288 # # self._event(FunctionalTest.evt_time, 'rcontrol')
289 # # self._screenshot(FunctionalTest.screenshot_time, 'language_it')
291 # # self._event(FunctionalTest.evt_time, 'arrow_down')
292 # # self._event(FunctionalTest.evt_time, 'arrow_right')
293 # # self._event(FunctionalTest.evt_time, 'arrow_right')
294 # # self._screenshot(FunctionalTest.screenshot_time, 'volume')
296 # # self._event(FunctionalTest.evt_time, 'arrow_down')
297 # # self._event(FunctionalTest.evt_time, 'rcontrol')
298 # # self._screenshot(FunctionalTest.screenshot_time, 'cars_open')
299 # # self._event(FunctionalTest.evt_time, 'rcontrol')
300 # # self._screenshot(FunctionalTest.screenshot_time, 'cars_changed')
302 # # self._event(FunctionalTest.evt_time, 'arrow_down')
303 # # self._event(FunctionalTest.evt_time, 'arrow_down')
304 # # self._event(FunctionalTest.evt_time, 'arrow_down')
305 # # self._event(FunctionalTest.evt_time, 'rcontrol')
306 # # self._event(FunctionalTest.evt_time, 'arrow_up')
307 # # self._event(FunctionalTest.evt_time, 'arrow_up')
309 # def _do_screenshots_play(self):
310 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left']) # play
311 # self._screenshot(FunctionalTest.screenshot_time, 'play_menu')
312 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left']) # back
313 # self._screenshot(FunctionalTest.screenshot_time, 'back_from_play')
314 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left']) # play
315 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left']) # domino scene
316 # self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_instructions')
317 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
318 # self._screenshot(FunctionalTest.screenshot_time, 'scene_domino')
319 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(25, 740), 'left']) # home
320 # self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_scene')
321 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left']) # play
322 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left']) # domino
323 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
324 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(70, 740), 'left']) # info
325 # self._screenshot(FunctionalTest.screenshot_time, 'info')
326 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
327 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (430, 280), 'left']) # drag a piece
328 # self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
329 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1220, 740), 'left']) # rewind
330 # self._screenshot(FunctionalTest.screenshot_time, 'rewind')
331 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (550, 380), 'left']) # drag a piece
332 # # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left']) # drag a piece
333 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
334 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino')
335 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(630, 450), 'left']) # home
336 # self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
337 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left']) # play
338 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left']) # domino
339 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left']) # close instructions
340 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (550, 380), 'left']) # drag a piece
341 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left']) # drag a piece
342 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
343 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2')
344 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left']) # replay
345 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (570, 380), 'left']) # drag a piece
346 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(570, 355), (605, 355), 'right']) # rotate the piece
347 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left']) # drag a piece
348 # self._enforce_res(FunctionalTest.evt_time, 'win')
349 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
350 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino')
351 # self._enforce_res(FunctionalTest.evt_time, '')
352 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left']) # next
353 # self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
355 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 490), 'left']) # close instructions
356 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 620), 'left']) # drag a box
357 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 540), 'left']) # drag a box
358 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
359 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box')
360 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left']) # replay
361 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 620), 'left']) # drag a box
362 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 540), 'left']) # drag a box
363 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (705, 460), 'left']) # drag a box
364 # self._enforce_res(FunctionalTest.evt_time, 'win')
365 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
366 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box')
367 # self._enforce_res(FunctionalTest.evt_time, '')
368 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left']) # next
369 # self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
371 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(930, 485), 'left']) # close instructions
372 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 440), 'left']) # drag a box
373 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 360), 'left']) # drag a box
374 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
375 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino')
376 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left']) # replay
377 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 440), 'left']) # drag a box
378 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (835, 250), 'left']) # drag a box
379 # self._enforce_res(FunctionalTest.evt_time, 'win')
380 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
381 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box_domino')
382 # self._enforce_res(FunctionalTest.evt_time, '')
383 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left']) # next
384 # self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
386 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(870, 490), 'left']) # close instructions
387 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(55, 50), (650, 310), 'left']) # drag a ball
388 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
389 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball')
390 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left']) # replay
391 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(55, 50), (380, 50), 'left']) # drag a ball
392 # self._enforce_res(FunctionalTest.evt_time, 'win')
393 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
394 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_basketball')
395 # self._enforce_res(FunctionalTest.evt_time, '')
396 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left']) # next
397 # self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
399 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(865, 490), 'left']) # close instructions
400 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (580, 440), 'left']) # drag a box
401 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 60), (590, 370), 'left']) # drag a piece
402 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
403 # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
404 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left']) # replay
405 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (580, 440), 'left']) # drag a box
406 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 60), (660, 440), 'left']) # drag a piece
407 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(660, 425), (625, 425), 'right']) # rotate a piece
408 # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(660, 435), (650, 445), 'left']) # drag a piece
409 # self._enforce_res(FunctionalTest.evt_time, 'win')
410 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left']) # play
411 # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino_box_basketball')
412 # self._enforce_res(FunctionalTest.evt_time, '')
413 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left']) # next
414 # # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
416 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left']) # close instructions
417 # # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 300), 'left']) # drag a box
418 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
419 # # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
420 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left']) # replay
421 # # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 150), 'left']) # drag a box
422 # # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(515, 115), (515, 122), 'right']) # rotate a box
423 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
424 # # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
425 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left']) # next
426 # # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
428 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 455), 'left']) # close instructions
429 # # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (155, 180), 'left']) # drag a box
430 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
431 # # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
432 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left']) # replay
433 # # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (170, 80), 'left']) # drag a box
434 # # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(195, 50), (195, 80), 'right']) # rotate a box
435 # # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left']) # play
436 # # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
437 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(630, 450), 'left']) # home
438 # self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
440 # def _do_screenshots_exit(self):
441 # # self._event(FunctionalTest.evt_time, 'arrow_down')
442 # # self._event(FunctionalTest.evt_time, 'arrow_down')
443 # # self._event(FunctionalTest.evt_time, 'arrow_down')
444 # # self._event(FunctionalTest.evt_time, 'arrow_down')
445 # # self._event(FunctionalTest.evt_time, 'arrow_down')
446 # # self._event(FunctionalTest.evt_time, 'rcontrol')
447 # # self._event(FunctionalTest.evt_time, 'arrow_down')
449 # # self._event(FunctionalTest.evt_time, 'rcontrol')
451 # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 600), 'left'])
454 # def _do_screenshots_2(self):
455 # info('_do_screenshots_2')
456 # self._screenshot(FunctionalTest.start_time, 'main_menu_2')
457 # self._do_screenshots_restore_options()
458 # self._do_screenshots_play()
459 # self._do_screenshots_exit()
460 # # self._do_screenshots_game()
461 # # self._do_screenshots_end()
463 # # def _do_screenshots_restore_options(self):
465 # # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
466 # # self._event(FunctionalTest.evt_time, 'arrow_down')
467 # # self._event(FunctionalTest.evt_time, 'rcontrol')
468 # # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
470 # # self._event(FunctionalTest.evt_time, 'rcontrol')
471 # # self._event(FunctionalTest.evt_time, 'arrow_up')
472 # # self._event(FunctionalTest.evt_time, 'rcontrol')
473 # # self._screenshot(FunctionalTest.screenshot_time, 'language_en_restored')
475 # # self._event(FunctionalTest.evt_time, 'arrow_down')
476 # # self._event(FunctionalTest.evt_time, 'arrow_left')
477 # # self._event(FunctionalTest.evt_time, 'arrow_left')
478 # # self._screenshot(FunctionalTest.screenshot_time, 'volume_restored')
480 # # self._event(FunctionalTest.evt_time, 'arrow_down')
481 # # self._event(FunctionalTest.evt_time, 'rcontrol')
482 # # self._event(FunctionalTest.evt_time, 'arrow_down')
483 # # self._event(FunctionalTest.evt_time, 'arrow_down')
484 # # self._event(FunctionalTest.evt_time, 'arrow_down')
485 # # self._event(FunctionalTest.evt_time, 'arrow_down')
486 # # self._event(FunctionalTest.evt_time, 'rcontrol')
487 # # self._screenshot(FunctionalTest.screenshot_time, 'cars_restored')
488 # # # graphics settings
489 # # self._event(FunctionalTest.evt_time, 'arrow_down')
490 # # self._event(FunctionalTest.evt_time, 'rcontrol')
491 # # self._screenshot(FunctionalTest.screenshot_time, 'graphics_settings')
492 # # self._event(FunctionalTest.evt_time, 'arrow_down')
493 # # self._event(FunctionalTest.evt_time, 'arrow_down')
494 # # self._event(FunctionalTest.evt_time, 'rcontrol')
495 # # self._screenshot(FunctionalTest.screenshot_time, 'antialiasing')
496 # # self._event(FunctionalTest.evt_time, 'rcontrol')
497 # # self._event(FunctionalTest.evt_time, 'arrow_down')
498 # # self._event(FunctionalTest.evt_time, 'rcontrol')
499 # # self._screenshot(FunctionalTest.screenshot_time, 'shadows')
500 # # self._event(FunctionalTest.evt_time, 'rcontrol')
501 # # self._event(FunctionalTest.evt_time, 'arrow_down')
502 # # self._event(FunctionalTest.evt_time, 'rcontrol')
503 # # self._screenshot(FunctionalTest.screenshot_time, 'fog')
504 # # self._event(FunctionalTest.evt_time, 'rcontrol')
505 # # self._event(FunctionalTest.evt_time, 'arrow_down')
506 # # self._event(FunctionalTest.evt_time, 'rcontrol')
507 # # self._screenshot(FunctionalTest.screenshot_time, 'normal_mapping')
508 # # self._event(FunctionalTest.evt_time, 'rcontrol')
509 # # self._event(FunctionalTest.evt_time, 'arrow_down')
510 # # self._event(FunctionalTest.evt_time, 'rcontrol')
511 # # self._screenshot(FunctionalTest.screenshot_time, 'occlusion')
512 # # self._event(FunctionalTest.evt_time, 'rcontrol')
513 # # self._event(FunctionalTest.evt_time, 'arrow_down')
514 # # self._event(FunctionalTest.evt_time, 'rcontrol')
516 # # self._event(FunctionalTest.evt_time, 'arrow_down')
517 # # self._event(FunctionalTest.evt_time, 'rcontrol')
518 # # self._screenshot(FunctionalTest.screenshot_time, 'input')
519 # # self._event(FunctionalTest.evt_time, 'rcontrol')
520 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1')
521 # # self._event(FunctionalTest.evt_time, 'rcontrol')
522 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_rec')
523 # # self._event(FunctionalTest.evt_time, '8', True, False)
524 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_changed')
525 # # self._event(FunctionalTest.evt_time, 'rcontrol')
526 # # self._event(FunctionalTest.evt_time, 'arrow_up', True, False)
527 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_restored')
528 # # self._event(FunctionalTest.evt_time, 'rcontrol')
529 # # self._event(FunctionalTest.evt_time, 'w', True, False)
530 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already')
531 # # self._event(FunctionalTest.evt_time, 'rcontrol')
532 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already_closed')
533 # # self._event(FunctionalTest.evt_time, 'arrow_down')
534 # # self._event(FunctionalTest.evt_time, 'arrow_down')
535 # # self._event(FunctionalTest.evt_time, 'arrow_down')
536 # # self._event(FunctionalTest.evt_time, 'arrow_down')
537 # # self._event(FunctionalTest.evt_time, 'rcontrol')
538 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p2')
539 # # self._event(FunctionalTest.evt_time, 'arrow_down')
540 # # self._event(FunctionalTest.evt_time, 'arrow_down')
541 # # self._event(FunctionalTest.evt_time, 'arrow_down')
542 # # self._event(FunctionalTest.evt_time, 'arrow_down')
543 # # self._event(FunctionalTest.evt_time, 'rcontrol')
544 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p3')
545 # # self._event(FunctionalTest.evt_time, 'arrow_down')
546 # # self._event(FunctionalTest.evt_time, 'arrow_down')
547 # # self._event(FunctionalTest.evt_time, 'arrow_down')
548 # # self._event(FunctionalTest.evt_time, 'arrow_down')
549 # # self._event(FunctionalTest.evt_time, 'rcontrol')
550 # # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p4')
551 # # self._event(FunctionalTest.evt_time, 'arrow_down')
552 # # self._event(FunctionalTest.evt_time, 'arrow_down')
553 # # self._event(FunctionalTest.evt_time, 'arrow_down')
554 # # self._event(FunctionalTest.evt_time, 'arrow_down')
555 # # self._event(FunctionalTest.evt_time, 'rcontrol')
556 # # self._event(FunctionalTest.evt_time, 'arrow_down')
557 # # self._event(FunctionalTest.evt_time, 'rcontrol')
558 # # self._event(FunctionalTest.evt_time, 'arrow_down')
559 # # self._event(FunctionalTest.evt_time, 'rcontrol')
560 # # self._event(FunctionalTest.evt_time, 'arrow_down')
561 # # self._event(FunctionalTest.evt_time, 'rcontrol')
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, 'rcontrol')
566 # # self._event(FunctionalTest.evt_time, 'arrow_up')
567 # # self._event(FunctionalTest.evt_time, 'arrow_up')
569 # # def _do_screenshots_game(self):
571 # # self._event(FunctionalTest.evt_time, 'rcontrol')
572 # # self._screenshot(FunctionalTest.screenshot_time, 'single_player_menu')
573 # # self._event(FunctionalTest.evt_time, 'rcontrol')
574 # # self._screenshot(FunctionalTest.screenshot_time, 'track_page')
575 # # self._event(FunctionalTest.evt_time, 'rcontrol')
576 # # self._screenshot(FunctionalTest.screenshot_time, 'car_page_start')
577 # # self._event(FunctionalTest.evt_time, 'arrow_left')
578 # # self._screenshot(FunctionalTest.screenshot_time, 'car_page_sel')
579 # # self._event(FunctionalTest.evt_time, 'rcontrol')
580 # # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_start')
581 # # self._event(FunctionalTest.evt_time, 'arrow_down')
582 # # self._event(FunctionalTest.evt_time, 'arrow_down')
583 # # self._event(FunctionalTest.evt_time, 'rcontrol')
584 # # self._event(FunctionalTest.evt_time, 'arrow_down')
585 # # self._event(FunctionalTest.evt_time, 'arrow_down')
586 # # self._event(FunctionalTest.evt_time, 'rcontrol')
587 # # self._event(FunctionalTest.evt_time, 'arrow_down')
588 # # self._event(FunctionalTest.evt_time, 'rcontrol')
589 # # self._event(FunctionalTest.evt_time, 'arrow_up')
590 # # self._event(FunctionalTest.evt_time, 'rcontrol')
591 # # self._event(FunctionalTest.evt_time, 'rcontrol')
592 # # self._event(FunctionalTest.evt_time, 'arrow_left')
593 # # self._event(FunctionalTest.evt_time, 'rcontrol')
594 # # self._event(FunctionalTest.evt_time, 'rcontrol')
595 # # self._event(FunctionalTest.evt_time, 'rcontrol')
596 # # self._event(FunctionalTest.evt_time, 'rcontrol')
597 # # self._event(FunctionalTest.evt_time, 'rcontrol')
598 # # self._event(FunctionalTest.evt_time, 'arrow_left')
599 # # self._event(FunctionalTest.evt_time, 'rcontrol')
600 # # self._event(FunctionalTest.evt_time, 'arrow_up')
601 # # self._event(FunctionalTest.evt_time, 'rcontrol')
602 # # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry')
603 # # self._event(FunctionalTest.evt_time, 'backspace')
604 # # self._event(FunctionalTest.evt_time, 'backspace')
605 # # self._event(FunctionalTest.evt_time, 'backspace')
606 # # self._event(FunctionalTest.evt_time, 'backspace')
607 # # self._event(FunctionalTest.evt_time, 'backspace')
608 # # self._event(FunctionalTest.evt_time, 'backspace')
609 # # self._event(FunctionalTest.evt_time, 'backspace')
610 # # self._event(FunctionalTest.evt_time, 'backspace')
611 # # self._event(FunctionalTest.evt_time, 'backspace')
612 # # self._event(FunctionalTest.evt_time, 'backspace')
613 # # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_empty')
614 # # self._event(FunctionalTest.evt_time, 'f')
615 # # self._event(FunctionalTest.evt_time, 'l')
616 # # self._event(FunctionalTest.evt_time, 'a')
617 # # self._event(FunctionalTest.evt_time, 'v')
618 # # self._event(FunctionalTest.evt_time, 'i')
619 # # self._event(FunctionalTest.evt_time, 'o')
620 # # self._event(FunctionalTest.evt_time, 'enter')
621 # # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_full')
622 # # self._event(FunctionalTest.evt_time, 'arrow_down')
623 # # self._event(FunctionalTest.evt_time, 'arrow_right')
624 # # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_sel')
626 # # self._event(FunctionalTest.evt_time, 'rcontrol')
627 # # self._event(40, 'escape-up')
628 # # self._screenshot(FunctionalTest.screenshot_time, 'ingame_menu')
629 # # self._event(FunctionalTest.evt_time, 'rcontrol')
630 # # self._screenshot(FunctionalTest.screenshot_time, 'race_back')
631 # # self._event(FunctionalTest.evt_time, 'escape-up')
632 # # self._event(FunctionalTest.evt_time, 'arrow_down')
633 # # self._screenshot(FunctionalTest.screenshot_time, 'ingame_sel')
634 # # self._event(FunctionalTest.evt_time, 'rcontrol')
635 # # self._screenshot(FunctionalTest.screenshot_time, 'main_page_back_race')
637 # # def _do_screenshots_end(self):
638 # # self._event(FunctionalTest.evt_time, 'arrow_down')
639 # # self._event(FunctionalTest.evt_time, 'arrow_down')
640 # # self._event(FunctionalTest.evt_time, 'arrow_down')
641 # # self._event(FunctionalTest.evt_time, 'arrow_down')
642 # # self._event(FunctionalTest.evt_time, 'arrow_down')
643 # # self._event(FunctionalTest.evt_time, 'rcontrol')
644 # # self._screenshot(FunctionalTest.screenshot_time, 'exit_page')
645 # # self._event(FunctionalTest.evt_time, 'arrow_down')
646 # # self._screenshot(FunctionalTest.screenshot_time, 'exit_page_sel')
648 # # self._event(FunctionalTest.evt_time, 'rcontrol')
651 # def _do_screenshots(self, idx):
652 # [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]()