1 from panda3d
.core
import load_prc_file_data
2 load_prc_file_data('', 'window-type none')
3 from pathlib
import Path
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 direct
.showbase
.ShowBase
import ShowBase
9 from ya2
.utils
.gui
.cursor
import MouseCursor
, MouseCursorInfo
12 class CursorTests(TestCase
):
15 self
.__app
= ShowBase()
20 def test_cursor(self
):
21 i
= MouseCursorInfo('tests/assets/images/icon16.png', False, (1, 1, 1), (1, 1, 1, 1), (0, 0))
23 c
.set_image('tests/assets/images/icon32.png')
24 self
.assertEqual('tests/assets/images/icon32.png', c
._MouseCursor
__image
.get_texture().get_filename())
25 c
.set_color((0, 1, 0, 1))
26 self
.assertEqual((0, 1, 0, 1), c
._MouseCursor
__image
.get_color())
28 self
.assertFalse(c
._MouseCursor
__image
.is_hidden())
30 self
.assertTrue(c
._MouseCursor
__image
.is_hidden())
32 self
.assertNotIn('on_frame_cursor', [t
.name
for t
in taskMgr
.getTasks() + taskMgr
.getDoLaters()])
33 self
.assertTrue(c
._MouseCursor
__image
.is_empty())