Commit | Line | Data |
---|---|---|
0f9675ba 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 import TestCase | |
6 | from unittest.mock import MagicMock | |
7 | from panda3d.core import loadPrcFileData | |
53ddf3c3 FC |
8 | from ya2.engine.engine import Engine |
9 | from ya2.engine.audio import EngineAudio | |
0f9675ba FC |
10 | |
11 | ||
12 | class EngineClockTests(TestCase): | |
13 | ||
14 | def setUp(self): | |
15 | loadPrcFileData('', 'window-type none') | |
16 | loadPrcFileData('', 'audio-library-name null') | |
17 | self.eng = Engine() | |
18 | ||
19 | def tearDown(self): | |
20 | self.eng.destroy() | |
21 | ||
22 | def test_clock(self): | |
23 | # this test shows that even if you process frames, the engine's clock | |
24 | # is storing the unpaused time | |
25 | start_time = self.eng.clock.time | |
26 | self.eng.pause.logic.pause() | |
27 | taskMgr.step() | |
28 | self.eng.pause.logic.resume() | |
29 | self.assertEqual(start_time, self.eng.clock.time) |