Commit | Line | Data |
---|---|---|
1bfdf72a FC |
1 | from logging import info, debug |
2 | import threading | |
3 | ||
1bfdf72a | 4 | def assert_render3d(): |
067a36db | 5 | preserve = ['camera'] |
1bfdf72a | 6 | for child in render.children: |
067a36db FC |
7 | if child.name not in preserve: |
8 | render.ls() | |
9 | msg = 'unexpected render3d node: %s' % child.name | |
10 | raise Exception(msg) | |
1bfdf72a FC |
11 | |
12 | def assert_aspect2d(): | |
067a36db FC |
13 | preserve = [ |
14 | 'a2dBackground', 'a2dTopCenter', 'a2dTopCenterNS', | |
15 | 'a2dBottomCenter', 'a2dBottomCenterNS', 'a2dLeftCenter', | |
16 | 'a2dLeftCenterNS', 'a2dRightCenter', 'a2dRightCenterNS', | |
17 | 'a2dTopLeft', 'a2dTopLeftNS', 'a2dTopRight', | |
18 | 'a2dTopRightNS', 'a2dBottomLeft', 'a2dBottomLeftNS', | |
19 | 'a2dBottomRight', 'a2dBottomRightNS', 'test_txt'] | |
1bfdf72a | 20 | for child in aspect2d.children: |
1bfdf72a | 21 | if child.name not in preserve and not child.has_python_tag('preserve'): |
067a36db FC |
22 | aspect2d.ls() |
23 | msg = 'unexpected aspect2d node: %s' % child.name | |
24 | raise Exception(msg) | |
1bfdf72a FC |
25 | |
26 | def assert_render2d(): | |
27 | for child in render2d.children: | |
28 | preserve = ['aspect2d', 'pixel2d', 'camera2d'] | |
29 | if child.name not in preserve and not child.has_python_tag('preserve'): | |
067a36db FC |
30 | render2d.ls() |
31 | msg = 'unexpected render2d node: %s' % child.name | |
32 | raise Exception(msg) | |
1bfdf72a FC |
33 | |
34 | def assert_events(): | |
067a36db | 35 | return |
1bfdf72a FC |
36 | preserve = ['window-event', 'window-closed', 'async_loader_0', |
37 | 'render-texture-targets-changed', 'aspectRatioChanged'] | |
38 | for evt in messenger.getEvents(): | |
39 | if evt not in preserve: | |
40 | msg = 'unexpected event: %s' % evt | |
41 | raise Exception(msg) | |
42 | ||
43 | def assert_tasks(): | |
44 | preserve = [ | |
45 | 'ivalLoop', 'garbageCollectStates', 'collisionLoop', | |
46 | 'igLoop', 'audioLoop', 'resetPrevTransform', 'dataLoop', | |
067a36db FC |
47 | 'eventManager', 'simplepbr update', 'on frame music', |
48 | 'assert_fps'] | |
1bfdf72a FC |
49 | for task in taskMgr.getTasks() + taskMgr.getDoLaters(): |
50 | if task.name not in preserve and not hasattr(task, 'preserve'): | |
51 | msg = 'unexpected task: %s' % task.name | |
52 | raise Exception(msg) | |
53 | ||
54 | def assert_buffers(): | |
55 | pass | |
56 | #for buffer in RenderToTexture.buffers: | |
57 | # raise Error() | |
58 | ||
1bfdf72a FC |
59 | def assert_threads(): |
60 | thr_names = [thread.name for thread in threading.enumerate()] | |
067a36db | 61 | preserve = ['MainThread', 'rpc_server'] |
1bfdf72a FC |
62 | for thr_name in thr_names: |
63 | if thr_name not in preserve: | |
64 | msg = 'unexpected thread: %s' % thr_name | |
65 | raise Exception(msg) |