ya2 · news · projects · code · about

be0d69d03b27a13f90e003ae2c9df94b6d654a1e
[pmachines.git] / tests / ya2 / utils / test_gui.py
1 from panda3d.core import load_prc_file_data
2 load_prc_file_data('', 'window-type offscreen')
3 from pathlib import Path
4 import sys
5 if '' in sys.path: sys.path.remove('')
6 sys.path.append(str(Path(__file__).parent.parent.parent))
7 from unittest import TestCase
8 from unittest.mock import patch
9 from panda3d.core import get_model_path
10 from direct.showbase.ShowBase import ShowBase
11 from ya2.utils.gui import GuiTools
12 import ya2
13
14
15 class TestApp(ShowBase): pass
16
17
18 class GraphicsToolsTests(TestCase):
19
20 def setUp(self):
21 self.__app = TestApp()
22 get_model_path().append_directory(str(Path(__file__).parent.parent.parent))
23
24 def tearDown(self):
25 self.__app.destroy()
26
27 @patch.object(ya2.utils.gui, 'load_prc_file_data')
28 def test_no_window(self, l_mock):
29 GuiTools.no_window()
30 l_mock.assert_called_once()
31 l_args = l_mock.call_args_list[0].args
32 self.assertEqual(l_args[0], '')
33 self.assertEqual(l_args[1], 'window-type none')
34 self.assertEqual(len(l_args), 2)