Skip to content

Commit 2f910cc

Browse files
committed
tests: fixes for the window tests
1 parent 588d41e commit 2f910cc

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

tests/display/conftest.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import pytest
22

3-
@pytest.fixture
4-
def graphics_pipe(scope='session'):
3+
4+
@pytest.fixture(scope='session')
5+
def graphics_pipe():
56
from panda3d.core import GraphicsPipeSelection
67

78
pipe = GraphicsPipeSelection.get_global_ptr().make_default_pipe()
89

9-
if not pipe.is_valid():
10-
pytest.xfail("GraphicsPipe is invalid")
10+
if pipe is None or not pipe.is_valid():
11+
pytest.skip("GraphicsPipe is invalid")
1112

1213
yield pipe
1314

14-
@pytest.fixture
15-
def graphics_engine(scope='session'):
15+
16+
@pytest.fixture(scope='session')
17+
def graphics_engine():
1618
from panda3d.core import GraphicsEngine
1719

1820
engine = GraphicsEngine.get_global_ptr()
1921
yield engine
2022

23+
2124
@pytest.fixture
2225
def window(graphics_pipe, graphics_engine):
2326
from panda3d.core import GraphicsPipe, FrameBufferProperties, WindowProperties

tests/display/test_window.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ def test_window_basic(window):
55
current_props = window.get_properties()
66
default_props = WindowProperties.get_default()
77

8-
# Opening the window changes these from the defaults
8+
# Opening the window changes these from the defaults. Note that we have
9+
# no guarantee that it opens in the foreground or with the requested size.
910
default_props.set_size(current_props.get_size())
1011
default_props.set_origin(current_props.get_origin())
1112
default_props.set_minimized(False)
12-
default_props.set_foreground(True)
13+
default_props.foreground = current_props.foreground
1314

1415
# The rest should be the same
1516
assert current_props == default_props

0 commit comments

Comments
 (0)