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