Commit | Line | Data |
---|---|---|
cb700bcc FC |
1 | # from pathlib import Path |
2 | # import sys | |
3 | # if '' in sys.path: sys.path.remove('') | |
4 | # sys.path.append(str(Path(__file__).parent.parent.parent)) | |
5 | # from unittest.mock import patch | |
6 | # from unittest import TestCase | |
7 | # from panda3d.core import loadPrcFileData | |
8 | # from ya2.engine.engine import Engine | |
9 | # from ya2.gameobject import AiColleague, AudioColleague, EventColleague, \ | |
10 | # FsmColleague, GameObject, GfxColleague, GuiColleague, LogicColleague, \ | |
11 | # PhysColleague, Colleague | |
0f9675ba FC |
12 | |
13 | ||
cb700bcc | 14 | # class AiTests(TestCase): |
0f9675ba | 15 | |
cb700bcc FC |
16 | # def setUp(self): |
17 | # loadPrcFileData('', 'window-type none') | |
18 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 19 | |
cb700bcc FC |
20 | # def tearDown(self): |
21 | # self.engine.destroy() | |
0f9675ba | 22 | |
cb700bcc FC |
23 | # def test_init(self): |
24 | # self.engine = Engine() | |
25 | # game_obj = GameObject() | |
26 | # ai = AiColleague(game_obj) | |
27 | # self.assertIsInstance(ai, AiColleague) | |
0f9675ba FC |
28 | |
29 | ||
cb700bcc | 30 | # class AudioTests(TestCase): |
0f9675ba | 31 | |
cb700bcc FC |
32 | # def setUp(self): |
33 | # loadPrcFileData('', 'window-type none') | |
34 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 35 | |
cb700bcc FC |
36 | # def tearDown(self): |
37 | # self.engine.destroy() | |
0f9675ba | 38 | |
cb700bcc FC |
39 | # def test_init(self): |
40 | # self.engine = Engine() | |
41 | # game_obj = GameObject() | |
42 | # audio = AudioColleague(game_obj) | |
43 | # self.assertIsInstance(audio, AudioColleague) | |
0f9675ba FC |
44 | |
45 | ||
cb700bcc | 46 | # class ColleagueTests(TestCase): |
0f9675ba | 47 | |
cb700bcc FC |
48 | # def setUp(self): |
49 | # loadPrcFileData('', 'window-type none') | |
50 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 51 | |
cb700bcc FC |
52 | # def tearDown(self): |
53 | # self.engine.destroy() | |
0f9675ba | 54 | |
cb700bcc FC |
55 | # def test_init(self): |
56 | # self.engine = Engine() | |
57 | # game_obj = GameObject() | |
58 | # colleague = Colleague(game_obj) | |
59 | # self.assertIsInstance(colleague, Colleague) | |
0f9675ba FC |
60 | |
61 | ||
cb700bcc | 62 | # class EventTests(TestCase): |
0f9675ba | 63 | |
cb700bcc FC |
64 | # def setUp(self): |
65 | # loadPrcFileData('', 'window-type none') | |
66 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 67 | |
cb700bcc FC |
68 | # def tearDown(self): |
69 | # self.engine.destroy() | |
0f9675ba | 70 | |
cb700bcc FC |
71 | # def test_init(self): |
72 | # self.engine = Engine() | |
73 | # game_obj = GameObject() | |
74 | # event = EventColleague(game_obj) | |
75 | # self.assertIsInstance(event, EventColleague) | |
0f9675ba FC |
76 | |
77 | ||
cb700bcc | 78 | # class FsmTests(TestCase): |
0f9675ba | 79 | |
cb700bcc FC |
80 | # def setUp(self): |
81 | # loadPrcFileData('', 'window-type none') | |
82 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 83 | |
cb700bcc FC |
84 | # def tearDown(self): |
85 | # self.engine.destroy() | |
0f9675ba | 86 | |
cb700bcc FC |
87 | # def test_init(self): |
88 | # self.engine = Engine() | |
89 | # game_obj = GameObject() | |
90 | # fsm = FsmColleague(game_obj) | |
91 | # self.assertIsInstance(fsm, FsmColleague) | |
0f9675ba FC |
92 | |
93 | ||
cb700bcc | 94 | # class GfxTests(TestCase): |
0f9675ba | 95 | |
cb700bcc FC |
96 | # def setUp(self): |
97 | # loadPrcFileData('', 'window-type none') | |
98 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 99 | |
cb700bcc FC |
100 | # def tearDown(self): |
101 | # self.engine.destroy() | |
0f9675ba | 102 | |
cb700bcc FC |
103 | # def test_init(self): |
104 | # self.engine = Engine() | |
105 | # game_obj = GameObject() | |
106 | # gfx = GfxColleague(game_obj) | |
107 | # self.assertIsInstance(gfx, GfxColleague) | |
0f9675ba FC |
108 | |
109 | ||
cb700bcc | 110 | # class GuiTests(TestCase): |
0f9675ba | 111 | |
cb700bcc FC |
112 | # def setUp(self): |
113 | # loadPrcFileData('', 'window-type none') | |
114 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 115 | |
cb700bcc FC |
116 | # def tearDown(self): |
117 | # self.engine.destroy() | |
0f9675ba | 118 | |
cb700bcc FC |
119 | # def test_init(self): |
120 | # self.engine = Engine() | |
121 | # game_obj = GameObject() | |
122 | # gui = GuiColleague(game_obj) | |
123 | # self.assertIsInstance(gui, GuiColleague) | |
0f9675ba FC |
124 | |
125 | ||
cb700bcc | 126 | # class LogicTests(TestCase): |
0f9675ba | 127 | |
cb700bcc FC |
128 | # def setUp(self): |
129 | # loadPrcFileData('', 'window-type none') | |
130 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 131 | |
cb700bcc FC |
132 | # def tearDown(self): |
133 | # self.engine.destroy() | |
0f9675ba | 134 | |
cb700bcc FC |
135 | # def test_init(self): |
136 | # self.engine = Engine() | |
137 | # game_obj = GameObject() | |
138 | # logic = LogicColleague(game_obj) | |
139 | # self.assertIsInstance(logic, LogicColleague) | |
0f9675ba FC |
140 | |
141 | ||
cb700bcc | 142 | # class PhysicsTests(TestCase): |
0f9675ba | 143 | |
cb700bcc FC |
144 | # def setUp(self): |
145 | # loadPrcFileData('', 'window-type none') | |
146 | # loadPrcFileData('', 'audio-library-name null') | |
0f9675ba | 147 | |
cb700bcc FC |
148 | # def tearDown(self): |
149 | # self.engine.destroy() | |
150 | ||
151 | # def test_init(self): | |
152 | # self.engine = Engine() | |
153 | # game_obj = GameObject() | |
154 | # phys = PhysColleague(game_obj) | |
155 | # self.assertIsInstance(phys, PhysColleague) | |
0f9675ba FC |
156 | |
157 | ||
cb700bcc | 158 | # class GameObjectInstance(GameObject): |
0f9675ba | 159 | |
cb700bcc FC |
160 | # def __init__(self): |
161 | # GameObject.__init__(self) | |
162 | # self.fsm = FsmColleague(self) | |
163 | # self.event = EventColleague(self) | |
164 | # self.ai = AiColleague(self) | |
165 | # self.phys = PhysColleague(self) | |
166 | # self.audio = AudioColleague(self) | |
167 | # self.logic = LogicColleague(self) | |
168 | # self.gui = GuiColleague(self) | |
169 | # self.gfx = GfxColleague(self) | |
170 | ||
171 | # def destroy(self): | |
172 | # self.fsm.destroy() | |
173 | # self.event.destroy() | |
174 | # self.ai.destroy() | |
175 | # self.phys.destroy() | |
176 | # self.audio.destroy() | |
177 | # self.logic.destroy() | |
178 | # self.gui.destroy() | |
179 | # self.gfx.destroy() | |
180 | ||
181 | ||
182 | # class GameObjectTests(TestCase): | |
183 | ||
184 | # def setUp(self): | |
185 | # loadPrcFileData('', 'window-type none') | |
186 | # loadPrcFileData('', 'audio-library-name null') | |
187 | ||
188 | # def tearDown(self): | |
189 | # self.engine.destroy() | |
190 | ||
191 | # @patch.object(GfxColleague, 'destroy') | |
192 | # @patch.object(GuiColleague, 'destroy') | |
193 | # @patch.object(LogicColleague, 'destroy') | |
194 | # @patch.object(AudioColleague, 'destroy') | |
195 | # @patch.object(PhysColleague, 'destroy') | |
196 | # @patch.object(AiColleague, 'destroy') | |
197 | # @patch.object(EventColleague, 'destroy') | |
198 | # @patch.object(FsmColleague, 'destroy') | |
199 | # def test_init( | |
200 | # self, mock_fsm_destroy, mock_event_destroy, mock_ai_destroy, | |
201 | # mock_phys_destroy, mock_audio_destroy, mock_logic_destroy, | |
202 | # mock_gui_destroy, mock_gfx_destroy): | |
203 | # self.engine = Engine() | |
204 | # mock_event_destroy.__name__ = 'destroy' | |
205 | # game_obj = GameObjectInstance() | |
206 | # self.assertIsInstance(game_obj, GameObject) | |
207 | # game_obj.destroy() | |
208 | # assert mock_fsm_destroy.called | |
209 | # assert mock_event_destroy.called | |
210 | # assert mock_ai_destroy.called | |
211 | # assert mock_phys_destroy.called | |
212 | # assert mock_audio_destroy.called | |
213 | # assert mock_logic_destroy.called | |
214 | # assert mock_gui_destroy.called | |
215 | # assert mock_gfx_destroy.called |