ya2 · news · projects · code · about

functional tests: options
[pmachines.git] / lib / engine / functional.py
1 '''Create ref:
2 * M-x fla-set-fun-test
3 * rm options.ini
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'''
7 import datetime
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
14 from glob import glob
15 from sys import exit
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
20
21
22 class FunctionalTest(GameObject):
23
24 screenshot_time = 1.2
25 evt_time = 1.0
26 start_time = 2
27
28 def __init__(self, idx, ref):
29 super().__init__()
30 self.txt = OnscreenText('', fg=(1, 0, 0, 1), scale=.16)
31 #self._path = ''
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:]
41 if ref:
42 self._path = join(
43 Filename().get_user_appdata_directory(),
44 'pmachines/tests/functional_ref_%s/' % _branch())
45 self._curr_time = 0
46 if int(idx) == 1:
47 rmtree(self._path, ignore_errors=True)
48 info('creating dir: %s' % self._path)
49 makedirs(self._path, exist_ok=True)
50 self._fnames = []
51 self._tasks = []
52 self._prev_time = 0
53 #self.eng.attach_obs(self.on_frame_unpausable)
54 taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
55 self._do_screenshots(idx)
56
57 def _do_screenshot(self, path=None):
58 time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
59 #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
60 #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
61 res = base.screenshot(path or ("pmachines%s.png" % time), False)
62 info('screenshot %s (%s; %s)' % (path or ("pmachines%s.png" % time), res, getcwd()))
63
64 def _screenshot(self, time, name):
65 self._fnames += [self._path + name + '.png']
66 self._tasks += [(
67 self._curr_time + time,
68 lambda: self._do_screenshot(self._path + name + '.png'),
69 'screenshot: %s' % name)]
70 def txt(show_hide):
71 self.txt['text'] = name
72 (self.txt.show if show_hide else self.txt.hide)()
73 self._tasks += [(
74 self._curr_time + time + .1,
75 lambda: txt(True),
76 'screenshot: %s (show)' % name)]
77 self._tasks += [(
78 self._curr_time + time + FunctionalTest.evt_time - .1,
79 lambda: txt(False),
80 'screenshot: %s (hide)' % name)]
81 self._curr_time += time
82
83 def __keypress(self, key):
84 '''Emulates a keypress'''
85 dev = base.win.getInputDevice(0)
86 dev.buttonDown(key)
87 dev.buttonUp(key)
88
89 def __char_entered(self, char):
90 '''Emulates a character being entered.'''
91 dev = base.win.getInputDevice(0)
92 dev.keystroke(ord(char))
93
94 def __mouse_click(self, pos, btn):
95 center = base.pipe.get_display_width() / 2, base.pipe.get_display_height() / 2
96 tgt = pos[0] + center[0], pos[1] + center[1]
97 btn = 3 if btn == 'right' else 1
98 system('xdotool mousemove %s %s click %s' % (tgt[0], tgt[1], btn))
99
100 def __mouse_move(self, pos):
101 center = base.pipe.get_display_width() / 2, base.pipe.get_display_height() / 2
102 tgt = pos[0] + center[0], pos[1] + center[1]
103 system('xdotool mousemove %s %s' % tgt)
104
105 def __mouse_drag(self, start, end, btn):
106 center = base.pipe.get_display_width() / 2, base.pipe.get_display_height() / 2
107 start = start[0] + center[0], start[1] + center[1]
108 end = end[0] + center[0], end[1] + center[1]
109 btn = 3 if btn == 'right' else 1
110 system('xdotool mousemove %s %s mousedown %s mousemove %s %s mouseup %s' % (
111 start[0], start[1], btn, end[0], end[1], btn))
112
113 def _event(self, time, evt, messenger_evt=False, append_up=True, mouse_args=None):
114 def _append_up(evt_name):
115 return evt + ('' if evt.endswith('-up') or not append_up else '-up')
116 def cback_char(_evt):
117 self.__char_entered(_evt)
118 def cback_keyp(_evt):
119 self.__keypress(_evt)
120 self.__keypress('raw-' + _evt)
121 cback = lambda: (cback_char(evt) if len(evt) == 1 else cback_keyp(evt))
122 if evt in ['mousemove', 'mouseclick', 'mousedrag']:
123 if evt == 'mousemove':
124 cback = lambda: self.__mouse_move(*mouse_args)
125 elif evt == 'mouseclick':
126 cback = lambda: self.__mouse_click(*mouse_args)
127 elif evt == 'mousedrag':
128 cback = lambda: self.__mouse_drag(*mouse_args)
129 if messenger_evt:
130 cback = lambda: messenger.send(_append_up(evt))
131 self._tasks += [(
132 self._curr_time + time,
133 cback,
134 'event: %s' % evt)]
135 def txt(show_hide):
136 self.txt['text'] = evt
137 (self.txt.show if show_hide else self.txt.hide)()
138 self._tasks += [(
139 self._curr_time + time + .2,
140 lambda: txt(True),
141 'event: %s (show)' % evt)]
142 self._tasks += [(
143 self._curr_time + time + .8,
144 lambda: txt(False),
145 'event: %s (hide)' % evt)]
146 self._curr_time += time
147
148 def _verify(self):
149 def __verify():
150 files = glob(self._path + '*')
151 for fname in self._fnames:
152 info('verifying %s' % fname)
153 assert exists(fname)
154 self._tasks += [(
155 self._curr_time + 3,
156 lambda: __verify(),
157 'verify')]
158 self._curr_time += 3
159
160 def _exit(self):
161 self._tasks += [(
162 self._curr_time + 3,
163 lambda: exit(),
164 'exit')]
165
166 def on_frame_unpausable(self, task):
167 for tsk in self._tasks:
168 #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
169 if self._prev_time <= tsk[0] < globalClock.getFrameTime():
170 debug('%s %s' % (tsk[0], tsk[2]))
171 tsk[1]()
172 self._prev_time = globalClock.getFrameTime() # self.eng.event.unpaused_time
173 return task.cont
174
175 def _do_screenshots_1(self):
176 info('_do_screenshots_1')
177 self._screenshot(FunctionalTest.start_time, 'main_menu')
178 self._do_screenshots_credits()
179 self._do_screenshots_options()
180 self._do_screenshots_exit()
181
182 def _do_screenshots_credits(self):
183 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, 50), 'left'])
184 self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
185 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, 280), 'left'])
186 self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits')
187 # # go to credits
188 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
189 # self._event(FunctionalTest.evt_time, 'arrow_down')
190 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
191 # self._event(FunctionalTest.evt_time, 'arrow_down')
192 # self._screenshot(FunctionalTest.screenshot_time, 'main_menu_highlight')
193 # self._event(FunctionalTest.evt_time, 'rcontrol')
194 # self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
195 # # go to supporters
196 # self._event(FunctionalTest.evt_time, 'joypad0-face_a', True)
197 # self._screenshot(FunctionalTest.screenshot_time, 'supporters_menu')
198 # # back to main
199 # self._event(FunctionalTest.evt_time, 'rcontrol')
200 # self._event(FunctionalTest.evt_time, 'joypad0-face_b', True)
201 # self._event(FunctionalTest.evt_time, 'arrow_up')
202 # self._event(FunctionalTest.evt_time, 'arrow_up')
203 # self._event(FunctionalTest.evt_time, 'arrow_up')
204 # self._event(FunctionalTest.evt_time, 'arrow_up')
205
206 def _do_screenshots_options(self):
207 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -80), 'left'])
208 self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
209 # languages
210 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -300), 'left'])
211 self._screenshot(FunctionalTest.screenshot_time, 'open_languages_1')
212 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(280, -324), 'left'])
213 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
214 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -300), 'left'])
215 self._screenshot(FunctionalTest.screenshot_time, 'open_languages_2')
216 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(280, -240), 'left'])
217 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
218 # volume
219 self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(44, -207), (67, -207), 'left'])
220 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
221 self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(67, -207), (44, -207), 'left'])
222 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
223 # fullscreen
224 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -120), 'left'])
225 self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
226 self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(-320, -300), 'left'])
227 self._screenshot(FunctionalTest.screenshot_time, 'back_from_fullscreen')
228 # resolution
229 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -24), 'left'])
230 self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
231 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(314, 116), 'left'])
232 self._screenshot(FunctionalTest.screenshot_time, '1440x900')
233 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(98, 47), 'left'])
234 self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
235 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(478, 59), 'left'])
236 self._screenshot(FunctionalTest.screenshot_time, '1280x720')
237 # antialiasing
238 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 62), 'left'])
239 self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
240 # shadows
241 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 145), 'left'])
242 self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
243 # test aa and shadows
244 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, 270), 'left']) # back
245 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -230), 'left']) # play
246 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(-430, -210), 'left']) # domino
247 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(200, 100), 'left']) # close instructions
248 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(-620, 336), 'left']) # home
249 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -80), 'left']) # options
250 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 62), 'left']) # aa
251 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 145), 'left']) # shadows
252 self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
253 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, 270), 'left']) # back
254
255 # # go to options
256 # self._event(FunctionalTest.evt_time, 'arrow_down')
257 # self._event(FunctionalTest.evt_time, 'arrow_down')
258 # self._event(FunctionalTest.evt_time, 'rcontrol')
259 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
260 # # language
261 # self._event(FunctionalTest.evt_time, 'rcontrol')
262 # self._screenshot(FunctionalTest.screenshot_time, 'language_open')
263 # self._event(FunctionalTest.evt_time, 'arrow_down')
264 # self._screenshot(FunctionalTest.screenshot_time, 'language_highlight')
265 # self._event(FunctionalTest.evt_time, 'rcontrol')
266 # self._screenshot(FunctionalTest.screenshot_time, 'language_it')
267 # # volume
268 # self._event(FunctionalTest.evt_time, 'arrow_down')
269 # self._event(FunctionalTest.evt_time, 'arrow_right')
270 # self._event(FunctionalTest.evt_time, 'arrow_right')
271 # self._screenshot(FunctionalTest.screenshot_time, 'volume')
272 # # car's number
273 # self._event(FunctionalTest.evt_time, 'arrow_down')
274 # self._event(FunctionalTest.evt_time, 'rcontrol')
275 # self._screenshot(FunctionalTest.screenshot_time, 'cars_open')
276 # self._event(FunctionalTest.evt_time, 'rcontrol')
277 # self._screenshot(FunctionalTest.screenshot_time, 'cars_changed')
278 # # back
279 # self._event(FunctionalTest.evt_time, 'arrow_down')
280 # self._event(FunctionalTest.evt_time, 'arrow_down')
281 # self._event(FunctionalTest.evt_time, 'arrow_down')
282 # self._event(FunctionalTest.evt_time, 'rcontrol')
283 # self._event(FunctionalTest.evt_time, 'arrow_up')
284 # self._event(FunctionalTest.evt_time, 'arrow_up')
285
286 def _do_screenshots_exit(self):
287 # self._event(FunctionalTest.evt_time, 'arrow_down')
288 # self._event(FunctionalTest.evt_time, 'arrow_down')
289 # self._event(FunctionalTest.evt_time, 'arrow_down')
290 # self._event(FunctionalTest.evt_time, 'arrow_down')
291 # self._event(FunctionalTest.evt_time, 'arrow_down')
292 # self._event(FunctionalTest.evt_time, 'rcontrol')
293 # self._event(FunctionalTest.evt_time, 'arrow_down')
294 self._verify()
295 # self._event(FunctionalTest.evt_time, 'rcontrol')
296 # self._exit()
297 self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, 200), 'left'])
298
299
300 def _do_screenshots_2(self):
301 info('_do_screenshots_2')
302 # self._do_screenshots_restore_options()
303 # self._do_screenshots_game()
304 # self._do_screenshots_end()
305
306 # def _do_screenshots_restore_options(self):
307 # # go to options
308 # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
309 # self._event(FunctionalTest.evt_time, 'arrow_down')
310 # self._event(FunctionalTest.evt_time, 'rcontrol')
311 # self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
312 # # # language
313 # self._event(FunctionalTest.evt_time, 'rcontrol')
314 # self._event(FunctionalTest.evt_time, 'arrow_up')
315 # self._event(FunctionalTest.evt_time, 'rcontrol')
316 # self._screenshot(FunctionalTest.screenshot_time, 'language_en_restored')
317 # # # volume
318 # self._event(FunctionalTest.evt_time, 'arrow_down')
319 # self._event(FunctionalTest.evt_time, 'arrow_left')
320 # self._event(FunctionalTest.evt_time, 'arrow_left')
321 # self._screenshot(FunctionalTest.screenshot_time, 'volume_restored')
322 # # car's number
323 # self._event(FunctionalTest.evt_time, 'arrow_down')
324 # self._event(FunctionalTest.evt_time, 'rcontrol')
325 # self._event(FunctionalTest.evt_time, 'arrow_down')
326 # self._event(FunctionalTest.evt_time, 'arrow_down')
327 # self._event(FunctionalTest.evt_time, 'arrow_down')
328 # self._event(FunctionalTest.evt_time, 'arrow_down')
329 # self._event(FunctionalTest.evt_time, 'rcontrol')
330 # self._screenshot(FunctionalTest.screenshot_time, 'cars_restored')
331 # # graphics settings
332 # self._event(FunctionalTest.evt_time, 'arrow_down')
333 # self._event(FunctionalTest.evt_time, 'rcontrol')
334 # self._screenshot(FunctionalTest.screenshot_time, 'graphics_settings')
335 # self._event(FunctionalTest.evt_time, 'arrow_down')
336 # self._event(FunctionalTest.evt_time, 'arrow_down')
337 # self._event(FunctionalTest.evt_time, 'rcontrol')
338 # self._screenshot(FunctionalTest.screenshot_time, 'antialiasing')
339 # self._event(FunctionalTest.evt_time, 'rcontrol')
340 # self._event(FunctionalTest.evt_time, 'arrow_down')
341 # self._event(FunctionalTest.evt_time, 'rcontrol')
342 # self._screenshot(FunctionalTest.screenshot_time, 'shadows')
343 # self._event(FunctionalTest.evt_time, 'rcontrol')
344 # self._event(FunctionalTest.evt_time, 'arrow_down')
345 # self._event(FunctionalTest.evt_time, 'rcontrol')
346 # self._screenshot(FunctionalTest.screenshot_time, 'fog')
347 # self._event(FunctionalTest.evt_time, 'rcontrol')
348 # self._event(FunctionalTest.evt_time, 'arrow_down')
349 # self._event(FunctionalTest.evt_time, 'rcontrol')
350 # self._screenshot(FunctionalTest.screenshot_time, 'normal_mapping')
351 # self._event(FunctionalTest.evt_time, 'rcontrol')
352 # self._event(FunctionalTest.evt_time, 'arrow_down')
353 # self._event(FunctionalTest.evt_time, 'rcontrol')
354 # self._screenshot(FunctionalTest.screenshot_time, 'occlusion')
355 # self._event(FunctionalTest.evt_time, 'rcontrol')
356 # self._event(FunctionalTest.evt_time, 'arrow_down')
357 # self._event(FunctionalTest.evt_time, 'rcontrol')
358 # # input
359 # self._event(FunctionalTest.evt_time, 'arrow_down')
360 # self._event(FunctionalTest.evt_time, 'rcontrol')
361 # self._screenshot(FunctionalTest.screenshot_time, 'input')
362 # self._event(FunctionalTest.evt_time, 'rcontrol')
363 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1')
364 # self._event(FunctionalTest.evt_time, 'rcontrol')
365 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_rec')
366 # self._event(FunctionalTest.evt_time, '8', True, False)
367 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_changed')
368 # self._event(FunctionalTest.evt_time, 'rcontrol')
369 # self._event(FunctionalTest.evt_time, 'arrow_up', True, False)
370 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_restored')
371 # self._event(FunctionalTest.evt_time, 'rcontrol')
372 # self._event(FunctionalTest.evt_time, 'w', True, False)
373 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already')
374 # self._event(FunctionalTest.evt_time, 'rcontrol')
375 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already_closed')
376 # self._event(FunctionalTest.evt_time, 'arrow_down')
377 # self._event(FunctionalTest.evt_time, 'arrow_down')
378 # self._event(FunctionalTest.evt_time, 'arrow_down')
379 # self._event(FunctionalTest.evt_time, 'arrow_down')
380 # self._event(FunctionalTest.evt_time, 'rcontrol')
381 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p2')
382 # self._event(FunctionalTest.evt_time, 'arrow_down')
383 # self._event(FunctionalTest.evt_time, 'arrow_down')
384 # self._event(FunctionalTest.evt_time, 'arrow_down')
385 # self._event(FunctionalTest.evt_time, 'arrow_down')
386 # self._event(FunctionalTest.evt_time, 'rcontrol')
387 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p3')
388 # self._event(FunctionalTest.evt_time, 'arrow_down')
389 # self._event(FunctionalTest.evt_time, 'arrow_down')
390 # self._event(FunctionalTest.evt_time, 'arrow_down')
391 # self._event(FunctionalTest.evt_time, 'arrow_down')
392 # self._event(FunctionalTest.evt_time, 'rcontrol')
393 # self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p4')
394 # self._event(FunctionalTest.evt_time, 'arrow_down')
395 # self._event(FunctionalTest.evt_time, 'arrow_down')
396 # self._event(FunctionalTest.evt_time, 'arrow_down')
397 # self._event(FunctionalTest.evt_time, 'arrow_down')
398 # self._event(FunctionalTest.evt_time, 'rcontrol')
399 # self._event(FunctionalTest.evt_time, 'arrow_down')
400 # self._event(FunctionalTest.evt_time, 'rcontrol')
401 # self._event(FunctionalTest.evt_time, 'arrow_down')
402 # self._event(FunctionalTest.evt_time, 'rcontrol')
403 # self._event(FunctionalTest.evt_time, 'arrow_down')
404 # self._event(FunctionalTest.evt_time, 'rcontrol')
405 # self._event(FunctionalTest.evt_time, 'arrow_down')
406 # self._event(FunctionalTest.evt_time, 'rcontrol')
407 # self._event(FunctionalTest.evt_time, 'arrow_down')
408 # self._event(FunctionalTest.evt_time, 'rcontrol')
409 # self._event(FunctionalTest.evt_time, 'arrow_up')
410 # self._event(FunctionalTest.evt_time, 'arrow_up')
411
412 # def _do_screenshots_game(self):
413 # # single player
414 # self._event(FunctionalTest.evt_time, 'rcontrol')
415 # self._screenshot(FunctionalTest.screenshot_time, 'single_player_menu')
416 # self._event(FunctionalTest.evt_time, 'rcontrol')
417 # self._screenshot(FunctionalTest.screenshot_time, 'track_page')
418 # self._event(FunctionalTest.evt_time, 'rcontrol')
419 # self._screenshot(FunctionalTest.screenshot_time, 'car_page_start')
420 # self._event(FunctionalTest.evt_time, 'arrow_left')
421 # self._screenshot(FunctionalTest.screenshot_time, 'car_page_sel')
422 # self._event(FunctionalTest.evt_time, 'rcontrol')
423 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_start')
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')
428 # self._event(FunctionalTest.evt_time, 'arrow_down')
429 # self._event(FunctionalTest.evt_time, 'rcontrol')
430 # self._event(FunctionalTest.evt_time, 'arrow_down')
431 # self._event(FunctionalTest.evt_time, 'rcontrol')
432 # self._event(FunctionalTest.evt_time, 'arrow_up')
433 # self._event(FunctionalTest.evt_time, 'rcontrol')
434 # self._event(FunctionalTest.evt_time, 'rcontrol')
435 # self._event(FunctionalTest.evt_time, 'arrow_left')
436 # self._event(FunctionalTest.evt_time, 'rcontrol')
437 # self._event(FunctionalTest.evt_time, 'rcontrol')
438 # self._event(FunctionalTest.evt_time, 'rcontrol')
439 # self._event(FunctionalTest.evt_time, 'rcontrol')
440 # self._event(FunctionalTest.evt_time, 'rcontrol')
441 # self._event(FunctionalTest.evt_time, 'arrow_left')
442 # self._event(FunctionalTest.evt_time, 'rcontrol')
443 # self._event(FunctionalTest.evt_time, 'arrow_up')
444 # self._event(FunctionalTest.evt_time, 'rcontrol')
445 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry')
446 # self._event(FunctionalTest.evt_time, 'backspace')
447 # self._event(FunctionalTest.evt_time, 'backspace')
448 # self._event(FunctionalTest.evt_time, 'backspace')
449 # self._event(FunctionalTest.evt_time, 'backspace')
450 # self._event(FunctionalTest.evt_time, 'backspace')
451 # self._event(FunctionalTest.evt_time, 'backspace')
452 # self._event(FunctionalTest.evt_time, 'backspace')
453 # self._event(FunctionalTest.evt_time, 'backspace')
454 # self._event(FunctionalTest.evt_time, 'backspace')
455 # self._event(FunctionalTest.evt_time, 'backspace')
456 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_empty')
457 # self._event(FunctionalTest.evt_time, 'f')
458 # self._event(FunctionalTest.evt_time, 'l')
459 # self._event(FunctionalTest.evt_time, 'a')
460 # self._event(FunctionalTest.evt_time, 'v')
461 # self._event(FunctionalTest.evt_time, 'i')
462 # self._event(FunctionalTest.evt_time, 'o')
463 # self._event(FunctionalTest.evt_time, 'enter')
464 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_full')
465 # self._event(FunctionalTest.evt_time, 'arrow_down')
466 # self._event(FunctionalTest.evt_time, 'arrow_right')
467 # self._screenshot(FunctionalTest.screenshot_time, 'driver_page_sel')
468 # # some ai tests
469 # self._event(FunctionalTest.evt_time, 'rcontrol')
470 # self._event(40, 'escape-up')
471 # self._screenshot(FunctionalTest.screenshot_time, 'ingame_menu')
472 # self._event(FunctionalTest.evt_time, 'rcontrol')
473 # self._screenshot(FunctionalTest.screenshot_time, 'race_back')
474 # self._event(FunctionalTest.evt_time, 'escape-up')
475 # self._event(FunctionalTest.evt_time, 'arrow_down')
476 # self._screenshot(FunctionalTest.screenshot_time, 'ingame_sel')
477 # self._event(FunctionalTest.evt_time, 'rcontrol')
478 # self._screenshot(FunctionalTest.screenshot_time, 'main_page_back_race')
479
480 # def _do_screenshots_end(self):
481 # self._event(FunctionalTest.evt_time, 'arrow_down')
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, 'exit_page')
488 # self._event(FunctionalTest.evt_time, 'arrow_down')
489 # self._screenshot(FunctionalTest.screenshot_time, 'exit_page_sel')
490 # self._verify()
491 # self._event(FunctionalTest.evt_time, 'rcontrol')
492 # self._exit()
493
494 def _do_screenshots(self, idx):
495 [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]()