ya2 · news · projects · code · about

2e21403af92e72f93d8871206ec6ec3e02accbd6
[pmachines.git] / tests / functional_test.py
1 from panda3d.core import load_prc_file_data
2 load_prc_file_data('', 'window-type none')
3 import sys
4 from time import sleep
5 from os import system
6 from xmlrpc.client import ServerProxy
7 from sys import exit, argv
8 from direct.showbase.ShowBase import ShowBase
9 import asyncio
10 import xmlrpc
11 from logging import basicConfig, debug, info, DEBUG, getLogger, StreamHandler
12
13
14 basicConfig(level=DEBUG, format='(evt-test) %(asctime)s.%(msecs)03d %(message)s', datefmt='%H:%M:%S')
15 getLogger().setLevel(DEBUG) # it doesn't work otherwise
16 getLogger().addHandler(StreamHandler(sys.stdout))
17
18
19 class FunctionalTest:
20
21 screenshot_time = 2.0
22 evt_time = 2.0
23 drag_time = 2.0
24 start_time = 2
25
26 def __init__(self, idx, offset):
27 debug('creating FunctionalTest (%s)' % id(self))
28 super().__init__()
29
30 # timestamp = datetime.datetime.now().strftime('%y%m%d%H%M%S')
31 # logFormatter = Formatter('%(asctime)s.%(msecs)03d %(message)s', datefmt='%H:%M:%S')
32 # path = str(Path.home()) + '/.local/share/pmachines/logs/evt/'
33 # if not exists(path):
34 # makedirs(path)
35 # lpath = path + 'evt_%s.log' % timestamp
36 # fileHandler = FileHandler(lpath)
37 # fileHandler.setFormatter(logFormatter)
38 # getLogger().addHandler(fileHandler)
39
40 info('test idx: %s' % idx)
41 self._offset = offset
42 sleep(12)
43 self._proxy = ServerProxy('http://localhost:7000')
44 self._curr_time = 0
45 self._tasks = []
46 self._prev_time = 0
47 #taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
48 self._proxy.set_index(idx)
49 self._do_screenshots(idx)
50
51 def _do_screenshot(self, name):
52 # time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
53 name = name + '.png'
54 self._proxy.screenshot(name)
55 info('screenshot %s' % name)
56
57 async def _screenshot(self, time, name):
58 #self._tasks += [(
59 # self._curr_time + time,
60 # lambda: self._do_screenshot(name),
61 # 'screenshot: %s' % name)]
62 #self._curr_time += time
63 await asyncio.sleep(time)
64 self._do_screenshot(name)
65
66 async def __mouse_click(self, tgt, btn):
67 await asyncio.sleep(.5)
68 offset_x = int((1920 - 1360) / 2) #+ 1 # xfce decorations
69 offset_y = int((1080 - 768) / 2) #+ 24 + self._offset # xfce decorations
70 btn = 3 if btn == 'right' else 1
71 pos = self._proxy.get_position(tgt)
72 system('xdotool mousemove %s %s' % (offset_x + pos[0], offset_y + pos[1]))
73 #def click(task):
74 # system('xdotool click %s' % tgt)
75 # print('CLICK %s' % str(btn))
76 #taskMgr.do_method_later(.28, click, 'click')
77 await asyncio.sleep(.5)
78 system('xdotool click %s' % btn)
79
80 async def __mouse_drag(self, start, end, 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 start = self._proxy.get_position(start)
86 end = self._proxy.get_position(end)
87 system('xdotool mousemove %s %s' % (offset_x + start[0], offset_y + start[1]))
88 await asyncio.sleep(.5)
89 system('xdotool mousedown %s' % btn)
90 await asyncio.sleep(.5)
91 system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
92 await asyncio.sleep(.5)
93 system('xdotool mouseup %s' % btn)
94 # def mousedown(task):
95 # system('xdotool mousedown %s' % btn)
96 # def mousemove(task):
97 # system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
98 # def mouseup(task):
99 # system('xdotool mouseup %s' % btn)
100 # taskMgr.do_method_later(.28, mouseup, 'mouseup')
101 # taskMgr.do_method_later(.28, mousemove, 'mousemove')
102 # taskMgr.do_method_later(.28, mousedown, 'mousedown')
103
104 async def __emulate_keys(self, keys):
105 await asyncio.sleep(.4)
106 for k in keys:
107 await asyncio.sleep(.3)
108 system(f'xdotool key {k}')
109
110 async def _event(self, time, evt, mouse_args=None):
111 await asyncio.sleep(time)
112 if evt == 'mouseclick':
113 #cback = lambda: self.__mouse_click(*mouse_args)
114 await self.__mouse_click(*mouse_args)
115 elif evt == 'mousedrag':
116 #cback = lambda: self.__mouse_drag(*mouse_args)
117 await self.__mouse_drag(*mouse_args)
118 elif evt == 'keyboard':
119 #cback = lambda: self.__mouse_drag(*mouse_args)
120 await self.__emulate_keys(mouse_args)
121 #self._tasks += [(
122 # self._curr_time + time,
123 # cback,
124 # 'event: %s' % evt)]
125 #self._curr_time += time
126
127 async def _enforce_result(self, time, res):
128 await asyncio.sleep(time)
129 self._proxy.enforce_result(res)
130 #def cback():
131 # self._proxy.enforce_result(res)
132 # info('enforce_result %s' % res)
133 #self._tasks += [(
134 # self._curr_time + time,
135 # cback,
136 # 'enforce res: %s' % res)]
137 #self._curr_time += time
138
139 async def _enforce_resolution(self, time, res):
140 await asyncio.sleep(time)
141 self._proxy.enforce_resolution(res)
142 #def cback():
143 # self._proxy.enforce_resolution(res)
144 # info('enforce_resolution %s (send)' % res)
145 #self._tasks += [(
146 # self._curr_time + time,
147 # cback,
148 # 'enforce resolution: %s' % res)]
149 #self._curr_time += time
150
151 async def _verify(self, time):
152 await asyncio.sleep(time)
153 self._proxy.verify()
154 info('verify')
155 #def __verify():
156 # self._proxy.verify()
157 # info('verify')
158 #self._tasks += [(
159 # self._curr_time + 3,
160 # lambda: __verify(),
161 # 'verify')]
162 #self._curr_time += 3
163
164 async def _exit(self, time):
165 await asyncio.sleep(time)
166 try:
167 self._proxy.close()
168 except (ConnectionRefusedError, xmlrpc.client.Fault) as e: # the other part has been closed with the exit button
169 debug('already closed (%s)' % e)
170 debug('destroying FunctionalTest (%s)' % id(self))
171 exit()
172 #def do_exit():
173 # try:
174 # self._proxy.close()
175 # except (ConnectionRefusedError, xmlrpc.client.Fault) as e: # the other part has been closed with the exit button
176 # debug('already closed (%s)' % e)
177 # debug('destroying FunctionalTest (%s)' % id(self))
178 # exit()
179 #self._tasks += [(
180 # self._curr_time + 3,
181 # lambda: do_exit(),
182 # 'exit')]
183
184 # def on_frame_unpausable(self, task):
185 # for tsk in self._tasks:
186 # #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
187 # if self._prev_time <= tsk[0] < globalClock.getFrameTime():
188 # debug('%s %s' % (tsk[0], tsk[2]))
189 # tsk[1]()
190 # self._prev_time = globalClock.getFrameTime() # self.eng.event.unpaused_time
191 # return task.cont
192
193 async def _do_screenshots_1(self):
194 info('_do_screenshots_1')
195 await self._screenshot(FunctionalTest.start_time, 'main_menu')
196 await self._do_screenshots_credits()
197 await self._do_screenshots_options()
198 await self._do_screenshots_exit()
199
200 async def _do_screenshots_credits(self):
201 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])
202 await self._event(FunctionalTest.evt_time, 'mouseclick', ['credits', 'left'])
203 await self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
204 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])
205 await self._event(FunctionalTest.evt_time, 'mouseclick', ['back', 'left'])
206 await self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits')
207
208 async def _do_screenshots_options(self):
209 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
210 await self._event(FunctionalTest.evt_time, 'mouseclick', ['options', 'left'])
211 await self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
212 # languages
213 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
214 await self._event(FunctionalTest.evt_time, 'mouseclick', ['languages', 'left'])
215 await self._screenshot(FunctionalTest.screenshot_time, 'open_languages')
216 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 120), 'left'])
217 await self._event(FunctionalTest.evt_time, 'mouseclick', ['italian', 'left'])
218 await self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
219 # volume
220 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 163), 'left'])
221 await self._event(FunctionalTest.evt_time, 'mouseclick', ['volume', 'left'])
222 await self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
223 # antialiasing
224 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
225 await self._event(FunctionalTest.evt_time, 'mouseclick', ['aa', 'left'])
226 await self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
227 # shadows
228 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
229 await self._event(FunctionalTest.evt_time, 'mouseclick', ['shadows', 'left'])
230 await self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
231 # test aa and shadows
232 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
233 await self._event(FunctionalTest.evt_time, 'mouseclick', ['back', 'left']) # back
234 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
235 await self._event(FunctionalTest.evt_time, 'mouseclick', ['play', 'left']) # play
236 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
237 await self._event(FunctionalTest.evt_time, 'mouseclick', ['domino', 'left']) # domino
238 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(900, 490), 'left']) # close instructions
239 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left']) # close instructions
240 await self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
241 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
242 await self._event(FunctionalTest.evt_time, 'mouseclick', ['home', 'left']) # home
243
244 async def _do_screenshots_restore_options(self):
245 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
246 await self._event(FunctionalTest.evt_time, 'mouseclick', ['options', 'left'])
247 await self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
248 # languages
249 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
250 await self._event(FunctionalTest.evt_time, 'mouseclick', ['languages', 'left'])
251 await self._screenshot(FunctionalTest.screenshot_time, 'open_languages_restored')
252 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 20), 'left'])
253 await self._event(FunctionalTest.evt_time, 'mouseclick', ['english', 'left'])
254 await self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
255 # volume
256 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(719, 163), 'left'])
257 await self._event(FunctionalTest.evt_time, 'mouseclick', ['volume_0', 'left'])
258 await self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
259 # fullscreen
260 # the first one is because of the windowed mode in test
261 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
262 await self._event(FunctionalTest.evt_time, 'mouseclick', ['fullscreen', 'left'])
263 await self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
264 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
265 await self._event(FunctionalTest.evt_time, 'mouseclick', ['fullscreen', 'left'])
266 await self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
267 #await self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(440, 120), 'left'])
268 #await self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
269 await self._event(FunctionalTest.evt_time, 'mouseclick', ['fullscreen', 'left'])
270 await self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
271 # resolution
272 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 340), 'left'])
273 await self._event(FunctionalTest.evt_time, 'mouseclick', ['resolutions', 'left'])
274 await self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
275 await self._enforce_resolution(FunctionalTest.evt_time, '1440x900')
276 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1000, 440), 'left'])
277 await self._event(FunctionalTest.evt_time, 'mouseclick', ['res_1440x900', 'left'])
278 await self._screenshot(FunctionalTest.screenshot_time, '1440x900')
279 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 400), 'left'])
280 await self._event(FunctionalTest.evt_time, 'mouseclick', ['resolutions', 'left'])
281 await self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
282 await self._enforce_resolution(FunctionalTest.evt_time, '1360x768')
283 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1110, 80), 'left'])
284 await self._event(FunctionalTest.evt_time, 'mouseclick', ['res_1360x768', 'left'])
285 await self._screenshot(FunctionalTest.screenshot_time, '1360x768')
286 # antialiasing
287 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
288 await self._event(FunctionalTest.evt_time, 'mouseclick', ['aa', 'left'])
289 await self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_yes')
290 # shadows
291 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
292 await self._event(FunctionalTest.evt_time, 'mouseclick', ['shadows', 'left'])
293 await self._screenshot(FunctionalTest.screenshot_time, 'shadows_yes')
294 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
295 await self._event(FunctionalTest.evt_time, 'mouseclick', ['back', 'left'])
296
297 async def _do_screenshots_play(self):
298 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
299 await self._event(FunctionalTest.evt_time, 'mouseclick', ['play', 'left'])
300 await self._screenshot(FunctionalTest.screenshot_time, 'play_menu')
301 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
302 await self._event(FunctionalTest.evt_time, 'mouseclick', ['back', 'left'])
303 await self._screenshot(FunctionalTest.screenshot_time, 'back_from_play')
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 scene
307 await self._event(FunctionalTest.evt_time, 'mouseclick', ['domino', 'left'])
308 await self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_instructions')
309 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
310 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
311 await self._screenshot(FunctionalTest.screenshot_time, 'scene_domino')
312 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
313 await self._event(FunctionalTest.evt_time, 'mouseclick', ['home', 'left'])
314 await self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_scene')
315 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
316 await self._event(FunctionalTest.evt_time, 'mouseclick', ['play', 'left'])
317 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
318 await self._event(FunctionalTest.evt_time, 'mouseclick', ['domino', 'left'])
319 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
320 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
321 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(70, 740), 'left']) # info
322 await self._event(FunctionalTest.evt_time, 'mouseclick', ['information', 'left'])
323 await self._screenshot(FunctionalTest.screenshot_time, 'info')
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.drag_time, 'mousedrag', [(35, 60), (430, 280), 'left']) # drag a piece
327 # await self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
328 # await self._event(FunctionalTest.evt_time, 'mouseclick', [(1220, 740), 'left']) # rewind
329 # await self._screenshot(FunctionalTest.screenshot_time, 'rewind')
330 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
331 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
332 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
333 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
334 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left']) # play
335 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino')
336 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
337 await self._event(FunctionalTest.evt_time, 'mouseclick', ['home_win', 'left']) # home
338 await self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
339 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
340 await self._event(FunctionalTest.evt_time, 'mouseclick', ['play', 'left']) # play
341 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
342 await self._event(FunctionalTest.evt_time, 'mouseclick', ['domino', 'left'])
343 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
344 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
345 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
346 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
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_1', 'left']) # drag a piece .49 .06
349 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
350 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left']) # play
351 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2')
352 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
353 await self._event(FunctionalTest.evt_time, 'mouseclick', ['replay', 'left']) # play
354 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (570, 380), 'left']) # drag a piece -1.54 .06
355 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a piece -1.54 .06
356 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(570, 355), (605, 355), 'right']) # rotate the piece -1.05 .4
357 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_1', 'drag_stop_3', 'right']) # rotate the piece -1.54 .4 -1.05 .4
358 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
359 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a piece
360 await self._enforce_result(FunctionalTest.evt_time, 'win')
361 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
362 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left']) # play
363 await self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino')
364 await self._enforce_result(FunctionalTest.evt_time, '')
365 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
366 await self._event(FunctionalTest.evt_time, 'mouseclick', ['next', 'left']) # play
367 await self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
368 # scene 2
369 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 490), 'left']) # close instructions
370 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
371 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box .42 -3.29
372 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box .42 -3.29
373 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box .42 -2.18
374 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box .42 -2.18
375 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
376 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
377 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box')
378 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
379 await self._event(FunctionalTest.evt_time, 'mouseclick', ['replay', 'left'])
380 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box
381 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
382 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box
383 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box
384 # await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (705, 460), 'left']) # drag a box .35 -1.06
385 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a box .35 -1.06
386 await self._enforce_result(FunctionalTest.evt_time, 'win')
387 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
388 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
389 await self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box')
390 await self._enforce_result(FunctionalTest.evt_time, '')
391 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
392 await self._event(FunctionalTest.evt_time, 'mouseclick', ['next', 'left'])
393 await self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
394 # scene 3
395 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
396 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
397 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box 3.21 -.78
398 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box 3.21 -.78
399 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 360), 'left']) # drag a box 3.21 .33
400 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box 3.21 .33
401 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
402 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
403 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino')
404 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
405 await self._event(FunctionalTest.evt_time, 'mouseclick', ['replay', 'left'])
406 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box
407 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
408 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (835, 250), 'left']) # drag a box 2.16 1.87
409 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_2', 'left']) # drag a box 2.16 1.87
410 await self._enforce_result(FunctionalTest.evt_time, 'win')
411 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
412 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
413 await self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box_domino')
414 await self._enforce_result(FunctionalTest.evt_time, '')
415 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
416 await self._event(FunctionalTest.evt_time, 'mouseclick', ['next', 'left'])
417 await self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
418 # scene 4
419 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 490), 'left']) # close instructions
420 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
421 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (650, 310), 'left']) # drag a ball -.42 1.03
422 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a ball -.42 1.03
423 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
424 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
425 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball')
426 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
427 await self._event(FunctionalTest.evt_time, 'mouseclick', ['replay', 'left'])
428 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (380, 50), 'left']) # drag a ball -4.19 4.66
429 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a ball -4.19 4.66
430 await self._enforce_result(FunctionalTest.evt_time, 'win')
431 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
432 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
433 await self._screenshot(16 + FunctionalTest.screenshot_time, 'win_basketball')
434 await self._enforce_result(FunctionalTest.evt_time, '')
435 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
436 await self._event(FunctionalTest.evt_time, 'mouseclick', ['next', 'left'])
437 await self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
438 # scene 5
439 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(865, 490), 'left']) # close instructions
440 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
441 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box -1.4 -.78
442 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -1.4 -.78
443 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (590, 370), 'left']) # drag a piece -1.26 .2
444 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_1', 'drag_stop_1', 'left']) # drag a piece -1.26 .2
445 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
446 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
447 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
448 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
449 await self._event(FunctionalTest.evt_time, 'mouseclick', ['replay', 'left'])
450 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box
451 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box
452 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (660, 440), 'left']) # drag a piece -.28 -.78
453 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_1', 'drag_stop_2', 'left']) # drag a piece -.28 -.78
454 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 425), (625, 425), 'right']) # rotate a piece -.28 -.57 -.77 -.57
455 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_2', 'drag_stop_3', 'right']) # rotate a piece -.28 -.57 -.77 -.57
456 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 435), (650, 445), 'left']) # drag a piece -.28 -.85 -.42 -.85
457 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_3', 'drag_stop_4', 'left']) # drag a piece -.28 -.85 -.42 -.85
458 await self._enforce_result(FunctionalTest.evt_time, 'win')
459 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
460 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
461 await self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino_box_basketball')
462 await self._enforce_result(FunctionalTest.evt_time, '')
463 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
464 await self._event(FunctionalTest.evt_time, 'mouseclick', ['next', 'left'])
465 await self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
466 # scene 6
467 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 485), 'left']) # close instructions
468 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
469 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 300), 'left']) # drag a box -2.65 1.18
470 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -2.65 1.18
471 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
472 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
473 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
474 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
475 await self._event(FunctionalTest.evt_time, 'mouseclick', ['replay', 'left'])
476 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 150), 'left']) # drag a box -2.65 3.27
477 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box -2.65 3.27
478 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(515, 115), (515, 122), 'right']) # rotate a box -2.3 3.75 -2.5 3.66
479 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
480 await self._enforce_result(FunctionalTest.evt_time, 'win')
481 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
482 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
483 await self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
484 await self._enforce_result(FunctionalTest.evt_time, '')
485 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
486 await self._event(FunctionalTest.evt_time, 'mouseclick', ['next', 'left'])
487 await self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
488 # scene 7
489 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
490 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
491 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (155, 180), 'left']) # drag a box -7.33 4.24
492 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_0', 'left']) # drag a box -7.33 4.24
493 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
494 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
495 await self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
496 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
497 await self._event(FunctionalTest.evt_time, 'mouseclick', ['replay', 'left'])
498 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (170, 80), 'left']) # drag a box -7.12 4.24
499 await self._event(FunctionalTest.drag_time, 'mousedrag', ['drag_start_0', 'drag_stop_1', 'left']) # drag a box -7.12 4.24
500 #await self._event(FunctionalTest.drag_time, 'mousedrag', [(195, 50), (195, 80), 'right']) # rotate a box -6.77 4.66 -6.77 4.24
501 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
502 await self._enforce_result(FunctionalTest.evt_time, 'win')
503 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
504 await self._event(FunctionalTest.evt_time, 'mouseclick', ['right', 'left'])
505 await self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
506 await self._enforce_result(FunctionalTest.evt_time, '')
507 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
508 await self._event(FunctionalTest.evt_time, 'mouseclick', ['home_win', 'left'])
509 await self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
510
511 async def _do_screenshots_exit(self):
512 await self._verify(FunctionalTest.evt_time)
513 #await self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 600), 'left'])
514 await self._event(FunctionalTest.evt_time, 'mouseclick', ['exit', 'left'])
515 await self._exit(FunctionalTest.evt_time)
516
517 async def _do_screenshots_2(self):
518 info('_do_screenshots_2')
519 await self._screenshot(FunctionalTest.start_time, 'main_menu_2')
520 await self._do_screenshots_restore_options()
521 await self._do_screenshots_play()
522 await self._do_screenshots_exit()
523
524 async def _do_screenshots_editor(self):
525 await self._event(FunctionalTest.evt_time, 'mouseclick', ['play', 'left'])
526 await self._event(FunctionalTest.evt_time, 'mouseclick', ['domino', 'left'])
527 await self._event(FunctionalTest.evt_time, 'mouseclick', ['close_instructions', 'left'])
528 await self._event(FunctionalTest.evt_time, 'mouseclick', ['wrench', 'left'])
529 await self._screenshot(FunctionalTest.start_time, 'editor_scene')
530 await self._event(FunctionalTest.evt_time, 'mouseclick', ['collapse_button_scene', 'left'])
531 await self._screenshot(FunctionalTest.start_time, 'editor_scene_collapsed')
532 await self._event(FunctionalTest.evt_time, 'mouseclick', ['collapse_button_scene', 'left'])
533 await self._screenshot(FunctionalTest.start_time, 'editor_scene_expanded')
534 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_save', 'left'])
535 await self._screenshot(FunctionalTest.start_time, 'editor_scene_save')
536 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_scene_filename', 'left'])
537 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
538 await self._screenshot(FunctionalTest.start_time, 'editor_scene_filename_changed')
539 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_scene_filename', 'left'])
540 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'Return'])
541 await self._screenshot(FunctionalTest.start_time, 'editor_scene_filename_restored')
542 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_scene_name', 'left'])
543 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
544 await self._screenshot(FunctionalTest.start_time, 'editor_scene_name_changed')
545 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_scene_name', 'left'])
546 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'Return'])
547 await self._screenshot(FunctionalTest.start_time, 'editor_scene_name_restored')
548 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_scene_instructions', 'left'])
549 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return', 'BackSpace', 'BackSpace', 'BackSpace', 'BackSpace'])
550 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_sorting', 'left'])
551 await self._screenshot(FunctionalTest.start_time, 'editor_sorting')
552 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_sorting_text', 'left'])
553 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
554 await self._screenshot(FunctionalTest.start_time, 'editor_sorting_changed')
555 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_sorting_text', 'left'])
556 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'BackSpace'])
557 await self._screenshot(FunctionalTest.start_time, 'editor_sorting_restored')
558 await self._event(FunctionalTest.evt_time, 'mouseclick', ['collapse_button_sorting', 'left'])
559 await self._screenshot(FunctionalTest.start_time, 'editor_sorting_collapsed')
560 await self._event(FunctionalTest.evt_time, 'mouseclick', ['collapse_button_sorting', 'left'])
561 await self._screenshot(FunctionalTest.start_time, 'editor_sorting_expanded')
562 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_sorting_save', 'left'])
563 await self._screenshot(FunctionalTest.start_time, 'editor_sorting_save')
564 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_sorting_close', 'left'])
565 await self._screenshot(FunctionalTest.start_time, 'editor_sorting_closed')
566 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start', 'left'])
567 await self._screenshot(FunctionalTest.start_time, 'editor_start')
568 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_class', 'left'])
569 await self._screenshot(FunctionalTest.screenshot_time, 'editor_start_class')
570 await self._event(FunctionalTest.evt_time, 'mouseclick', ['start_class_box', 'left'])
571 await self._screenshot(FunctionalTest.screenshot_time, 'editor_start_class_box')
572 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_strategy', 'left'])
573 await self._screenshot(FunctionalTest.screenshot_time, 'editor_start_strategy')
574 await self._event(FunctionalTest.evt_time, 'mouseclick', ['start_strategy_upstrategy', 'left'])
575 await self._screenshot(FunctionalTest.screenshot_time, 'editor_start_strategy_up')
576 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_count', 'left'])
577 await self._event(FunctionalTest.evt_time, 'keyboard', ['0', 'Return'])
578 await self._screenshot(FunctionalTest.start_time, 'editor_start_count_modified')
579 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_count', 'left'])
580 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
581 await self._screenshot(FunctionalTest.start_time, 'editor_start_count_restored')
582 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_scale', 'left'])
583 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
584 await self._screenshot(FunctionalTest.start_time, 'editor_start_scale_modified')
585 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_scale', 'left'])
586 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
587 await self._screenshot(FunctionalTest.start_time, 'editor_start_scale_restored')
588 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_mass', 'left'])
589 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
590 await self._screenshot(FunctionalTest.start_time, 'editor_start_mass_modified')
591 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_mass', 'left'])
592 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
593 await self._screenshot(FunctionalTest.start_time, 'editor_start_mass_restored')
594 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_restitution', 'left'])
595 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
596 await self._screenshot(FunctionalTest.start_time, 'editor_start_restitution_modifed')
597 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_restitution', 'left'])
598 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
599 await self._screenshot(FunctionalTest.start_time, 'editor_start_restitution_restored')
600 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_friction', 'left'])
601 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
602 await self._screenshot(FunctionalTest.start_time, 'editor_start_friction_modified')
603 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_friction', 'left'])
604 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
605 await self._screenshot(FunctionalTest.start_time, 'editor_start_friction_restored')
606 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_id', 'left'])
607 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
608 await self._screenshot(FunctionalTest.start_time, 'editor_start_id_modified')
609 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_id', 'left'])
610 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'Return'])
611 await self._screenshot(FunctionalTest.start_time, 'editor_start_id_restored')
612 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_strategy_args', 'left'])
613 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
614 await self._screenshot(FunctionalTest.start_time, 'editor_start_strategy_args_modified')
615 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_strategy_args', 'left'])
616 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'Return'])
617 await self._screenshot(FunctionalTest.start_time, 'editor_start_strategy_args_restored')
618 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_save', 'left'])
619 await self._screenshot(FunctionalTest.start_time, 'editor_start_save')
620 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_next', 'left'])
621 await self._screenshot(FunctionalTest.start_time, 'editor_start_next')
622 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_new', 'left'])
623 await self._screenshot(FunctionalTest.start_time, 'editor_start_new')
624 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_delete', 'left'])
625 await self._screenshot(FunctionalTest.start_time, 'editor_start_delete')
626 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_start_close', 'left'])
627 await self._screenshot(FunctionalTest.start_time, 'editor_start_close')
628 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_new', 'left'])
629 await self._event(FunctionalTest.evt_time, 'mouseclick', ['collapse_button_scene', 'left'])
630 await self._event(FunctionalTest.evt_time, 'mouseclick', ['test_piece', 'left'])
631 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_strategy', 'left'])
632 await self._screenshot(FunctionalTest.screenshot_time, 'editor_inspector_strategy')
633 await self._event(FunctionalTest.evt_time, 'mouseclick', ['inspector_strategy_upstrategy', 'left'])
634 await self._screenshot(FunctionalTest.screenshot_time, 'editor_inspector_strategy_up')
635 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_position', 'left'])
636 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
637 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_position_modified')
638 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_position', 'left'])
639 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
640 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_position_restored')
641 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_roll', 'left'])
642 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
643 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_roll_modified')
644 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_roll', 'left'])
645 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
646 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_roll_restored')
647 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_scale', 'left'])
648 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
649 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_scale_modified')
650 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_scale', 'left'])
651 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
652 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_scale_restored')
653 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_mass', 'left'])
654 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
655 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_mass_modified')
656 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_mass', 'left'])
657 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
658 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_mass_restored')
659 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_restitution', 'left'])
660 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
661 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_restitution_modifed')
662 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_restitution', 'left'])
663 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
664 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_restitution_restored')
665 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_friction', 'left'])
666 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
667 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_friction_modified')
668 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_friction', 'left'])
669 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
670 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_friction_restored')
671 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_id', 'left'])
672 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
673 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_id_modified')
674 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_id', 'left'])
675 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'Return'])
676 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_id_restored')
677 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_strategy_args', 'left'])
678 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
679 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_strategy_args_modified')
680 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_strategy_args', 'left'])
681 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'Return'])
682 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_strategy_args_restored')
683 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_delete', 'left'])
684 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_delete')
685 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_close', 'left'])
686 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_close')
687 await self._event(FunctionalTest.evt_time, 'mouseclick', ['drag_stop_0', 'left'])
688 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_test_position', 'left'])
689 await self._event(FunctionalTest.evt_time, 'keyboard', ['1', 'Return'])
690 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_test_position_modified')
691 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_test_position', 'left'])
692 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'Return'])
693 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_test_position_restored')
694 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_test_id', 'left'])
695 await self._event(FunctionalTest.evt_time, 'keyboard', ['a', 'b', 'c', 'Return'])
696 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_test_id_modified')
697 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_test_id', 'left'])
698 await self._event(FunctionalTest.evt_time, 'keyboard', ['BackSpace', 'BackSpace', 'BackSpace', 'Return'])
699 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_test_id_restored')
700 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_test_delete', 'left'])
701 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_test_delete')
702 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_inspector_test_close', 'left'])
703 await self._screenshot(FunctionalTest.start_time, 'editor_inspector_test_close')
704 await self._screenshot(FunctionalTest.start_time, 'editor_new')
705 await self._event(FunctionalTest.evt_time, 'mouseclick', ['wrench', 'left'])
706 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_new_item', 'left'])
707 await self._screenshot(FunctionalTest.screenshot_time, 'editor_new_item')
708 await self._event(FunctionalTest.evt_time, 'mouseclick', ['new_item_box', 'left'])
709 await self._screenshot(FunctionalTest.screenshot_time, 'editor_new_item')
710 await self._event(FunctionalTest.evt_time, 'mouseclick', ['editor_close', 'left'])
711 await self._screenshot(FunctionalTest.start_time, 'editor_close')
712 await self._screenshot(FunctionalTest.start_time, 'editor_scene_new')
713 await self._event(FunctionalTest.evt_time, 'mouseclick', ['home', 'left'])
714 await self._screenshot(FunctionalTest.start_time, 'home_from_editor')
715
716 async def _do_screenshots_3(self):
717 info('_do_screenshots_3')
718 await self._screenshot(FunctionalTest.start_time, 'main_menu_3')
719 await self._do_screenshots_editor()
720 await self._do_screenshots_exit()
721
722 def _do_screenshots(self, idx):
723 asyncio.run(
724 [self._do_screenshots_1, self._do_screenshots_2, self._do_screenshots_3][int(idx) - 1]()
725 )
726
727
728 class TestApp(ShowBase):
729
730 def __init__(self):
731 ShowBase.__init__(self)
732 offset = int(argv[2]) if len(argv) >= 3 else 0
733 FunctionalTest(int(argv[1]), offset)
734
735
736 TestApp().run()