4 * python main.py --functional-test --functional-ref & python -m ya2.tools.functional_test.py 1
5 * python main.py --functional-test --functional-ref & python -m ya2.tools.functional_test.py 2
6 * M-x fla-unset-fun-test'''
7 from panda3d
.core
import load_prc_file_data
8 load_prc_file_data('', 'window-type none')
10 from pathlib
import Path
11 from time
import sleep
12 from os
import getcwd
, system
13 from xmlrpc
.client
import ServerProxy
14 from pathlib
import Path
15 from shutil
import rmtree
16 from os
import makedirs
17 from os
.path
import join
, exists
19 from sys
import exit
, argv
20 from panda3d
.core
import Filename
21 from direct
.showbase
.ShowBase
import ShowBase
22 from direct
.gui
.OnscreenText
import OnscreenText
23 from ya2
.build
.build
import _branch
26 from logging
import basicConfig
, debug
, info
, INFO
, DEBUG
, getLogger
, StreamHandler
, Formatter
, FileHandler
29 basicConfig(level
=DEBUG
, format
='(evt-test) %(asctime)s.%(msecs)03d %(message)s', datefmt
='%H:%M:%S')
30 getLogger().setLevel(DEBUG
) # it doesn't work otherwise
40 def __init__(self
, idx
, offset
):
41 debug('creating FunctionalTest (%s)' % id(self
))
44 timestamp
= datetime
.datetime
.now().strftime('%y%m%d%H%M%S')
45 logFormatter
= Formatter('%(asctime)s.%(msecs)03d %(message)s', datefmt
='%H:%M:%S')
46 path
= str(Path
.home()) + '/.local/share/pmachines/logs/evt/'
49 lpath
= path
+ 'evt_%s.log' % timestamp
50 fileHandler
= FileHandler(lpath
)
51 fileHandler
.setFormatter(logFormatter
)
52 getLogger().addHandler(fileHandler
)
54 info('test idx: %s' % idx
)
57 self
._proxy
= ServerProxy('http://localhost:7000')
61 #taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
62 self
._proxy
.set_idx(idx
)
63 self
._do
_screenshots
(idx
)
65 def _do_screenshot(self
, name
):
66 time
= datetime
.datetime
.now().strftime('%y%m%d%H%M%S')
68 self
._proxy
.screenshot(name
)
69 info('screenshot %s' % name
)
71 async def _screenshot(self
, time
, name
):
73 # self._curr_time + time,
74 # lambda: self._do_screenshot(name),
75 # 'screenshot: %s' % name)]
76 #self._curr_time += time
77 await asyncio
.sleep(time
)
78 self
._do
_screenshot
(name
)
80 async def __mouse_click(self
, tgt
, btn
):
81 await asyncio
.sleep(.5)
82 offset_x
= int((1920 - 1360) / 2) #+ 1 # xfce decorations
83 offset_y
= int((1080 - 768) / 2) #+ 24 + self._offset # xfce decorations
84 btn
= 3 if btn
== 'right' else 1
85 pos
= self
._proxy
.get_pos(tgt
)
86 system('xdotool mousemove %s %s' % (offset_x
+ pos
[0], offset_y
+ pos
[1]))
88 # system('xdotool click %s' % tgt)
89 # print('CLICK %s' % str(btn))
90 #taskMgr.do_method_later(.28, click, 'click')
91 await asyncio
.sleep(.5)
92 system('xdotool click %s' % btn
)
94 async def __mouse_drag(self
, start
, end
, btn
):
95 await asyncio
.sleep(.5)
96 offset_x
= int((1920 - 1360) / 2) #+ 1 # xfce decorations
97 offset_y
= int((1080 - 768) / 2) #+ 24 + self._offset # xfce decorations
98 btn
= 3 if btn
== 'right' else 1
99 start
= self
._proxy
.get_pos(start
)
100 end
= self
._proxy
.get_pos(end
)
101 system('xdotool mousemove %s %s' % (offset_x
+ start
[0], offset_y
+ start
[1]))
102 await asyncio
.sleep(.5)
103 system('xdotool mousedown %s' % btn
)
104 await asyncio
.sleep(.5)
105 system('xdotool mousemove %s %s' % (offset_x
+ end
[0], offset_y
+ end
[1]))
106 await asyncio
.sleep(.5)
107 system('xdotool mouseup %s' % btn
)
108 # def mousedown(task):
109 # system('xdotool mousedown %s' % btn)
110 # def mousemove(task):
111 # system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
113 # system('xdotool mouseup %s' % btn)
114 # taskMgr.do_method_later(.28, mouseup, 'mouseup')
115 # taskMgr.do_method_later(.28, mousemove, 'mousemove')
116 # taskMgr.do_method_later(.28, mousedown, 'mousedown')
118 async def _event(self
, time
, evt
, mouse_args
=None):
119 await asyncio
.sleep(time
)
120 if evt
== 'mouseclick':
121 #cback = lambda: self.__mouse_click(*mouse_args)
122 await self
.__mouse
_click
(*mouse_args
)
123 elif evt
== 'mousedrag':
124 #cback = lambda: self.__mouse_drag(*mouse_args)
125 await self
.__mouse
_drag
(*mouse_args
)
127 # self._curr_time + time,
129 # 'event: %s' % evt)]
130 #self._curr_time += time
132 async def _enforce_res(self
, time
, res
):
133 await asyncio
.sleep(time
)
134 self
._proxy
.enforce_res(res
)
136 # self._proxy.enforce_res(res)
137 # info('enforce_res %s' % res)
139 # self._curr_time + time,
141 # 'enforce res: %s' % res)]
142 #self._curr_time += time
144 async def _enforce_resolution(self
, time
, res
):
145 await asyncio
.sleep(time
)
146 self
._proxy
.enforce_resolution(res
)
148 # self._proxy.enforce_resolution(res)
149 # info('enforce_resolution %s (send)' % res)
151 # self._curr_time + time,
153 # 'enforce resolution: %s' % res)]
154 #self._curr_time += time
156 async def _verify(self
, time
):
157 await asyncio
.sleep(time
)
161 # self._proxy.verify()
164 # self._curr_time + 3,
165 # lambda: __verify(),
167 #self._curr_time += 3
169 async def _exit(self
, time
):
170 await asyncio
.sleep(time
)
173 except (ConnectionRefusedError
, xmlrpc
.client
.Fault
) as e
: # the other part has been closed with the exit button
174 debug('already closed (%s)' % e
)
175 debug('destroying FunctionalTest (%s)' % id(self
))
179 # self._proxy.close()
180 # except (ConnectionRefusedError, xmlrpc.client.Fault) as e: # the other part has been closed with the exit button
181 # debug('already closed (%s)' % e)
182 # debug('destroying FunctionalTest (%s)' % id(self))
185 # self._curr_time + 3,
189 # def on_frame_unpausable(self, task):
190 # for tsk in self._tasks:
191 # #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
192 # if self._prev_time <= tsk[0] < globalClock.getFrameTime():
193 # debug('%s %s' % (tsk[0], tsk[2]))
195 # self._prev_time = globalClock.getFrameTime() # self.eng.event.unpaused_time
198 async def _do_screenshots_1(self
):
199 info('_do_screenshots_1')
200 await self
._screenshot
(FunctionalTest
.start_time
, 'main_menu')
201 await self
._do
_screenshots
_credits
()
202 await self
._do
_screenshots
_options
()
203 await self
._do
_screenshots
_exit
()
205 async def _do_screenshots_credits(self
):
206 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])
207 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['credits', 'left'])
208 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'credits_menu')
209 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])
210 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left'])
211 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'main_menu_back_from_credits')
213 async def _do_screenshots_options(self
):
214 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
215 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['options', 'left'])
216 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu')
218 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
219 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['languages', 'left'])
220 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages')
221 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 120), 'left'])
222 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['italian', 'left'])
223 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_italian')
225 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 163), 'left'])
226 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['volume', 'left'])
227 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_1')
229 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
230 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['aa', 'left'])
231 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_no')
233 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
234 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['shadows', 'left'])
235 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_no')
236 # test aa and shadows
237 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
238 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left']) # back
239 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
240 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left']) # play
241 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
242 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left']) # domino
243 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(900, 490), 'left']) # close instructions
244 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left']) # close instructions
245 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'aa_no_shadows_no')
246 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
247 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home', 'left']) # home
249 async def _do_screenshots_restore_options(self
):
250 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
251 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['options', 'left'])
252 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_restored')
254 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
255 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['languages', 'left'])
256 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages_restored')
257 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 20), 'left'])
258 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['english', 'left'])
259 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_english')
261 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(719, 163), 'left'])
262 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['volume_0', 'left'])
263 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_2')
265 # the first one is because of the windowed mode in test
266 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
267 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['fullscreen', 'left'])
268 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'fullscreen')
269 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
270 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['fullscreen', 'left'])
271 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'fullscreen')
272 #await self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(440, 120), 'left'])
273 #await self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
274 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['fullscreen', 'left'])
275 await self
._screenshot
(8 + FunctionalTest
.screenshot_time
, 'back_from_fullscreen')
277 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 340), 'left'])
278 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['resolutions', 'left'])
279 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'resolutions')
280 await self
._enforce
_resolution
(FunctionalTest
.evt_time
, '1440x900')
281 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1000, 440), 'left'])
282 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['res_1440x900', 'left'])
283 await self
._screenshot
(FunctionalTest
.screenshot_time
, '1440x900')
284 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 400), 'left'])
285 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['resolutions', 'left'])
286 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'resolutions_2')
287 await self
._enforce
_resolution
(FunctionalTest
.evt_time
, '1360x768')
288 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1110, 80), 'left'])
289 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['res_1360x768', 'left'])
290 await self
._screenshot
(FunctionalTest
.screenshot_time
, '1360x768')
292 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
293 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['aa', 'left'])
294 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_yes')
296 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
297 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['shadows', 'left'])
298 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_yes')
299 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
300 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left'])
302 async def _do_screenshots_play(self
):
303 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
304 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left'])
305 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'play_menu')
306 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
307 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left'])
308 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'back_from_play')
309 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
310 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left'])
311 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino scene
312 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left'])
313 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_instructions')
314 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
315 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
316 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino')
317 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
318 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home', 'left'])
319 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_scene')
320 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
321 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left'])
322 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
323 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left'])
324 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
325 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
326 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(70, 740), 'left']) # info
327 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['information', 'left'])
328 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'info')
329 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
330 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
331 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (430, 280), 'left']) # drag a piece
332 # await self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
333 # await self._event(FunctionalTest.evt_time, 'mouseclick', [(1220, 740), 'left']) # rewind
334 # await self._screenshot(FunctionalTest.screenshot_time, 'rewind')
335 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
336 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
337 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
338 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
339 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left']) # play
340 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino')
341 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
342 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home_win', 'left']) # home
343 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_fail')
344 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
345 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left']) # play
346 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
347 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left'])
348 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
349 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
350 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
351 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
352 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
353 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a piece .49 .06
354 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
355 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left']) # play
356 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino_2')
357 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
358 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left']) # play
359 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (570, 380), 'left']) # drag a piece -1.54 .06
360 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a piece -1.54 .06
361 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(570, 355), (605, 355), 'right']) # rotate the piece -1.05 .4
362 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_3', 'right']) # rotate the piece -1.54 .4 -1.05 .4
363 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
364 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
365 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
366 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
367 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left']) # play
368 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino')
369 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
370 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
371 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left']) # play
372 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box')
374 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 490), 'left']) # close instructions
375 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
376 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box .42 -3.29
377 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box .42 -3.29
378 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box .42 -2.18
379 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box .42 -2.18
380 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
381 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
382 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box')
383 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
384 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
385 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box
386 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
387 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box
388 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box
389 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (705, 460), 'left']) # drag a box .35 -1.06
390 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a box .35 -1.06
391 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
392 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
393 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
394 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_box')
395 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
396 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
397 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
398 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box_domino')
400 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
401 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
402 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box 3.21 -.78
403 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box 3.21 -.78
404 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 360), 'left']) # drag a box 3.21 .33
405 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box 3.21 .33
406 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
407 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
408 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box_domino')
409 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
410 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
411 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box
412 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
413 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (835, 250), 'left']) # drag a box 2.16 1.87
414 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a box 2.16 1.87
415 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
416 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
417 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
418 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_box_domino')
419 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
420 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
421 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
422 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_basketball')
424 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 490), 'left']) # close instructions
425 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
426 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (650, 310), 'left']) # drag a ball -.42 1.03
427 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a ball -.42 1.03
428 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
429 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
430 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_basketball')
431 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
432 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
433 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (380, 50), 'left']) # drag a ball -4.19 4.66
434 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a ball -4.19 4.66
435 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
436 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
437 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
438 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_basketball')
439 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
440 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
441 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
442 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_box_basketball')
444 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(865, 490), 'left']) # close instructions
445 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
446 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box -1.4 -.78
447 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -1.4 -.78
448 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (590, 370), 'left']) # drag a piece -1.26 .2
449 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_1', 'left']) # drag a piece -1.26 .2
450 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
451 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
452 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino_box_basketball')
453 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
454 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
455 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box
456 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
457 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (660, 440), 'left']) # drag a piece -.28 -.78
458 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_2', 'left']) # drag a piece -.28 -.78
459 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 425), (625, 425), 'right']) # rotate a piece -.28 -.57 -.77 -.57
460 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_2', 'drag_stop_3', 'right']) # rotate a piece -.28 -.57 -.77 -.57
461 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 435), (650, 445), 'left']) # drag a piece -.28 -.85 -.42 -.85
462 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_3', 'drag_stop_4', 'left']) # drag a piece -.28 -.85 -.42 -.85
463 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
464 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
465 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
466 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino_box_basketball')
467 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
468 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
469 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
470 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_teeter_tooter')
472 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 485), 'left']) # close instructions
473 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
474 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 300), 'left']) # drag a box -2.65 1.18
475 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -2.65 1.18
476 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
477 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
478 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_teeter_tooter')
479 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
480 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
481 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 150), 'left']) # drag a box -2.65 3.27
482 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box -2.65 3.27
483 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(515, 115), (515, 122), 'right']) # rotate a box -2.3 3.75 -2.5 3.66
484 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_2', 'right']) # rotate a box -2.3 3.75 -2.5 3.66
485 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
486 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
487 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
488 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_teeter_tooter')
489 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
490 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
491 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
492 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_teeter_domino_box_basketball')
494 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
495 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
496 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (155, 180), 'left']) # drag a box -7.33 4.24
497 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -7.33 4.24
498 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
499 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
500 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_teeter_domino_box_basketball')
501 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
502 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
503 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (170, 80), 'left']) # drag a box -7.12 4.24
504 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box -7.12 4.24
505 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(195, 50), (195, 80), 'right']) # rotate a box -6.77 4.66 -6.77 4.24
506 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_2', 'right']) # rotate a box -6.77 4.66 -6.77 4.24
507 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
508 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
509 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
510 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_teeter_domino_box_basketball')
511 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
512 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
513 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home_win', 'left'])
514 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_from_play')
516 async def _do_screenshots_exit(self
):
517 await self
._verify
(FunctionalTest
.evt_time
)
518 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 600), 'left'])
519 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['exit', 'left'])
520 await self
._exit
(FunctionalTest
.evt_time
)
522 async def _do_screenshots_2(self
):
523 info('_do_screenshots_2')
524 await self
._screenshot
(FunctionalTest
.start_time
, 'main_menu_2')
525 await self
._do
_screenshots
_restore
_options
()
526 await self
._do
_screenshots
_play
()
527 await self
._do
_screenshots
_exit
()
529 def _do_screenshots(self
, idx
):
531 [self
._do
_screenshots
_1, self
._do
_screenshots
_2][int(idx
) - 1]()
535 class TestApp(ShowBase
):
538 ShowBase
.__init
__(self
)
539 offset
= int(argv
[2]) if len(argv
) >= 3 else 0
540 fun_test
= FunctionalTest(int(argv
[1]), offset
)