tests: fixes for the window tests

This commit is contained in:
rdb 2017-12-24 15:13:19 +01:00
parent 588d41ed7e
commit 2f910ccd7c
2 changed files with 12 additions and 8 deletions

View File

@ -1,23 +1,26 @@
import pytest
@pytest.fixture
def graphics_pipe(scope='session'):
@pytest.fixture(scope='session')
def graphics_pipe():
from panda3d.core import GraphicsPipeSelection
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
@pytest.fixture
def graphics_engine(scope='session'):
@pytest.fixture(scope='session')
def graphics_engine():
from panda3d.core import GraphicsEngine
engine = GraphicsEngine.get_global_ptr()
yield engine
@pytest.fixture
def window(graphics_pipe, graphics_engine):
from panda3d.core import GraphicsPipe, FrameBufferProperties, WindowProperties

View File

@ -5,11 +5,12 @@ def test_window_basic(window):
current_props = window.get_properties()
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_origin(current_props.get_origin())
default_props.set_minimized(False)
default_props.set_foreground(True)
default_props.foreground = current_props.foreground
# The rest should be the same
assert current_props == default_props