-'''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
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:
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]()
--- /dev/null
+'''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()