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 | 8 | from ya2.engine.engine import Engine |
0f9675ba FC |
9 | |
10 | ||
11 | class EngineCBMuxTests(TestCase): | |
12 | ||
13 | def setUp(self): | |
14 | loadPrcFileData('', 'window-type none') | |
15 | loadPrcFileData('', 'audio-library-name null') | |
16 | self.eng = Engine() | |
17 | ||
18 | def tearDown(self): | |
19 | self.eng.destroy() | |
20 | ||
21 | def _callback(self, arg): pass | |
22 | ||
23 | def test_cbmux(self): | |
24 | self._callback = MagicMock(side_effect=self._callback) | |
25 | self.eng.cb_mux.add_cb(self._callback, [42]) | |
26 | taskMgr.step() | |
27 | self._callback.assert_called_with(42) |