mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
tests: fixes for the window tests
This commit is contained in:
parent
588d41ed7e
commit
2f910ccd7c
@ -1,23 +1,26 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def graphics_pipe(scope='session'):
|
@pytest.fixture(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():
|
if pipe is None or not pipe.is_valid():
|
||||||
pytest.xfail("GraphicsPipe is invalid")
|
pytest.skip("GraphicsPipe is invalid")
|
||||||
|
|
||||||
yield pipe
|
yield pipe
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def graphics_engine(scope='session'):
|
@pytest.fixture(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
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user