ya2 · news · projects · code · about

xmlrpc
[pmachines.git] / tests / functional_test.py
CommitLineData
361d3942
FC
1'''Create ref:
2* M-x fla-set-fun-test
3* rm options.ini
53ddf3c3
FC
4* python main.py --functional-test --functional-ref & python -m ya2.tools.functional_test.py 1
5* python main.py --functional-test --functional-ref & python -m ya2.tools.functional_test.py 2
361d3942
FC
6* M-x fla-unset-fun-test'''
7from panda3d.core import load_prc_file_data
8load_prc_file_data('', 'window-type none')
9import datetime
10from time import sleep
11from os import getcwd, system
158b04a8 12from xmlrpc.client import ServerProxy
361d3942
FC
13from logging import debug, info
14from pathlib import Path
15from shutil import rmtree
16from os import makedirs
17from os.path import join, exists
18from glob import glob
19from sys import exit, argv
20from panda3d.core import Filename
21from direct.showbase.ShowBase import ShowBase
22from direct.gui.OnscreenText import OnscreenText
b35b1f62 23from ya2.patterns.gameobject import GameObject
53ddf3c3 24from ya2.build.build import _branch
361d3942
FC
25
26
27class FunctionalTest(GameObject):
28
29 screenshot_time = 1.2
30 evt_time = 1.0
31 drag_time = 1.0
32 start_time = 2
33
68f6c184 34 def __init__(self, idx, offset):
361d3942
FC
35 super().__init__()
36 info('test idx: %s' % idx)
68f6c184 37 self._offset = offset
361d3942 38 sleep(5)
158b04a8 39 self._proxy = ServerProxy('http://localhost:6000')
361d3942
FC
40 self._curr_time = 0
41 self._tasks = []
42 self._prev_time = 0
43 taskMgr.add(self.on_frame_unpausable, 'on-frame-unpausable')
158b04a8 44 self._proxy.set_idx(idx)
361d3942
FC
45 self._do_screenshots(idx)
46
47 def _do_screenshot(self, name):
48 time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
49 name = name + '.png'
158b04a8 50 self._proxy.screenshot(name)
361d3942
FC
51 info('screenshot %s' % name)
52
53 def _screenshot(self, time, name):
54 self._tasks += [(
55 self._curr_time + time,
56 lambda: self._do_screenshot(name),
57 'screenshot: %s' % name)]
58 self._curr_time += time
59
60 def __mouse_click(self, pos, btn):
2e5f0efc
FC
61 offset_x = int((1920 - 1360) / 2) #+ 1 # xfce decorations
62 offset_y = int((1080 - 768) / 2) #+ 24 + self._offset # xfce decorations
361d3942
FC
63 btn = 3 if btn == 'right' else 1
64 system('xdotool mousemove %s %s' % (offset_x + pos[0], offset_y + pos[1]))
65 def click(task):
66 system('xdotool click %s' % btn)
c8e3e941 67 taskMgr.do_method_later(.28, click, 'click')
361d3942
FC
68
69 def __mouse_drag(self, start, end, btn):
2e5f0efc
FC
70 offset_x = int((1920 - 1360) / 2) #+ 1 # xfce decorations
71 offset_y = int((1080 - 768) / 2) #+ 24 + self._offset # xfce decorations
361d3942
FC
72 btn = 3 if btn == 'right' else 1
73 system('xdotool mousemove %s %s' % (offset_x + start[0], offset_y + start[1]))
74 def mousedown(task):
75 system('xdotool mousedown %s' % btn)
76 def mousemove(task):
77 system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
78 def mouseup(task):
79 system('xdotool mouseup %s' % btn)
80 taskMgr.do_method_later(.28, mouseup, 'mouseup')
81 taskMgr.do_method_later(.28, mousemove, 'mousemove')
82 taskMgr.do_method_later(.28, mousedown, 'mousedown')
83
84 def _event(self, time, evt, mouse_args=None):
85 if evt == 'mouseclick':
86 cback = lambda: self.__mouse_click(*mouse_args)
87 elif evt == 'mousedrag':
88 cback = lambda: self.__mouse_drag(*mouse_args)
89 self._tasks += [(
90 self._curr_time + time,
91 cback,
92 'event: %s' % evt)]
93 self._curr_time += time
94
95 def _enforce_res(self, time, res):
96 def cback():
158b04a8 97 self._proxy.enforce_res(res)
361d3942
FC
98 info('enforce_res %s' % res)
99 self._tasks += [(
100 self._curr_time + time,
101 cback,
102 'enforce res: %s' % res)]
103 self._curr_time += time
104
74ed9732
FC
105 def _enforce_resolution(self, time, res):
106 def cback():
158b04a8 107 self._proxy.enforce_resolution(res)
74ed9732
FC
108 info('enforce_resolution %s (send)' % res)
109 self._tasks += [(
110 self._curr_time + time,
111 cback,
112 'enforce resolution: %s' % res)]
113 self._curr_time += time
114
361d3942
FC
115 def _verify(self):
116 def __verify():
158b04a8 117 self._proxy.verify()
361d3942
FC
118 info('verify')
119 self._tasks += [(
120 self._curr_time + 3,
121 lambda: __verify(),
122 'verify')]
123 self._curr_time += 3
124
125 def _exit(self):
126 def do_exit():
158b04a8 127 self._proxy.close()
361d3942
FC
128 exit()
129 self._tasks += [(
130 self._curr_time + 3,
131 lambda: do_exit(),
132 'exit')]
133
134 def on_frame_unpausable(self, task):
135 for tsk in self._tasks:
136 #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time:
137 if self._prev_time <= tsk[0] < globalClock.getFrameTime():
138 debug('%s %s' % (tsk[0], tsk[2]))
139 tsk[1]()
140 self._prev_time = globalClock.getFrameTime() # self.eng.event.unpaused_time
141 return task.cont
142
143 def _do_screenshots_1(self):
144 info('_do_screenshots_1')
145 self._screenshot(FunctionalTest.start_time, 'main_menu')
158b04a8
FC
146 #self._do_screenshots_credits()
147 #self._do_screenshots_options()
361d3942
FC
148 self._do_screenshots_exit()
149
150 def _do_screenshots_credits(self):
151 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left'])
152 self._screenshot(FunctionalTest.screenshot_time, 'credits_menu')
153 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left'])
154 self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits')
155
156 def _do_screenshots_options(self):
157 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
158 self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
159 # languages
160 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
161 self._screenshot(FunctionalTest.screenshot_time, 'open_languages')
162 self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 120), 'left'])
163 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
164 # volume
165 self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 163), 'left'])
166 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
167 # antialiasing
168 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
169 self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
170 # shadows
171 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
172 self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
173 # test aa and shadows
174 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
175 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
176 self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
177 self._event(FunctionalTest.evt_time, 'mouseclick', [(900, 490), 'left']) # close instructions
178 self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
179 self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
180
181 def _do_screenshots_restore_options(self):
182 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left'])
183 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored')
184 # languages
185 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left'])
186 self._screenshot(FunctionalTest.screenshot_time, 'open_languages_restored')
187 self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 20), 'left'])
188 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
189 # volume
190 self._event(FunctionalTest.evt_time, 'mouseclick', [(719, 163), 'left'])
191 self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
192 # fullscreen
193 # the first one is because of the windowed mode in test
e982cdde
FC
194 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
195 self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
196 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
197 self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
5d67a04d
FC
198 #self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(440, 120), 'left'])
199 self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
e982cdde 200 self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
361d3942 201 # resolution
bd238983
FC
202 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 340), 'left'])
203 self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
74ed9732 204 self._enforce_resolution(FunctionalTest.evt_time, '1440x900')
5d67a04d 205 self._event(FunctionalTest.evt_time, 'mouseclick', [(1000, 440), 'left'])
bd238983
FC
206 self._screenshot(FunctionalTest.screenshot_time, '1440x900')
207 self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 400), 'left'])
208 self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
74ed9732 209 self._enforce_resolution(FunctionalTest.evt_time, '1360x768')
bd238983
FC
210 self._event(FunctionalTest.evt_time, 'mouseclick', [(1110, 80), 'left'])
211 self._screenshot(FunctionalTest.screenshot_time, '1360x768')
361d3942
FC
212 # antialiasing
213 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left'])
214 self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_yes')
215 # shadows
216 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left'])
217 self._screenshot(FunctionalTest.screenshot_time, 'shadows_yes')
218 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
219
220 def _do_screenshots_play(self):
221 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
222 self._screenshot(FunctionalTest.screenshot_time, 'play_menu')
223 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back
224 self._screenshot(FunctionalTest.screenshot_time, 'back_from_play')
225 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
226 self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino scene
227 self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_instructions')
228 self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
229 self._screenshot(FunctionalTest.screenshot_time, 'scene_domino')
230 self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home
231 self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_scene')
232 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
233 self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
234 self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
235 self._event(FunctionalTest.evt_time, 'mouseclick', [(70, 740), 'left']) # info
236 self._screenshot(FunctionalTest.screenshot_time, 'info')
237 self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
f26497a5
FC
238 # self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (430, 280), 'left']) # drag a piece
239 # self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged')
240 # self._event(FunctionalTest.evt_time, 'mouseclick', [(1220, 740), 'left']) # rewind
241 # self._screenshot(FunctionalTest.screenshot_time, 'rewind')
361d3942
FC
242 self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
243 # self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
244 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
245 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino')
246 self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
247 self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
248 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play
249 self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino
250 self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions
251 self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece
252 self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
253 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
254 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2')
255 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
256 self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (570, 380), 'left']) # drag a piece
257 self._event(FunctionalTest.drag_time, 'mousedrag', [(570, 355), (605, 355), 'right']) # rotate the piece
258 self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece
259 self._enforce_res(FunctionalTest.evt_time, 'win')
260 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
261 self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino')
262 self._enforce_res(FunctionalTest.evt_time, '')
263 self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
264 self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
265 # scene 2
266 self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 490), 'left']) # close instructions
267 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box
268 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box
269 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
270 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box')
271 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
272 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box
273 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box
274 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (705, 460), 'left']) # drag a box
275 self._enforce_res(FunctionalTest.evt_time, 'win')
276 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
277 self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box')
278 self._enforce_res(FunctionalTest.evt_time, '')
279 self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
280 self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
281 # scene 3
282 self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
283 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box
284 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 360), 'left']) # drag a box
285 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
286 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino')
287 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
288 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box
289 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (835, 250), 'left']) # drag a box
290 self._enforce_res(FunctionalTest.evt_time, 'win')
291 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
292 self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box_domino')
293 self._enforce_res(FunctionalTest.evt_time, '')
294 self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
295 self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
296 # scene 4
297 self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 490), 'left']) # close instructions
298 self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (650, 310), 'left']) # drag a ball
299 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
300 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball')
301 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
302 self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (380, 50), 'left']) # drag a ball
303 self._enforce_res(FunctionalTest.evt_time, 'win')
304 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
305 self._screenshot(16 + FunctionalTest.screenshot_time, 'win_basketball')
306 self._enforce_res(FunctionalTest.evt_time, '')
307 self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
308 self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
309 # scene 5
310 self._event(FunctionalTest.evt_time, 'mouseclick', [(865, 490), 'left']) # close instructions
311 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box
312 self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (590, 370), 'left']) # drag a piece
313 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
314 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
315 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
316 self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box
317 self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (660, 440), 'left']) # drag a piece
318 self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 425), (625, 425), 'right']) # rotate a piece
319 self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 435), (650, 445), 'left']) # drag a piece
320 self._enforce_res(FunctionalTest.evt_time, 'win')
321 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
322 self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino_box_basketball')
323 self._enforce_res(FunctionalTest.evt_time, '')
39a6176f
FC
324 self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
325 self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
326 # scene 6
327 self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 485), 'left']) # close instructions
328 self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 300), 'left']) # drag a box
329 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
330 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
331 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
332 self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 150), 'left']) # drag a box
333 self._event(FunctionalTest.drag_time, 'mousedrag', [(515, 115), (515, 122), 'right']) # rotate a box
334 self._enforce_res(FunctionalTest.evt_time, 'win')
335 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
336 self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
337 self._enforce_res(FunctionalTest.evt_time, '')
338 self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next
339 self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
340 # scene 7
341 self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions
342 self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (155, 180), 'left']) # drag a box
343 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
344 self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
345 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay
346 self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (170, 80), 'left']) # drag a box
347 self._event(FunctionalTest.drag_time, 'mousedrag', [(195, 50), (195, 80), 'right']) # rotate a box
348 self._enforce_res(FunctionalTest.evt_time, 'win')
349 self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play
350 self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
351 self._enforce_res(FunctionalTest.evt_time, '')
361d3942
FC
352 self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home
353 self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
354
355 def _exit(self):
356 self._tasks += [(
357 self._curr_time + 3,
358 lambda: exit(),
359 'exit')]
360
361 def _do_screenshots_exit(self):
362 self._verify()
363 self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 600), 'left'])
364 self._exit()
365
366 def _do_screenshots_2(self):
367 info('_do_screenshots_2')
368 self._screenshot(FunctionalTest.start_time, 'main_menu_2')
369 self._do_screenshots_restore_options()
370 self._do_screenshots_play()
371 self._do_screenshots_exit()
372
373 def _do_screenshots(self, idx):
374 [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]()
375
376
377class TestApp(ShowBase):
378
379 def __init__(self):
380 ShowBase.__init__(self)
68f6c184
FC
381 offset = int(argv[2]) if len(argv) >= 3 else 0
382 fun_test = FunctionalTest(int(argv[1]), offset)
361d3942
FC
383
384
385TestApp().run()