ya2 · news · projects · code · about

some cleaning
[pmachines.git] / ya2 / utils / functional.py
index 1a886cb13155af3bf08270258cdc4fe887ca7b5a..f9ff93f0976ae9a524ae5bcc3ef41f474f721016 100644 (file)
@@ -1,12 +1,8 @@
-import datetime
-from os import getcwd, system
-from logging import debug, info
-from pathlib import Path
+from os import getcwd
+from logging import info
 from shutil import rmtree
 from os import makedirs
 from os.path import join, exists
-from glob import glob
-from sys import exit
 from xmlrpc.server import SimpleXMLRPCServer
 from threading import Thread
 from panda3d.core import Filename
@@ -67,16 +63,20 @@ class FunctionalTest(GameObject):
     def __init__(self, ref, pos_mgr):
         super().__init__()
         self._pos_mgr = pos_mgr
-        RPCServerThread([self._do_screenshot, self._do_enforce_res, self.__verify, self._set_idx, self._do_enforce_resolution, self.__get_pos]).start()
+        RPCServerThread([self._do_screenshot, self._do_enforce_res,
+                         self.__verify, self._set_idx,
+                         self._do_enforce_resolution, self.__get_pos]).start()
         self.txt = OnscreenText('', fg=(1, 0, 0, 1), scale=.16)
-        #self._path = ''
-        #if self.eng.is_appimage:
+        # self._path = ''
+        # if self.eng.is_appimage:
         self._path = str(Filename().get_user_appdata_directory())
         self._path += '/pmachines/'
         self._path += 'tests/functional%s/' % ('_ref' if ref else '')
         home = '/home/flavio'  # we must force this for wine
-        # if self._path.startswith('/c/users/') and exists(str(Path.home()) + '/.local/share/flatpak-wine601/default/'):
-        #     self._path = str(Path.home()) + '/.local/share/flatpak-wine601/default/drive_' + self._path[1:]
+        # if self._path.startswith('/c/users/') and exists(str(Path.home()) +
+        #     '/.local/share/flatpak-wine601/default/'):
+        #     self._path = str(Path.home()) +
+        #       '/.local/share/flatpak-wine601/default/drive_' + self._path[1:]
         if self._path.startswith('/c/users/') and exists(home + '/.wine/'):
             self._path = home + '/.wine/drive_' + self._path[1:]
         if ref:
@@ -84,8 +84,8 @@ class FunctionalTest(GameObject):
                 Filename().get_user_appdata_directory(),
                 'pmachines/tests/functional_ref_%s/' % _branch())
         self._fnames = []
-        #taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
-        #self._do_screenshots(idx)
+        # taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
+        # self._do_screenshots(idx)
 
     def _set_idx(self, idx):
         if int(idx) == 1:
@@ -98,9 +98,10 @@ class FunctionalTest(GameObject):
 
     def _do_screenshot(self, name):
         self._fnames += [self._path + name]
-        #time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
-        #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
-        #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
+        # time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
+        # res = base.win.save_screenshot(
+        #     Filename(path or ("yocto%s.png" % time)))
+        # debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
         res = base.screenshot(self._path + name, False)
         info('screenshot %s (%s; %s)' % (self._path + name, res, getcwd()))
 
@@ -112,559 +113,8 @@ class FunctionalTest(GameObject):
         info('enforce resolution %s (callback)' % res)
         messenger.send('enforce_resolution', [res])
 
-    #def _screenshot(self, time, name):
-        #self._fnames += [self._path + name + '.png']
-        #self._tasks += [(
-        #    self._curr_time + time,
-        #    lambda: self._do_screenshot(self._path + name + '.png'),
-        #    'screenshot: %s' % name)]
-        #def txt(show_hide):
-        #    self.txt['text'] = name
-        #    (self.txt.show if show_hide else self.txt.hide)()
-        #self._tasks += [(
-        #    self._curr_time + time + .1,
-        #    lambda: txt(True),
-        #    'screenshot: %s (show)' % name)]
-        #self._tasks += [(
-        #    self._curr_time + time + FunctionalTest.evt_time - .1,
-        #    lambda: txt(False),
-        #    'screenshot: %s (hide)' % name)]
-        #self._curr_time += time
-
-    #def __keypress(self, key):
-        #'''Emulates a keypress'''
-        #dev = base.win.getInputDevice(0)
-        #dev.buttonDown(key)
-        #dev.buttonUp(key)
-
-    #def __char_entered(self, char):
-        #'''Emulates a character being entered.'''
-        #dev = base.win.getInputDevice(0)
-        #dev.keystroke(ord(char))
-
-    # def _event(self, time, evt, messenger_evt=False, append_up=True, mouse_args=None):
-    #     def _append_up(evt_name):
-    #         return evt + ('' if evt.endswith('-up') or not append_up else '-up')
-    #     def cback_char(_evt):
-    #         self.__char_entered(_evt)
-    #     def cback_keyp(_evt):
-    #         self.__keypress(_evt)
-    #         self.__keypress('raw-' + _evt)
-    #     cback = lambda: (cback_char(evt) if len(evt) == 1 else cback_keyp(evt))
-    #     if evt in ['mousemove', 'mouseclick', 'mousedrag']:
-    #         if evt == 'mousemove':
-    #             cback = lambda: self.__mouse_move(*mouse_args)
-    #         elif evt == 'mouseclick':
-    #             cback = lambda: self.__mouse_click(*mouse_args)
-    #         elif evt == 'mousedrag':
-    #             cback = lambda: self.__mouse_drag(*mouse_args)
-    #     if messenger_evt:
-    #         cback = lambda: messenger.send(_append_up(evt))
-    #     self._tasks += [(
-    #         self._curr_time + time,
-    #         cback,
-    #         'event: %s' % evt)]
-    #     def txt(show_hide):
-    #         self.txt['text'] = evt
-    #         (self.txt.show if show_hide else self.txt.hide)()
-    #     self._tasks += [(
-    #         self._curr_time + time + .2,
-    #         lambda: txt(True),
-    #         'event: %s (show)' % evt)]
-    #     self._tasks += [(
-    #         self._curr_time + time + .8,
-    #         lambda: txt(False),
-    #         'event: %s (hide)' % evt)]
-    #     self._curr_time += time
-
-    # def _enforce_res(self, time, res):
-    #     cback = lambda: messenger.send('enforce_res', [res])
-    #     self._tasks += [(
-    #         self._curr_time + time,
-    #         cback,
-    #         'enforce res: %s' % res)]
-    #     self._curr_time += time
-
     def __verify(self, task):
-        files = glob(self._path + '*')
+        files = glob(self._path + '*')
         for fname in self._fnames:
             info('verifying %s' % fname)
             assert exists(fname)
-
-    #def on_frame_unpausable(self, task):
-        #self._process_conn()
-        #for tsk in self._tasks:
-        #    #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
-        #    if self._prev_time <= tsk[0] < globalClock.getFrameTime():
-        #        debug('%s %s' % (tsk[0], tsk[2]))
-        #        tsk[1]()
-        #self._prev_time = globalClock.getFrameTime()  # self.eng.event.unpaused_time
-        #return task.cont
-
-    # def _do_screenshots_1(self):
-    #     info('_do_screenshots_1')
-    #     self._screenshot(FunctionalTest.start_time, 'main_menu')
-    #     self._do_screenshots_credits()
-    #     self._do_screenshots_options()
-    #     self._do_screenshots_exit()
-
-    # def _do_screenshots_credits(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits')
-    #     # # go to credits
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'main_menu_highlight')
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
-    #     # # go to supporters
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-face_a', True)
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'supporters_menu')
-    #     # # back to main
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._event(FunctionalTest.evt_time, 'joypad0-face_b', True)
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_up')
-
-    # def _do_screenshots_options(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 300), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
-    #     # languages
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 60), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'open_languages')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(980, 120), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
-    #     # volume
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(740, 163), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
-    #     # antialiasing
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 440), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
-    #     # shadows
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 540), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
-    #     # test aa and shadows
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])  # back
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(900, 490), 'left'])  # close instructions
-    #     self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(25, 740), 'left'])  # home
-
-    # def _do_screenshots_restore_options(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 300), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
-    #     # languages
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 60), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'open_languages_restored')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(980, 20), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
-    #     # volume
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(719, 163), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
-    #     # fullscreen
-    #     # the first one is because of the windowed mode in test
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-    #     # self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 250), 'left'])
-    #     # self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
-    #     # resolution
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 340), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1020, 160), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, '1440x900')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(740, 400), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1110, 80), 'left'])
-    #     # self._screenshot(FunctionalTest.screenshot_time, '1360x768')
-    #     # antialiasing
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 440), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_yes')
-    #     # shadows
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 540), 'left'])
-    #     self._screenshot(FunctionalTest.screenshot_time, 'shadows_yes')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])  # back
-
-    # #     # go to options
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
-    # #     # language
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_open')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_highlight')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_it')
-    # #     # volume
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_right')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_right')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'volume')
-    # #     # car's number
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'cars_open')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'cars_changed')
-    # #     # back
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-
-    # def _do_screenshots_play(self):
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._screenshot(FunctionalTest.screenshot_time, 'play_menu')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 680), 'left'])  # back
-    #     self._screenshot(FunctionalTest.screenshot_time, 'back_from_play')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino scene
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_instructions')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_domino')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(25, 740), 'left'])  # home
-    #     self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_scene')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(70, 740), 'left'])  # info
-    #     self._screenshot(FunctionalTest.screenshot_time, 'info')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (430, 280), 'left'])  # drag a piece
-    #     self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1220, 740), 'left'])  # rewind
-    #     self._screenshot(FunctionalTest.screenshot_time, 'rewind')
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (550, 380), 'left'])  # drag a piece
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(630, 450), 'left'])  # home
-    #     self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 140), 'left'])  # play
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(230, 160), 'left'])  # domino
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(850, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (550, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (570, 380), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(570, 355), (605, 355), 'right'])  # rotate the piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(35, 60), (715, 380), 'left'])  # drag a piece
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
-    #     # scene 2
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 620), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 540), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 620), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (710, 540), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (705, 460), 'left'])  # drag a box
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
-    #     # scene 3
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(930, 485), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 360), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (910, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (835, 250), 'left'])  # drag a box
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box_domino')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
-    #     # scene 4
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(870, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(55, 50), (650, 310), 'left'])  # drag a ball
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(55, 50), (380, 50), 'left'])  # drag a ball
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_basketball')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
-    #     # scene 5
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(865, 490), 'left'])  # close instructions
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (580, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 60), (590, 370), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 450), 'left'])  # replay
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(65, 60), (580, 440), 'left'])  # drag a box
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 60), (660, 440), 'left'])  # drag a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(660, 425), (625, 425), 'right'])  # rotate a piece
-    #     self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(660, 435), (650, 445), 'left'])  # drag a piece
-    #     self._enforce_res(FunctionalTest.evt_time, 'win')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1340, 740), 'left'])  # play
-    #     self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino_box_basketball')
-    #     self._enforce_res(FunctionalTest.evt_time, '')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(735, 450), 'left'])  # next
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
-    #     # # scene 6
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left'])  # close instructions
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 300), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 150), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(515, 115), (515, 122), 'right'])  # rotate a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
-    #     # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
-    #     # # scene 7
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 455), 'left'])  # close instructions
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (155, 180), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (170, 80), 'left'])  # drag a box
-    #     # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(195, 50), (195, 80), 'right'])  # rotate a box
-    #     # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-    #     # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(630, 450), 'left'])  # home
-    #     self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
-
-    # def _do_screenshots_exit(self):
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     self._verify()
-    #     # self._event(FunctionalTest.evt_time, 'rcontrol')
-    #     # self._exit()
-    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 600), 'left'])
-
-
-    # def _do_screenshots_2(self):
-    #     info('_do_screenshots_2')
-    #     self._screenshot(FunctionalTest.start_time, 'main_menu_2')
-    #     self._do_screenshots_restore_options()
-    #     self._do_screenshots_play()
-    #     self._do_screenshots_exit()
-    # #     self._do_screenshots_game()
-    # #     self._do_screenshots_end()
-
-    # # def _do_screenshots_restore_options(self):
-    # #     # go to options
-    # #     self._event(FunctionalTest.evt_time, 'joypad0-dpad_down', True)
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
-    # #     # # language
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'language_en_restored')
-    # #     # # volume
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'volume_restored')
-    # #     # car's number
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'cars_restored')
-    # #     # graphics settings
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'graphics_settings')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'antialiasing')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'shadows')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'fog')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'normal_mapping')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'occlusion')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     # input
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'input')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_rec')
-    # #     self._event(FunctionalTest.evt_time, '8', True, False)
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_changed')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up', True, False)
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_restored')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'w', True, False)
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p1_already_closed')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p2')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p3')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'keyboard_p4')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-
-    # # def _do_screenshots_game(self):
-    # #     # single player
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'single_player_menu')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'track_page')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'car_page_start')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'car_page_sel')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_start')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_left')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_up')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._event(FunctionalTest.evt_time, 'backspace')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_empty')
-    # #     self._event(FunctionalTest.evt_time, 'f')
-    # #     self._event(FunctionalTest.evt_time, 'l')
-    # #     self._event(FunctionalTest.evt_time, 'a')
-    # #     self._event(FunctionalTest.evt_time, 'v')
-    # #     self._event(FunctionalTest.evt_time, 'i')
-    # #     self._event(FunctionalTest.evt_time, 'o')
-    # #     self._event(FunctionalTest.evt_time, 'enter')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_entry_full')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_right')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'driver_page_sel')
-    # #     # some ai tests
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._event(40, 'escape-up')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'ingame_menu')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'race_back')
-    # #     self._event(FunctionalTest.evt_time, 'escape-up')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'ingame_sel')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'main_page_back_race')
-
-    # # def _do_screenshots_end(self):
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'exit_page')
-    # #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    # #     self._screenshot(FunctionalTest.screenshot_time, 'exit_page_sel')
-    # #     self._verify()
-    # #     self._event(FunctionalTest.evt_time, 'rcontrol')
-    # #     self._exit()
-
-    # def _do_screenshots(self, idx):
-    #     [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]()