Skip to content

Commit

Permalink
tests/wm: make gdk_backend class-scoped fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Oct 13, 2024
1 parent f45335e commit 01f2fde
Show file tree
Hide file tree
Showing 9 changed files with 378 additions and 375 deletions.
82 changes: 43 additions & 39 deletions test/pict/test_maximize_unmaximize.gen

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions test/pict/test_maximize_unmaximize.model
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ window_above: True, False
window_skip_taskbar: True, False
window_stick: True, False

gdk_backend: GdkBackend.X11, GdkBackend.WAYLAND (100)

monitor0_transform: displayconfig.Transform.NORMAL
monitor1_transform: <monitor0_transform>, MONITOR_DISABLED

IF [class] = "TestX11"
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL" AND [gdk_backend] = "GdkBackend.X11";
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL";

IF [layout_mode] = "displayconfig.LayoutMode.PHYSICAL"
THEN [monitor0_scale] IN {1.0, 2.0} AND [monitor1_scale] IN {1.0, 2.0, 0};
Expand Down
88 changes: 44 additions & 44 deletions test/pict/test_mouse_resize.gen

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions test/pict/test_mouse_resize.model
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
class: TestX11, TestWayland, TestWaylandTwoMonitors

gdk_backend: GdkBackend.X11, GdkBackend.WAYLAND (100)

monitor0_scale: 1.0, 1.25, 1.502347469329834, 1.748633861541748, 2.0
monitor1_scale: <monitor0_scale>, 0
layout_mode: displayconfig.LayoutMode.PHYSICAL (100), displayconfig.LayoutMode.LOGICAL
Expand All @@ -20,7 +18,7 @@ monitor0_transform: displayconfig.Transform.NORMAL
monitor1_transform: <monitor0_transform>, MONITOR_DISABLED

IF [class] = "TestX11"
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL" AND [gdk_backend] = "GdkBackend.X11";
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL";

IF [layout_mode] = "displayconfig.LayoutMode.PHYSICAL"
THEN [monitor0_scale] IN {1.0, 2.0} AND [monitor1_scale] IN {1.0, 2.0, 0};
Expand Down
91 changes: 46 additions & 45 deletions test/pict/test_resize_maximize_unmaximize.gen

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions test/pict/test_resize_maximize_unmaximize.model
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ monitor0_scale: 1.0, 1.25, 1.502347469329834, 1.748633861541748, 2.0
monitor1_scale: <monitor0_scale>, 0
layout_mode: displayconfig.LayoutMode.PHYSICAL (100), displayconfig.LayoutMode.LOGICAL

gdk_backend: GdkBackend.X11, GdkBackend.WAYLAND (100)

monitor0_transform: displayconfig.Transform.NORMAL
monitor1_transform: <monitor0_transform>, MONITOR_DISABLED

IF [class] = "TestX11"
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL" AND [gdk_backend] = "GdkBackend.X11";
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL";

IF [layout_mode] = "displayconfig.LayoutMode.PHYSICAL"
THEN [monitor0_scale] IN {1.0, 2.0} AND [monitor1_scale] IN {1.0, 2.0, 0};
Expand Down
450 changes: 225 additions & 225 deletions test/pict/test_show.gen

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions test/pict/test_show.model
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ window_above: True, False
window_skip_taskbar: True, False
window_stick: True, False

gdk_backend: GdkBackend.X11, GdkBackend.WAYLAND (100)

monitor0_transform: displayconfig.Transform.NORMAL, displayconfig.Transform.ROTATE_90
monitor1_transform: <monitor0_transform>, MONITOR_DISABLED

IF [class] = "TestX11"
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL" AND [gdk_backend] = "GdkBackend.X11" AND [monitor0_transform] = "displayconfig.Transform.NORMAL";
THEN [layout_mode] = "displayconfig.LayoutMode.PHYSICAL" AND [monitor0_transform] = "displayconfig.Transform.NORMAL";

IF [layout_mode] = "displayconfig.LayoutMode.PHYSICAL"
THEN [monitor0_scale] IN {1.0, 2.0} AND [monitor1_scale] IN {1.0, 2.0, 0};
Expand Down
26 changes: 16 additions & 10 deletions test/test_wm.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ def test_show(
assert unmaximized_rect == extension_dbus_interface.TargetRect
assert extension_test_hook.ClientType == gdk_backend
assert monitor_scale == extension_dbus_interface.TargetMonitorScale
assert extension_test_hook.ClientType == gdk_backend

extension_test_hook.wait_property('RenderedFirstFrame', True)
wait_idle()
Expand Down Expand Up @@ -697,14 +698,12 @@ def get_parametrization(cls, name):
reverse = cls._testmethods.index(name) % 2 == 1

p = p.order_by('layout_mode', reverse) # Change requires restarting the app
p = p.order_by('gdk_backend', reverse) # Change requires restarting the app

return p

def pytest_generate_tests(self, metafunc):
indirect = {
'animation_mode',
'gdk_backend',
'current_monitor',
'window_position',
'window_size',
Expand Down Expand Up @@ -738,13 +737,20 @@ def monitor_layout(

return (displayconfig.SimpleMonitorConfig(scale=monitor0_scale),)

@pytest.fixture
def gdk_backend(self, request):
assert request.param == GdkBackend.X11

return request.param


@pytest.fixture(scope='class')
def gdk_backend(self):
return GdkBackend.X11


@pytest.mark.parametrize(
'gdk_backend',
(
pytest.param(GdkBackend.WAYLAND, id='GdkBackend.WAYLAND'),
pytest.param(GdkBackend.X11, id='GdkBackend.X11'),
),
indirect=True,
scope='class',
)
class TestWayland(CommonTests, fixtures.GnomeSessionWaylandFixtures):
@pytest.fixture
def monitor_layout(
Expand Down Expand Up @@ -776,7 +782,7 @@ def expected_show_transitions(

return animation_mode.expected_transitions(window_position)

@pytest.fixture
@pytest.fixture(scope='class')
def gdk_backend(
self,
request,
Expand Down

0 comments on commit 01f2fde

Please sign in to comment.