Skip to content

Commit 6414ee1

Browse files
authored
Detect wayland video driver, and mark 2 tests as expected failures on wayland (#284)
* Detect wayland video driver * Wayland does generally not allow changing the window icon * Wayland does not allow repositioning of windows
1 parent 8920823 commit 6414ee1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sdl2/test/video_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111

1212
# Some tests don't work properly with some video drivers, so check the name
1313
DRIVER_DUMMY = False
14+
DRIVER_WAYLAND = False
1415
DRIVER_X11 = False
1516
try:
1617
sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO)
1718
driver_name = sdl2.SDL_GetCurrentVideoDriver()
1819
sdl2.SDL_Quit()
1920
DRIVER_DUMMY = driver_name == b"dummy"
21+
DRIVER_WAYLAND = driver_name == b"wayland"
2022
DRIVER_X11 = driver_name == b"x11"
2123
except:
2224
pass
@@ -438,6 +440,7 @@ def test_SDL_GetSetWindowTitle(window):
438440
sdl2.SDL_SetWindowTitle(window, b"Hello there")
439441
assert sdl2.SDL_GetWindowTitle(window) == b"Hello there"
440442

443+
@pytest.mark.xfail(DRIVER_WAYLAND, reason="wayland does not allow changing the window icon")
441444
def test_SDL_SetWindowIcon(window):
442445
sf = surface.SDL_CreateRGBSurface(
443446
0, 16, 16, 16, 0xF000, 0x0F00, 0x00F0, 0x000F
@@ -461,7 +464,7 @@ def test_SDL_GetSetWindowData(window):
461464
retval = sdl2.SDL_GetWindowData(window, k)
462465
assert retval.contents.value == v.value
463466

464-
@pytest.mark.xfail(DRIVER_X11, reason="Wonky with some window managers")
467+
@pytest.mark.xfail(DRIVER_X11 or DRIVER_WAYLAND, reason="Wonky with some window managers")
465468
def test_SDL_GetSetWindowPosition(with_sdl):
466469
window = _create_window(b"Test", 10, 200, 10, 10, 0)
467470
px, py = c_int(0), c_int(0)

0 commit comments

Comments
 (0)