e039c1c64cb0b63f99c00b7f49a8bba5310ba804
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 time
import sleep
11 from os
import getcwd
, system
12 from xmlrpc
.client
import ServerProxy
13 from logging
import debug
, info
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
35 def __init__(self
, idx
, offset
):
36 debug('creating FunctionalTest (%s)' % id(self
))
38 info('test idx: %s' % idx
)
41 self
._proxy
= ServerProxy('http://localhost:7000')
45 #taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
46 self
._proxy
.set_idx(idx
)
47 self
._do
_screenshots
(idx
)
49 def _do_screenshot(self
, name
):
50 time
= datetime
.datetime
.now().strftime('%y%m%d%H%M%S')
52 self
._proxy
.screenshot(name
)
53 info('screenshot %s' % name
)
55 async def _screenshot(self
, time
, name
):
57 # self._curr_time + time,
58 # lambda: self._do_screenshot(name),
59 # 'screenshot: %s' % name)]
60 #self._curr_time += time
61 await asyncio
.sleep(time
)
62 self
._do
_screenshot
(name
)
64 async def __mouse_click(self
, tgt
, btn
):
65 await asyncio
.sleep(.5)
66 offset_x
= int((1920 - 1360) / 2) #+ 1 # xfce decorations
67 offset_y
= int((1080 - 768) / 2) #+ 24 + self._offset # xfce decorations
68 btn
= 3 if btn
== 'right' else 1
69 pos
= self
._proxy
.get_pos(tgt
)
70 system('xdotool mousemove %s %s' % (offset_x
+ pos
[0], offset_y
+ pos
[1]))
72 # system('xdotool click %s' % tgt)
73 # print('CLICK %s' % str(btn))
74 #taskMgr.do_method_later(.28, click, 'click')
75 await asyncio
.sleep(.5)
76 system('xdotool click %s' % btn
)
78 async def __mouse_drag(self
, start
, end
, btn
):
79 await asyncio
.sleep(.5)
80 offset_x
= int((1920 - 1360) / 2) #+ 1 # xfce decorations
81 offset_y
= int((1080 - 768) / 2) #+ 24 + self._offset # xfce decorations
82 btn
= 3 if btn
== 'right' else 1
83 start
= self
._proxy
.get_pos(start
)
84 end
= self
._proxy
.get_pos(end
)
85 system('xdotool mousemove %s %s' % (offset_x
+ start
[0], offset_y
+ start
[1]))
86 await asyncio
.sleep(.5)
87 system('xdotool mousedown %s' % btn
)
88 await asyncio
.sleep(.5)
89 system('xdotool mousemove %s %s' % (offset_x
+ end
[0], offset_y
+ end
[1]))
90 await asyncio
.sleep(.5)
91 system('xdotool mouseup %s' % btn
)
92 # def mousedown(task):
93 # system('xdotool mousedown %s' % btn)
94 # def mousemove(task):
95 # system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
97 # system('xdotool mouseup %s' % btn)
98 # taskMgr.do_method_later(.28, mouseup, 'mouseup')
99 # taskMgr.do_method_later(.28, mousemove, 'mousemove')
100 # taskMgr.do_method_later(.28, mousedown, 'mousedown')
102 async def _event(self
, time
, evt
, mouse_args
=None):
103 await asyncio
.sleep(time
)
104 if evt
== 'mouseclick':
105 #cback = lambda: self.__mouse_click(*mouse_args)
106 await self
.__mouse
_click
(*mouse_args
)
107 elif evt
== 'mousedrag':
108 #cback = lambda: self.__mouse_drag(*mouse_args)
109 await self
.__mouse
_drag
(*mouse_args
)
111 # self._curr_time + time,
113 # 'event: %s' % evt)]
114 #self._curr_time += time
116 async def _enforce_res(self
, time
, res
):
117 await asyncio
.sleep(time
)
118 self
._proxy
.enforce_res(res
)
120 # self._proxy.enforce_res(res)
121 # info('enforce_res %s' % res)
123 # self._curr_time + time,
125 # 'enforce res: %s' % res)]
126 #self._curr_time += time
128 async def _enforce_resolution(self
, time
, res
):
129 await asyncio
.sleep(time
)
130 self
._proxy
.enforce_resolution(res
)
132 # self._proxy.enforce_resolution(res)
133 # info('enforce_resolution %s (send)' % res)
135 # self._curr_time + time,
137 # 'enforce resolution: %s' % res)]
138 #self._curr_time += time
140 async def _verify(self
, time
):
141 await asyncio
.sleep(time
)
145 # self._proxy.verify()
148 # self._curr_time + 3,
149 # lambda: __verify(),
151 #self._curr_time += 3
153 async def _exit(self
, time
):
154 await asyncio
.sleep(time
)
157 except (ConnectionRefusedError
, xmlrpc
.client
.Fault
) as e
: # the other part has been closed with the exit button
158 debug('already closed (%s)' % e
)
159 debug('destroying FunctionalTest (%s)' % id(self
))
163 # self._proxy.close()
164 # except (ConnectionRefusedError, xmlrpc.client.Fault) as e: # the other part has been closed with the exit button
165 # debug('already closed (%s)' % e)
166 # debug('destroying FunctionalTest (%s)' % id(self))
169 # self._curr_time + 3,
173 # def on_frame_unpausable(self, task):
174 # for tsk in self._tasks:
175 # #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
176 # if self._prev_time <= tsk[0] < globalClock.getFrameTime():
177 # debug('%s %s' % (tsk[0], tsk[2]))
179 # self._prev_time = globalClock.getFrameTime() # self.eng.event.unpaused_time
182 async def _do_screenshots_1(self
):
183 info('_do_screenshots_1')
184 await self
._screenshot
(FunctionalTest
.start_time
, 'main_menu')
185 await self
._do
_screenshots
_credits
()
186 await self
._do
_screenshots
_options
()
187 await self
._do
_screenshots
_exit
()
189 async def _do_screenshots_credits(self
):
190 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])
191 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['credits', 'left'])
192 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'credits_menu')
193 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])
194 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left'])
195 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'main_menu_back_from_credits')
197 async def _do_screenshots_options(self
):
198 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
199 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['options', 'left'])
200 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu')
202 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
203 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['languages', 'left'])
204 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages')
205 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 120), 'left'])
206 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['italian', 'left'])
207 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_italian')
209 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 163), 'left'])
210 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['volume', 'left'])
211 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_1')
213 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
214 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['aa', 'left'])
215 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_no')
217 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
218 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['shadows', 'left'])
219 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_no')
220 # test aa and shadows
221 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
222 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left']) # back
223 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
224 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left']) # play
225 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
226 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left']) # domino
227 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(900, 490), 'left']) # close instructions
228 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left']) # close instructions
229 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'aa_no_shadows_no')
230 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
231 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home', 'left']) # home
233 async def _do_screenshots_restore_options(self
):
234 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
235 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['options', 'left'])
236 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_restored')
238 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
239 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['languages', 'left'])
240 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'open_languages_restored')
241 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 20), 'left'])
242 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['english', 'left'])
243 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_english')
245 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(719, 163), 'left'])
246 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['volume_0', 'left'])
247 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'options_menu_drag_2')
249 # the first one is because of the windowed mode in test
250 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
251 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['fullscreen', 'left'])
252 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'fullscreen')
253 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
254 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['fullscreen', 'left'])
255 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'fullscreen')
256 #await self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(440, 120), 'left'])
257 #await self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
258 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['fullscreen', 'left'])
259 await self
._screenshot
(8 + FunctionalTest
.screenshot_time
, 'back_from_fullscreen')
261 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 340), 'left'])
262 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['resolutions', 'left'])
263 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'resolutions')
264 await self
._enforce
_resolution
(FunctionalTest
.evt_time
, '1440x900')
265 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1000, 440), 'left'])
266 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['res_1440x900', 'left'])
267 await self
._screenshot
(FunctionalTest
.screenshot_time
, '1440x900')
268 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 400), 'left'])
269 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['resolutions', 'left'])
270 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'resolutions_2')
271 await self
._enforce
_resolution
(FunctionalTest
.evt_time
, '1360x768')
272 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1110, 80), 'left'])
273 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['res_1360x768', 'left'])
274 await self
._screenshot
(FunctionalTest
.screenshot_time
, '1360x768')
276 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
277 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['aa', 'left'])
278 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'antialiasing_yes')
280 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
281 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['shadows', 'left'])
282 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'shadows_yes')
283 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
284 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left'])
286 async def _do_screenshots_play(self
):
287 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
288 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left'])
289 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'play_menu')
290 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
291 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['back', 'left'])
292 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'back_from_play')
293 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
294 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left'])
295 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino scene
296 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left'])
297 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_instructions')
298 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
299 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
300 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino')
301 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
302 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home', 'left'])
303 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_scene')
304 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
305 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left'])
306 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
307 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left'])
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._event(FunctionalTest.evt_time, 'mouseclick', [(70, 740), 'left']) # info
311 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['information', 'left'])
312 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'info')
313 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
314 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
315 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (430, 280), 'left']) # drag a piece
316 # await self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
317 # await self._event(FunctionalTest.evt_time, 'mouseclick', [(1220, 740), 'left']) # rewind
318 # await self._screenshot(FunctionalTest.screenshot_time, 'rewind')
319 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
320 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
321 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
322 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
323 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left']) # play
324 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino')
325 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
326 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home_win', 'left']) # home
327 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_back_from_fail')
328 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
329 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['play', 'left']) # play
330 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
331 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['domino', 'left'])
332 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
333 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
334 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
335 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
336 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
337 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a piece .49 .06
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_2')
341 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
342 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left']) # play
343 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (570, 380), 'left']) # drag a piece -1.54 .06
344 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a piece -1.54 .06
345 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(570, 355), (605, 355), 'right']) # rotate the piece -1.05 .4
346 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_3', 'right']) # rotate the piece -1.54 .4 -1.05 .4
347 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
348 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
349 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
350 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
351 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left']) # play
352 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino')
353 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
354 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
355 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left']) # play
356 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box')
358 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 490), 'left']) # close instructions
359 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
360 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box .42 -3.29
361 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box .42 -3.29
362 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box .42 -2.18
363 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box .42 -2.18
364 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
365 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
366 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box')
367 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
368 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
369 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box
370 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
371 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box
372 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box
373 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (705, 460), 'left']) # drag a box .35 -1.06
374 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a box .35 -1.06
375 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
376 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
377 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
378 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_box')
379 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
380 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
381 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
382 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_box_domino')
384 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
385 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
386 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box 3.21 -.78
387 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box 3.21 -.78
388 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 360), 'left']) # drag a box 3.21 .33
389 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box 3.21 .33
390 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
391 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
392 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_box_domino')
393 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
394 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
395 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box
396 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
397 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (835, 250), 'left']) # drag a box 2.16 1.87
398 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a box 2.16 1.87
399 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
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
, 'win_box_domino')
403 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
404 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
405 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
406 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_basketball')
408 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 490), 'left']) # close instructions
409 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
410 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (650, 310), 'left']) # drag a ball -.42 1.03
411 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a ball -.42 1.03
412 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
413 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
414 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_basketball')
415 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
416 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
417 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (380, 50), 'left']) # drag a ball -4.19 4.66
418 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a ball -4.19 4.66
419 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
420 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
421 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
422 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_basketball')
423 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
424 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
425 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
426 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_domino_box_basketball')
428 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(865, 490), 'left']) # close instructions
429 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
430 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box -1.4 -.78
431 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -1.4 -.78
432 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (590, 370), 'left']) # drag a piece -1.26 .2
433 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_1', 'left']) # drag a piece -1.26 .2
434 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
435 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
436 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_domino_box_basketball')
437 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
438 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
439 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box
440 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
441 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (660, 440), 'left']) # drag a piece -.28 -.78
442 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_1', 'drag_stop_2', 'left']) # drag a piece -.28 -.78
443 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 425), (625, 425), 'right']) # rotate a piece -.28 -.57 -.77 -.57
444 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_2', 'drag_stop_3', 'right']) # rotate a piece -.28 -.57 -.77 -.57
445 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 435), (650, 445), 'left']) # drag a piece -.28 -.85 -.42 -.85
446 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_3', 'drag_stop_4', 'left']) # drag a piece -.28 -.85 -.42 -.85
447 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
448 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
449 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
450 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'win_domino_box_basketball')
451 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
452 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
453 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
454 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_teeter_tooter')
456 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 485), 'left']) # close instructions
457 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
458 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 300), 'left']) # drag a box -2.65 1.18
459 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -2.65 1.18
460 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
461 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
462 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_teeter_tooter')
463 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
464 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
465 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 150), 'left']) # drag a box -2.65 3.27
466 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box -2.65 3.27
467 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(515, 115), (515, 122), 'right']) # rotate a box -2.3 3.75 -2.5 3.66
468 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
469 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
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
, 'win_teeter_tooter')
473 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
474 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
475 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['next', 'left'])
476 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'scene_teeter_domino_box_basketball')
478 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
479 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['close_instructions', 'left'])
480 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (155, 180), 'left']) # drag a box -7.33 4.24
481 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -7.33 4.24
482 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
483 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['right', 'left'])
484 await self
._screenshot
(16 + FunctionalTest
.screenshot_time
, 'fail_teeter_domino_box_basketball')
485 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
486 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['replay', 'left'])
487 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (170, 80), 'left']) # drag a box -7.12 4.24
488 await self
._event
(FunctionalTest
.drag_time
, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box -7.12 4.24
489 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(195, 50), (195, 80), 'right']) # rotate a box -6.77 4.66 -6.77 4.24
490 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
491 await self
._enforce
_res
(FunctionalTest
.evt_time
, 'win')
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
, 'win_teeter_domino_box_basketball')
495 await self
._enforce
_res
(FunctionalTest
.evt_time
, '')
496 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
497 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['home_win', 'left'])
498 await self
._screenshot
(FunctionalTest
.screenshot_time
, 'home_from_play')
500 async def _do_screenshots_exit(self
):
501 await self
._verify
(FunctionalTest
.evt_time
)
502 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 600), 'left'])
503 await self
._event
(FunctionalTest
.evt_time
, 'mouseclick', ['exit', 'left'])
504 await self
._exit
(FunctionalTest
.evt_time
)
506 async def _do_screenshots_2(self
):
507 info('_do_screenshots_2')
508 await self
._screenshot
(FunctionalTest
.start_time
, 'main_menu_2')
509 await self
._do
_screenshots
_restore
_options
()
510 await self
._do
_screenshots
_play
()
511 await self
._do
_screenshots
_exit
()
513 def _do_screenshots(self
, idx
):
515 [self
._do
_screenshots
_1, self
._do
_screenshots
_2][int(idx
) - 1]()
519 class TestApp(ShowBase
):
522 ShowBase
.__init
__(self
)
523 offset
= int(argv
[2]) if len(argv
) >= 3 else 0
524 fun_test
= FunctionalTest(int(argv
[1]), offset
)