Commit | Line | Data |
---|---|---|
361d3942 FC |
1 | '''Create ref: |
2 | * M-x fla-set-fun-test | |
3 | * rm options.ini | |
4 | * python main.py --functional-test 1 --functional-ref | |
5 | * python main.py --functional-test 2 --functional-ref | |
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') | |
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' | |
50 | self._conn.send(['screenshot', name]) | |
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(): | |
97 | self._conn.send(['enforce_res', res]) | |
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 | ||
105 | def _verify(self): | |
106 | def __verify(): | |
107 | self._conn.send(['verify']) | |
108 | info('verify') | |
109 | self._tasks += [( | |
110 | self._curr_time + 3, | |
111 | lambda: __verify(), | |
112 | 'verify')] | |
113 | self._curr_time += 3 | |
114 | ||
115 | def _exit(self): | |
116 | def do_exit(): | |
117 | self._conn.close() | |
118 | exit() | |
119 | self._tasks += [( | |
120 | self._curr_time + 3, | |
121 | lambda: do_exit(), | |
122 | 'exit')] | |
123 | ||
124 | def on_frame_unpausable(self, task): | |
125 | for tsk in self._tasks: | |
126 | #if self._prev_time <= tsk[0] < self.eng.event.unpaused_time: | |
127 | if self._prev_time <= tsk[0] < globalClock.getFrameTime(): | |
128 | debug('%s %s' % (tsk[0], tsk[2])) | |
129 | tsk[1]() | |
130 | self._prev_time = globalClock.getFrameTime() # self.eng.event.unpaused_time | |
131 | return task.cont | |
132 | ||
133 | def _do_screenshots_1(self): | |
134 | info('_do_screenshots_1') | |
135 | self._screenshot(FunctionalTest.start_time, 'main_menu') | |
136 | self._do_screenshots_credits() | |
137 | self._do_screenshots_options() | |
138 | self._do_screenshots_exit() | |
139 | ||
140 | def _do_screenshots_credits(self): | |
141 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) | |
142 | self._screenshot(FunctionalTest.screenshot_time, 'credits_menu') | |
143 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) | |
144 | self._screenshot(FunctionalTest.screenshot_time, 'main_menu_back_from_credits') | |
145 | ||
146 | def _do_screenshots_options(self): | |
147 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left']) | |
148 | self._screenshot(FunctionalTest.screenshot_time, 'options_menu') | |
149 | # languages | |
150 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left']) | |
151 | self._screenshot(FunctionalTest.screenshot_time, 'open_languages') | |
152 | self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 120), 'left']) | |
153 | self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian') | |
154 | # volume | |
155 | self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 163), 'left']) | |
156 | self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1') | |
157 | # antialiasing | |
158 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left']) | |
159 | self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no') | |
160 | # shadows | |
161 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left']) | |
162 | self._screenshot(FunctionalTest.screenshot_time, 'shadows_no') | |
163 | # test aa and shadows | |
164 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back | |
165 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play | |
166 | self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino | |
167 | self._event(FunctionalTest.evt_time, 'mouseclick', [(900, 490), 'left']) # close instructions | |
168 | self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no') | |
169 | self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home | |
170 | ||
171 | def _do_screenshots_restore_options(self): | |
172 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 300), 'left']) | |
173 | self._screenshot(FunctionalTest.screenshot_time, 'options_menu_restored') | |
174 | # languages | |
175 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 60), 'left']) | |
176 | self._screenshot(FunctionalTest.screenshot_time, 'open_languages_restored') | |
177 | self._event(FunctionalTest.evt_time, 'mouseclick', [(980, 20), 'left']) | |
178 | self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english') | |
179 | # volume | |
180 | self._event(FunctionalTest.evt_time, 'mouseclick', [(719, 163), 'left']) | |
181 | self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2') | |
182 | # fullscreen | |
183 | # the first one is because of the windowed mode in test | |
398ba4a9 FC |
184 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left']) |
185 | self._screenshot(FunctionalTest.screenshot_time, 'fullscreen') | |
186 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left']) | |
187 | self._screenshot(FunctionalTest.screenshot_time, 'fullscreen') | |
188 | self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(440, 120), 'left']) | |
189 | self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen') | |
361d3942 FC |
190 | # resolution |
191 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 340), 'left']) | |
192 | # self._screenshot(FunctionalTest.screenshot_time, 'resolutions') | |
193 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(1020, 160), 'left']) | |
194 | # self._screenshot(FunctionalTest.screenshot_time, '1440x900') | |
195 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(740, 400), 'left']) | |
196 | # self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2') | |
197 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(1110, 80), 'left']) | |
198 | # self._screenshot(FunctionalTest.screenshot_time, '1360x768') | |
199 | # antialiasing | |
200 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 440), 'left']) | |
201 | self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_yes') | |
202 | # shadows | |
203 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 540), 'left']) | |
204 | self._screenshot(FunctionalTest.screenshot_time, 'shadows_yes') | |
205 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back | |
206 | ||
207 | def _do_screenshots_play(self): | |
208 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play | |
209 | self._screenshot(FunctionalTest.screenshot_time, 'play_menu') | |
210 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 680), 'left']) # back | |
211 | self._screenshot(FunctionalTest.screenshot_time, 'back_from_play') | |
212 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play | |
213 | self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino scene | |
214 | self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_instructions') | |
215 | self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions | |
216 | self._screenshot(FunctionalTest.screenshot_time, 'scene_domino') | |
217 | self._event(FunctionalTest.evt_time, 'mouseclick', [(25, 740), 'left']) # home | |
218 | self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_scene') | |
219 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play | |
220 | self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino | |
221 | self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions | |
222 | self._event(FunctionalTest.evt_time, 'mouseclick', [(70, 740), 'left']) # info | |
223 | self._screenshot(FunctionalTest.screenshot_time, 'info') | |
224 | self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions | |
225 | self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (430, 280), 'left']) # drag a piece | |
226 | self._screenshot(FunctionalTest.screenshot_time, 'domino_dragged') | |
227 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1220, 740), 'left']) # rewind | |
228 | self._screenshot(FunctionalTest.screenshot_time, 'rewind') | |
229 | self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece | |
230 | # self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece | |
231 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
232 | self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino') | |
233 | self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home | |
234 | self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail') | |
235 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 140), 'left']) # play | |
236 | self._event(FunctionalTest.evt_time, 'mouseclick', [(230, 160), 'left']) # domino | |
237 | self._event(FunctionalTest.evt_time, 'mouseclick', [(850, 490), 'left']) # close instructions | |
238 | self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (550, 380), 'left']) # drag a piece | |
239 | self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece | |
240 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
241 | self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2') | |
242 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay | |
243 | self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (570, 380), 'left']) # drag a piece | |
244 | self._event(FunctionalTest.drag_time, 'mousedrag', [(570, 355), (605, 355), 'right']) # rotate the piece | |
245 | self._event(FunctionalTest.drag_time, 'mousedrag', [(35, 60), (715, 380), 'left']) # drag a piece | |
246 | self._enforce_res(FunctionalTest.evt_time, 'win') | |
247 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
248 | self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino') | |
249 | self._enforce_res(FunctionalTest.evt_time, '') | |
250 | self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next | |
251 | self._screenshot(FunctionalTest.screenshot_time, 'scene_box') | |
252 | # scene 2 | |
253 | self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 490), 'left']) # close instructions | |
254 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box | |
255 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box | |
256 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
257 | self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box') | |
258 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay | |
259 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 620), 'left']) # drag a box | |
260 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (710, 540), 'left']) # drag a box | |
261 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (705, 460), 'left']) # drag a box | |
262 | self._enforce_res(FunctionalTest.evt_time, 'win') | |
263 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
264 | self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box') | |
265 | self._enforce_res(FunctionalTest.evt_time, '') | |
266 | self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next | |
267 | self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino') | |
268 | # scene 3 | |
269 | self._event(FunctionalTest.evt_time, 'mouseclick', [(930, 485), 'left']) # close instructions | |
270 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box | |
271 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 360), 'left']) # drag a box | |
272 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
273 | self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino') | |
274 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay | |
275 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (910, 440), 'left']) # drag a box | |
276 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (835, 250), 'left']) # drag a box | |
277 | self._enforce_res(FunctionalTest.evt_time, 'win') | |
278 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
279 | self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box_domino') | |
280 | self._enforce_res(FunctionalTest.evt_time, '') | |
281 | self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next | |
282 | self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball') | |
283 | # scene 4 | |
284 | self._event(FunctionalTest.evt_time, 'mouseclick', [(870, 490), 'left']) # close instructions | |
285 | self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (650, 310), 'left']) # drag a ball | |
286 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
287 | self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball') | |
288 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay | |
289 | self._event(FunctionalTest.drag_time, 'mousedrag', [(55, 50), (380, 50), 'left']) # drag a ball | |
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_basketball') | |
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_domino_box_basketball') | |
296 | # scene 5 | |
297 | self._event(FunctionalTest.evt_time, 'mouseclick', [(865, 490), 'left']) # close instructions | |
298 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box | |
299 | self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (590, 370), 'left']) # drag a piece | |
300 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
301 | self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball') | |
302 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 450), 'left']) # replay | |
303 | self._event(FunctionalTest.drag_time, 'mousedrag', [(65, 60), (580, 440), 'left']) # drag a box | |
304 | self._event(FunctionalTest.drag_time, 'mousedrag', [(30, 60), (660, 440), 'left']) # drag a piece | |
305 | self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 425), (625, 425), 'right']) # rotate a piece | |
306 | self._event(FunctionalTest.drag_time, 'mousedrag', [(660, 435), (650, 445), 'left']) # drag a piece | |
307 | self._enforce_res(FunctionalTest.evt_time, 'win') | |
308 | self._event(FunctionalTest.evt_time, 'mouseclick', [(1340, 740), 'left']) # play | |
309 | self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino_box_basketball') | |
310 | self._enforce_res(FunctionalTest.evt_time, '') | |
311 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(735, 450), 'left']) # next | |
312 | # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter') | |
313 | # # scene 6 | |
314 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(820, 455), 'left']) # close instructions | |
315 | # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 300), 'left']) # drag a box | |
316 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left']) # play | |
317 | # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter') | |
318 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(640, 420), 'left']) # replay | |
319 | # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (490, 150), 'left']) # drag a box | |
320 | # self._event(FunctionalTest.drag_time, 'mousedrag', [(515, 115), (515, 122), 'right']) # rotate a box | |
321 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left']) # play | |
322 | # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter') | |
323 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(690, 420), 'left']) # next | |
324 | # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball') | |
325 | # # scene 7 | |
326 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(880, 455), 'left']) # close instructions | |
327 | # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (155, 180), 'left']) # drag a box | |
328 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left']) # play | |
329 | # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball') | |
330 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(640, 420), 'left']) # replay | |
331 | # self._event(FunctionalTest.drag_time, 'mousedrag', [(60, 60), (170, 80), 'left']) # drag a box | |
332 | # self._event(FunctionalTest.drag_time, 'mousedrag', [(195, 50), (195, 80), 'right']) # rotate a box | |
333 | # self._event(FunctionalTest.evt_time, 'mouseclick', [(1260, 695), 'left']) # play | |
334 | # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball') | |
335 | self._event(FunctionalTest.evt_time, 'mouseclick', [(630, 450), 'left']) # home | |
336 | self._screenshot(FunctionalTest.screenshot_time, 'home_from_play') | |
337 | ||
338 | def _exit(self): | |
339 | self._tasks += [( | |
340 | self._curr_time + 3, | |
341 | lambda: exit(), | |
342 | 'exit')] | |
343 | ||
344 | def _do_screenshots_exit(self): | |
345 | self._verify() | |
346 | self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 600), 'left']) | |
347 | self._exit() | |
348 | ||
349 | def _do_screenshots_2(self): | |
350 | info('_do_screenshots_2') | |
351 | self._screenshot(FunctionalTest.start_time, 'main_menu_2') | |
352 | self._do_screenshots_restore_options() | |
353 | self._do_screenshots_play() | |
354 | self._do_screenshots_exit() | |
355 | ||
356 | def _do_screenshots(self, idx): | |
357 | [self._do_screenshots_1, self._do_screenshots_2][int(idx) - 1]() | |
358 | ||
359 | ||
360 | class TestApp(ShowBase): | |
361 | ||
362 | def __init__(self): | |
363 | ShowBase.__init__(self) | |
68f6c184 FC |
364 | offset = int(argv[2]) if len(argv) >= 3 else 0 |
365 | fun_test = FunctionalTest(int(argv[1]), offset) | |
361d3942 FC |
366 | |
367 | ||
368 | TestApp().run() |