ya2 · news · projects · code · about

external testing process
authorFlavio Calva <f.calva@gmail.com>
Thu, 28 Apr 2022 18:46:12 +0000 (19:46 +0100)
committerFlavio Calva <f.calva@gmail.com>
Thu, 28 Apr 2022 18:46:12 +0000 (19:46 +0100)
game/app.py
lib/engine/functional.py
lib/tools/functional_test.py [new file with mode: 0644]
prj.org
tests/test_functional.py

index 7d2beb8568c3709b2d3b679bc1ffd55ac0e94306..44567a6c06a401d29ab37dadd95ef22488ecec38 100755 (executable)
@@ -75,7 +75,7 @@ class PmachinesApp:
         self._prepare_window(args)
         if args.update:
             return
-        if args.functional_test and int(args.functional_test) == 1:
+        if args.functional_test:
             self._options['settings']['volume'] = 0
         self._music = MusicMgr(self._options['settings']['volume'])
         self.lang_mgr = LangMgr(self._options['settings']['language'],
@@ -98,7 +98,7 @@ class PmachinesApp:
         else:
             self._fsm.demand('Menu')
         if args.functional_test or args.functional_ref:
-            FunctionalTest(args.functional_test, args.functional_ref)
+            FunctionalTest(args.functional_ref)
 
     def on_menu_enter(self):
         self._menu_bg = Background()
@@ -148,7 +148,7 @@ class PmachinesApp:
         parser.add_argument('--version', action='store_true')
         parser.add_argument('--optfile')
         parser.add_argument('--screenshot')
-        parser.add_argument('--functional-test')
+        parser.add_argument('--functional-test', action='store_true')
         parser.add_argument('--functional-ref', action='store_true')
         cmd_line = [arg for arg in iter(argv[1:]) if not arg.startswith('-psn_')]
         args = parser.parse_args(cmd_line)
index bab0cc3988e74daf33bd2c7a896648269d8306c1..ec267dab58c0a4e0610f7828ebafa387bc8cd40f 100644 (file)
@@ -1,9 +1,3 @@
-'''Create ref:
-* M-x fla-set-fun-test
-* rm options.ini
-* python main.py --functional-test 1 --functional-ref
-* python main.py --functional-test 2 --functional-ref
-* M-x fla-unset-fun-test'''
 import datetime
 from os import getcwd, system
 from logging import debug, info
@@ -13,20 +7,44 @@ from os import makedirs
 from os.path import join, exists
 from glob import glob
 from sys import exit
+from multiprocessing.connection import Listener
+from threading import Thread
 from panda3d.core import Filename
 from direct.gui.OnscreenText import OnscreenText
 from lib.gameobject import GameObject
 from lib.build.build import _branch
 
 
-class FunctionalTest(GameObject):
+class ListenerThread(Thread):
+
+    def __init__(self, callbacks):
+        Thread.__init__(self)
+        address = ('localhost', 6000)
+        self._listener = Listener(address)
+        self._conn = self._listener.accept()
+        self._callbacks = callbacks
+
+    def run(self):
+        running = True
+        while running:
+            try:
+                msg = self._conn.recv()
+                if msg[0] == 'screenshot':
+                    taskMgr.doMethodLater(.01, self._callbacks[0], 'cb0', [msg[1]])
+                elif msg[0] == 'enforce_res':
+                    taskMgr.doMethodLater(.01, self._callbacks[1], 'cb1', [msg[1]])
+                elif msg[0] == 'verify':
+                    taskMgr.doMethodLater(.01, self._callbacks[2], 'cb2')
+            except EOFError:
+                running = False
 
-    screenshot_time = 1.2
-    evt_time = 1.0
-    start_time = 2
 
-    def __init__(self, idx, ref):
+class FunctionalTest(GameObject):
+
+    def __init__(self, ref):
         super().__init__()
+        self._listener = ListenerThread([self._do_screenshot, self._do_enforce_res, self.__verify])
+        self._listener.start()
         self.txt = OnscreenText('', fg=(1, 0, 0, 1), scale=.16)
         #self._path = ''
         #if self.eng.is_appimage:
@@ -42,632 +60,579 @@ class FunctionalTest(GameObject):
             self._path = join(
                 Filename().get_user_appdata_directory(),
                 'pmachines/tests/functional_ref_%s/' % _branch())
-        self._curr_time = 0
-        if int(idx) == 1:
-            rmtree(self._path, ignore_errors=True)
+        #if int(idx) == 1:
+        #    rmtree(self._path, ignore_errors=True)
         info('creating dir: %s' % self._path)
         makedirs(self._path, exist_ok=True)
         self._fnames = []
-        self._tasks = []
-        self._prev_time = 0
-        #self.eng.attach_obs(self.on_frame_unpausable)
-        taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
-        self.__mouse_move((0, 0))  # otherwise it has not the pointer
-        self._do_screenshots(idx)
+        #taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
+        #self._do_screenshots(idx)
 
-    def _do_screenshot(self, path=None):
-        time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
+    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))
-        res = base.screenshot(path or ("pmachines%s.png" % time), False)
-        info('screenshot %s (%s; %s)' % (path or ("pmachines%s.png" % time), res, getcwd()))
-
-    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 __mouse_click(self, pos, btn):
-        #base.win.move_pointer(0, pos[0], pos[1])
-        #self.__keypress('mouse%s' % (3 if btn == 'right' else 1))
-        offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
-        offset_y = int((1080 - 768) / 2) + 24  # xfce decorations
-        btn = 3 if btn == 'right' else 1
-        system('xdotool mousemove %s %s' % (offset_x + pos[0], offset_y + pos[1]))
-        def click(task):
-            system('xdotool click %s' % btn)
-        taskMgr.do_method_later(.01, click, 'click')
-
-    def __mouse_move(self, pos):
-        center = base.pipe.get_display_width() / 2, \
-            base.pipe.get_display_height() / 2
-        tgt = pos[0] + center[0], pos[1] + center[1]
-        system('xdotool mousemove %s %s' % tgt)
+        res = base.screenshot(self._path + name, False)
+        info('screenshot %s (%s; %s)' % (self._path + name, res, getcwd()))
 
-    def __mouse_drag(self, start, end, btn):
-        # btn = 'mouse%s' % (3 if btn == 'right' else 1)
-        # dev = base.win.get_input_device(0)
-        # base.win.move_pointer(0, start[0], start[1])
-        # dev.buttonDown(btn)
-        # def drop(task):
-        #     base.win.move_pointer(0, end[0], end[1])
-        #     def drop_up(task):
-        #         dev.button_up(btn)
-        #     taskMgr.do_method_later(.01, drop_up, 'drop_up')
-        # taskMgr.do_method_later(.01, drop, 'drop')
-        offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
-        offset_y = int((1080 - 768) / 2) + 24  # xfce decorations
-        btn = 3 if btn == 'right' else 1
-        system('xdotool mousemove %s %s' % (offset_x + start[0], offset_y + start[1]))
-        def mousedown(task):
-            system('xdotool mousedown %s' % btn)
-            def mousemove(task):
-                system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
-                def mouseup(task):
-                    system('xdotool mouseup %s' % btn)
-                taskMgr.do_method_later(.01, mouseup, 'mouseup')
-            taskMgr.do_method_later(.01, mousemove, 'mousemove')
-        taskMgr.do_method_later(.01, mousedown, 'mousedown')
+    def _do_enforce_res(self, res):
+        info('enforce_res %s' % res)
+        messenger.send('enforce_res', [res])
 
-    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 _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 _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 __keypress(self, key):
+        #'''Emulates a keypress'''
+        #dev = base.win.getInputDevice(0)
+        #dev.buttonDown(key)
+        #dev.buttonUp(key)
 
-    def _verify(self):
-        def __verify():
-            files = glob(self._path + '*')
-            for fname in self._fnames:
-                info('verifying %s' % fname)
-                assert exists(fname)
-        self._tasks += [(
-            self._curr_time + 3,
-            lambda: __verify(),
-            'verify')]
-        self._curr_time += 3
+    #def __char_entered(self, char):
+        #'''Emulates a character being entered.'''
+        #dev = base.win.getInputDevice(0)
+        #dev.keystroke(ord(char))
 
-    def _exit(self):
-        self._tasks += [(
-            self._curr_time + 3,
-            lambda: exit(),
-            'exit')]
+    # 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 on_frame_unpausable(self, task):
-        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 _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 _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 __verify(self, task):
+        files = glob(self._path + '*')
+        for fname in self._fnames:
+            info('verifying %s' % fname)
+            assert exists(fname)
 
-    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 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_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_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_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
+    # 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')
 
-    #     # go to options
-    #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     self._event(FunctionalTest.evt_time, 'arrow_down')
-    #     self._event(FunctionalTest.evt_time, 'rcontrol')
+    # def _do_screenshots_options(self):
+    #     self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(680, 300), 'left'])
     #     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')
+    #     # 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, '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')
+    #     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_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_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
 
-    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'])
+    # #     # 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_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_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_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_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_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_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]()
+    def _do_screenshots(self, idx):
+        [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]()
diff --git a/lib/tools/functional_test.py b/lib/tools/functional_test.py
new file mode 100644 (file)
index 0000000..09dc608
--- /dev/null
@@ -0,0 +1,366 @@
+'''Create ref:
+* M-x fla-set-fun-test
+* rm options.ini
+* python main.py --functional-test 1 --functional-ref
+* python main.py --functional-test 2 --functional-ref
+* M-x fla-unset-fun-test'''
+from panda3d.core import load_prc_file_data
+load_prc_file_data('', 'window-type none')
+import datetime
+from time import sleep
+from os import getcwd, system
+from multiprocessing.connection import Client
+from logging import debug, info
+from pathlib import Path
+from shutil import rmtree
+from os import makedirs
+from os.path import join, exists
+from glob import glob
+from sys import exit, argv
+from panda3d.core import Filename
+from direct.showbase.ShowBase import ShowBase
+from direct.gui.OnscreenText import OnscreenText
+from lib.gameobject import GameObject
+from lib.build.build import _branch
+
+
+class FunctionalTest(GameObject):
+
+    screenshot_time = 1.2
+    evt_time = 1.0
+    drag_time = 1.0
+    start_time = 2
+
+    def __init__(self, idx):
+        super().__init__()
+        info('test idx: %s' % idx)
+        sleep(5)
+        address = ('localhost', 6000)
+        self._conn = Client(address)
+        self._curr_time = 0
+        self._tasks = []
+        self._prev_time = 0
+        taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
+        self._do_screenshots(idx)
+
+    def _do_screenshot(self, name):
+        time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
+        name = name + '.png'
+        self._conn.send(['screenshot', name])
+        info('screenshot %s' % name)
+
+    def _screenshot(self, time, name):
+        self._tasks += [(
+            self._curr_time + time,
+            lambda: self._do_screenshot(name),
+            'screenshot: %s' % name)]
+        self._curr_time += time
+
+    def __mouse_click(self, pos, btn):
+        offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
+        offset_y = int((1080 - 768) / 2) + 24  # xfce decorations
+        btn = 3 if btn == 'right' else 1
+        system('xdotool mousemove %s %s' % (offset_x + pos[0], offset_y + pos[1]))
+        def click(task):
+            system('xdotool click %s' % btn)
+        taskMgr.do_method_later(.01, click, 'click')
+
+    def __mouse_drag(self, start, end, btn):
+        offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
+        offset_y = int((1080 - 768) / 2) + 24  # xfce decorations
+        btn = 3 if btn == 'right' else 1
+        system('xdotool mousemove %s %s' % (offset_x + start[0], offset_y + start[1]))
+        def mousedown(task):
+            system('xdotool mousedown %s' % btn)
+            def mousemove(task):
+                system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
+                def mouseup(task):
+                    system('xdotool mouseup %s' % btn)
+                taskMgr.do_method_later(.28, mouseup, 'mouseup')
+            taskMgr.do_method_later(.28, mousemove, 'mousemove')
+        taskMgr.do_method_later(.28, mousedown, 'mousedown')
+
+    def _event(self, time, evt, mouse_args=None):
+        if evt == 'mouseclick':
+            cback = lambda: self.__mouse_click(*mouse_args)
+        elif evt == 'mousedrag':
+            cback = lambda: self.__mouse_drag(*mouse_args)
+        self._tasks += [(
+            self._curr_time + time,
+            cback,
+            'event: %s' % evt)]
+        self._curr_time += time
+
+    def _enforce_res(self, time, res):
+        def cback():
+            self._conn.send(['enforce_res', res])
+            info('enforce_res %s' % res)
+        self._tasks += [(
+            self._curr_time + time,
+            cback,
+            'enforce res: %s' % res)]
+        self._curr_time += time
+
+    def _verify(self):
+        def __verify():
+            self._conn.send(['verify'])
+            info('verify')
+        self._tasks += [(
+            self._curr_time + 3,
+            lambda: __verify(),
+            'verify')]
+        self._curr_time += 3
+
+    def _exit(self):
+        def do_exit():
+            self._conn.close()
+            exit()
+        self._tasks += [(
+            self._curr_time + 3,
+            lambda: do_exit(),
+            'exit')]
+
+    def on_frame_unpausable(self, task):
+        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', [(680, 450), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits')
+
+    def _do_screenshots_options(self):
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
+        # languages
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'open_languages')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 120), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
+        # volume
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 163), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
+        # antialiasing
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
+        # shadows
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
+        # test aa and shadows
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])  # back
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left'])  # play
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left'])  # domino
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(900, 490), 'left'])  # close instructions
+        self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left'])  # home
+
+    def _do_screenshots_restore_options(self):
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
+        # languages
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'open_languages_restored')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 20), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
+        # volume
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(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', [(680, 250), 'left'])
+        # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
+        # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
+        # self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
+        # self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
+        # resolution
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 340), 'left'])
+        # self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(1020, 160), 'left'])
+        # self._screenshot(FunctionalTest.screenshot_time, '1440x900')
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 400), 'left'])
+        # self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(1110, 80), 'left'])
+        # self._screenshot(FunctionalTest.screenshot_time, '1360x768')
+        # antialiasing
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_yes')
+        # shadows
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'shadows_yes')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])  # back
+
+    def _do_screenshots_play(self):
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left'])  # play
+        self._screenshot(FunctionalTest.screenshot_time, 'play_menu')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])  # back
+        self._screenshot(FunctionalTest.screenshot_time, 'back_from_play')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left'])  # play
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left'])  # domino scene
+        self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_instructions')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left'])  # close instructions
+        self._screenshot(FunctionalTest.screenshot_time, 'scene_domino')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left'])  # home
+        self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_scene')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left'])  # play
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left'])  # domino
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left'])  # close instructions
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(70, 740), 'left'])  # info
+        self._screenshot(FunctionalTest.screenshot_time, 'info')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left'])  # close instructions
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (430, 280), 'left'])  # drag a piece
+        self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1220, 740), 'left'])  # rewind
+        self._screenshot(FunctionalTest.screenshot_time, 'rewind')
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left'])  # drag a piece
+        # self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left'])  # drag a piece
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left'])  # home
+        self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left'])  # play
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left'])  # domino
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left'])  # close instructions
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left'])  # drag a piece
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left'])  # drag a piece
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])  # replay
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (570, 380), 'left'])  # drag a piece
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(570, 355), (605, 355), 'right'])  # rotate the piece
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left'])  # drag a piece
+        self._enforce_res(FunctionalTest.evt_time, 'win')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino')
+        self._enforce_res(FunctionalTest.evt_time, '')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left'])  # next
+        self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
+        # scene 2
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 490), 'left'])  # close instructions
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left'])  # drag a box
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left'])  # drag a box
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])  # replay
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left'])  # drag a box
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left'])  # drag a box
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (705, 460), 'left'])  # drag a box
+        self._enforce_res(FunctionalTest.evt_time, 'win')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box')
+        self._enforce_res(FunctionalTest.evt_time, '')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left'])  # next
+        self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
+        # scene 3
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left'])  # close instructions
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left'])  # drag a box
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 360), 'left'])  # drag a box
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])  # replay
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left'])  # drag a box
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (835, 250), 'left'])  # drag a box
+        self._enforce_res(FunctionalTest.evt_time, 'win')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(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', [(735, 450), 'left'])  # next
+        self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
+        # scene 4
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 490), 'left'])  # close instructions
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (650, 310), 'left'])  # drag a ball
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])  # replay
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (380, 50), 'left'])  # drag a ball
+        self._enforce_res(FunctionalTest.evt_time, 'win')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_basketball')
+        self._enforce_res(FunctionalTest.evt_time, '')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left'])  # next
+        self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
+        # scene 5
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(865, 490), 'left'])  # close instructions
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left'])  # drag a box
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (590, 370), 'left'])  # drag a piece
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left'])  # play
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])  # replay
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left'])  # drag a box
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (660, 440), 'left'])  # drag a piece
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 425), (625, 425), 'right'])  # rotate a piece
+        self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 435), (650, 445), 'left'])  # drag a piece
+        self._enforce_res(FunctionalTest.evt_time, 'win')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(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', [(735, 450), 'left'])  # next
+        # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
+        # # scene 6
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(820, 455), 'left'])  # close instructions
+        # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 300), 'left'])  # drag a box
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left'])  # play
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(640, 420), 'left'])  # replay
+        # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 150), 'left'])  # drag a box
+        # self._event(FunctionalTest.drag_time, 'mousedrag', [(515, 115), (515, 122), 'right'])  # rotate a box
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left'])  # play
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(690, 420), 'left'])  # next
+        # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
+        # # scene 7
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 455), 'left'])  # close instructions
+        # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (155, 180), 'left'])  # drag a box
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left'])  # play
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(640, 420), 'left'])  # replay
+        # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (170, 80), 'left'])  # drag a box
+        # self._event(FunctionalTest.drag_time, 'mousedrag', [(195, 50), (195, 80), 'right'])  # rotate a box
+        # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left'])  # play
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left'])  # home
+        self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
+
+    def _exit(self):
+        self._tasks += [(
+            self._curr_time + 3,
+            lambda: exit(),
+            'exit')]
+
+    def _do_screenshots_exit(self):
+        self._verify()
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 600), 'left'])
+        self._exit()
+
+    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()
+
+    def _do_screenshots(self, idx):
+        [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]()
+
+
+class TestApp(ShowBase):
+
+    def __init__(self):
+        ShowBase.__init__(self)
+        fun_test = FunctionalTest(int(argv[1]))
+
+
+TestApp().run()
diff --git a/prj.org b/prj.org
index 940daff700e5e2287d42e92c041248eb667b94b9..e5778f107a383b3c5bf109e40a204857c4eab332 100644 (file)
--- a/prj.org
+++ b/prj.org
@@ -3,8 +3,7 @@
 #+CATEGORY: pmachines
 #+TAGS: bug(b) calendar(c) waiting(w)
 
-* READY do an external (another process) xdotool testing phase
-* READY windows build and test
+* RED windows build and test
 * READY itchio build and test
 * READY restore test resolutions
 * READY restore test fullscreen
index 09523b5127a22ebec47268d1e8e3354e28024bb1..3db67e030b30615c7946ffcaffa33a7169a22ad4 100644 (file)
@@ -89,8 +89,10 @@ class FunctionalTests(TestCase):
     def test_code(self):
         info('test_code')
         self.__test_template(
-            'timeout 720s ~/venv/bin/python main.py --functional-test 1 ; '
-            'timeout 720s ~/venv/bin/python main.py --functional-test 2',
+            'timeout 720s ~/venv/bin/python main.py --functional-test & '
+            'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 1; sleep 5; '
+            'timeout 720s ~/venv/bin/python main.py --functional-test & '
+            'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 2',
             str(Path.home()) + '/.local/share/pmachines/tests/functional/')
 
     def test_appimage(self):
@@ -98,8 +100,10 @@ class FunctionalTests(TestCase):
         bld_branch = {'master': 'alpha', 'rc': 'rc', 'stable': 'stable'}[_branch()]
         bld_branch = '' if bld_branch == 'stable' else ('-' + bld_branch)
         self.__test_template(
-            'timeout 720s ./dist/Pmachines%s-x86_64.AppImage --functional-test 1 ;'
-            'timeout 720s ./dist/Pmachines%s-x86_64.AppImage --functional-test 2' % (bld_branch, bld_branch),
+            'timeout 720s ./dist/Pmachines%s-x86_64.AppImage --functional-test & '
+            'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 1; sleep 5; '
+            'timeout 720s ./dist/Pmachines%s-x86_64.AppImage --functional-test & ' % (bld_branch, bld_branch) +
+            'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 2',
             str(Path.home()) + '/.local/share/pmachines/tests/functional/')
 
     def test_flatpak(self):
@@ -112,8 +116,10 @@ class FunctionalTests(TestCase):
         system(cmd)
         info('executed: %s' % cmd)
         self.__test_template(
-            'timeout 720s flatpak run it.ya2.Pmachines//%s --functional-test 1 ;'
-            'timeout 720s flatpak run it.ya2.Pmachines//%s --functional-test 2' % (bld_branch, bld_branch),
+            'timeout 720s flatpak run it.ya2.Pmachines//%s --functional-test & '
+            'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 1; sleep 5; '
+            'timeout 720s flatpak run it.ya2.Pmachines//%s --functional-test & ' % (bld_branch, bld_branch) +
+            'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 2',
             str(Path.home()) + '/.var/app/it.ya2.Pmachines/data/pmachines/tests/functional/')
 
     # def __update_itchio(self):
@@ -133,18 +139,22 @@ class FunctionalTests(TestCase):
     #         return
     #     self.__update_itchio()
     #     self.__test_template(
-    #         'timeout 720s /home/flavio/.config/itch/apps/pmachines/pmachines --functional-test 1 ;'
-    #         'timeout 720s /home/flavio/.config/itch/apps/pmachines/pmachines --functional-test 2',
+    #         'timeout 720s /home/flavio/.config/itch/apps/pmachines/pmachines --functional-test & '
+    #         'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 1; sleep 5; '
+    #         'timeout 720s /home/flavio/.config/itch/apps/pmachines/pmachines --functional-test & '
+    #         'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 2',
     #         str(Path.home()) + '/.local/share/pmachines/tests/functional/')
 
-    # def test_windows(self):
-    #     info('test_windows')
-    #     system('pkill -f "pmachines.exe"')
-    #     abspath = str(Path(__file__).parent.parent) + '/build/win_amd64/pmachines.exe'
-    #     self.__test_template(
-    #         'timeout 720s wine %s --functional-test 1 ; '
-    #         'timeout 720s wine %s --functional-test 2' % (abspath, abspath),
-    #         str(Path.home()) + '/.wine/drive_c/users/flavio/AppData/Local/pmachines/tests/functional/')
+    #def test_windows(self):
+    #    info('test_windows')
+    #    system('pkill -f "pmachines.exe"')
+    #    abspath = str(Path(__file__).parent.parent) + '/build/win_amd64/pmachines.exe'
+    #    self.__test_template(
+    #        'timeout 720s wine %s --functional-test & '
+    #        'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 1; sleep 5; '
+    #        'timeout 720s wine %s --functional-test & ' % (abspath, abspath) +
+    #        'timeout 720s ~/venv/bin/python -m lib.tools.functional_test.py 2',
+    #        str(Path.home()) + '/.wine/drive_c/users/flavio/AppData/Local/pmachines/tests/functional/')
 
     def test_versions(self):
         info('test_versions')