Browse Source

tests: add unit test for track-gui-items setting in DirectGUI

rdb 6 years ago
parent
commit
1318fd80d7
1 changed files with 22 additions and 0 deletions
  1. 22 0
      tests/gui/test_DirectGuiBase.py

+ 22 - 0
tests/gui/test_DirectGuiBase.py

@@ -0,0 +1,22 @@
+from direct.gui.DirectGuiBase import DirectGuiWidget
+from direct.showbase.ShowBase import ShowBase
+from direct.showbase import ShowBaseGlobal
+from panda3d import core
+import pytest
+
+
[email protected](not ShowBaseGlobal.__dev__, reason="requires want-dev")
+def test_track_gui_items():
+    page = core.load_prc_file_data("", "track-gui-items true")
+    try:
+        item = DirectGuiWidget()
+        id = item.guiId
+
+        assert id in ShowBase.guiItems
+        assert ShowBase.guiItems[id] == item
+
+        item.destroy()
+
+        assert id not in ShowBase.guiItems
+    finally:
+        core.unload_prc_file(page)