ya2 · news · projects · code · about

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