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