Browse Source

tests: fixes for the window tests

rdb 8 years ago
parent
commit
2f910ccd7c
2 changed files with 12 additions and 8 deletions
  1. 9 6
      tests/display/conftest.py
  2. 3 2
      tests/display/test_window.py

+ 9 - 6
tests/display/conftest.py

@@ -1,23 +1,26 @@
 import pytest
 import pytest
 
 
[email protected]
-def graphics_pipe(scope='session'):
+
[email protected](scope='session')
+def graphics_pipe():
     from panda3d.core import GraphicsPipeSelection
     from panda3d.core import GraphicsPipeSelection
 
 
     pipe = GraphicsPipeSelection.get_global_ptr().make_default_pipe()
     pipe = GraphicsPipeSelection.get_global_ptr().make_default_pipe()
 
 
-    if not pipe.is_valid():
-        pytest.xfail("GraphicsPipe is invalid")
+    if pipe is None or not pipe.is_valid():
+        pytest.skip("GraphicsPipe is invalid")
 
 
     yield pipe
     yield pipe
 
 
[email protected]
-def graphics_engine(scope='session'):
+
[email protected](scope='session')
+def graphics_engine():
     from panda3d.core import GraphicsEngine
     from panda3d.core import GraphicsEngine
 
 
     engine = GraphicsEngine.get_global_ptr()
     engine = GraphicsEngine.get_global_ptr()
     yield engine
     yield engine
 
 
+
 @pytest.fixture
 @pytest.fixture
 def window(graphics_pipe, graphics_engine):
 def window(graphics_pipe, graphics_engine):
     from panda3d.core import GraphicsPipe, FrameBufferProperties, WindowProperties
     from panda3d.core import GraphicsPipe, FrameBufferProperties, WindowProperties

+ 3 - 2
tests/display/test_window.py

@@ -5,11 +5,12 @@ def test_window_basic(window):
     current_props = window.get_properties()
     current_props = window.get_properties()
     default_props = WindowProperties.get_default()
     default_props = WindowProperties.get_default()
 
 
-    # Opening the window changes these from the defaults
+    # Opening the window changes these from the defaults.  Note that we have
+    # no guarantee that it opens in the foreground or with the requested size.
     default_props.set_size(current_props.get_size())
     default_props.set_size(current_props.get_size())
     default_props.set_origin(current_props.get_origin())
     default_props.set_origin(current_props.get_origin())
     default_props.set_minimized(False)
     default_props.set_minimized(False)
-    default_props.set_foreground(True)
+    default_props.foreground = current_props.foreground
 
 
     # The rest should be the same
     # The rest should be the same
     assert current_props == default_props
     assert current_props == default_props