Skip to content

Commit

Permalink
Reduce test cases for rapid state assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
proneon267 committed Nov 29, 2024
1 parent 23319cf commit 18aef1a
Showing 1 changed file with 10 additions and 28 deletions.
38 changes: 10 additions & 28 deletions testbed/tests/window/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,36 +756,17 @@ async def test_window_state_change(
@pytest.mark.parametrize(
"states",
[
# Switch from NORMAL:
(WindowState.NORMAL, WindowState.MINIMIZED),
(WindowState.NORMAL, WindowState.MAXIMIZED),
(WindowState.NORMAL, WindowState.FULLSCREEN),
(WindowState.NORMAL, WindowState.PRESENTATION),
(WindowState.NORMAL, WindowState.NORMAL),
# Switch from MINIMIZED:
(WindowState.MINIMIZED, WindowState.NORMAL),
(WindowState.MINIMIZED, WindowState.MAXIMIZED),
(WindowState.MINIMIZED, WindowState.FULLSCREEN),
(WindowState.MINIMIZED, WindowState.PRESENTATION),
(WindowState.MINIMIZED, WindowState.MINIMIZED),
# Switch from MAXIMIZED:
(WindowState.MAXIMIZED, WindowState.NORMAL),
(WindowState.MAXIMIZED, WindowState.MINIMIZED),
(WindowState.MAXIMIZED, WindowState.FULLSCREEN),
(WindowState.MAXIMIZED, WindowState.PRESENTATION),
(WindowState.MAXIMIZED, WindowState.MAXIMIZED),
# Switch from FULLSCREEN:
(WindowState.FULLSCREEN, WindowState.NORMAL),
(WindowState.FULLSCREEN, WindowState.MINIMIZED),
(WindowState.FULLSCREEN, WindowState.MAXIMIZED),
# Testing all possible window state change cases would be ideal,
# but doing so would significantly increase the runtime of the
# testbed. For practicality we are only testing the most complex
# cases to ensure full coverage across all platforms.
#
# Complex state changes on gtk:
(WindowState.FULLSCREEN, WindowState.PRESENTATION),
(WindowState.FULLSCREEN, WindowState.FULLSCREEN),
# Switch from PRESENTATION:
(WindowState.PRESENTATION, WindowState.NORMAL),
(WindowState.PRESENTATION, WindowState.MINIMIZED),
(WindowState.PRESENTATION, WindowState.MAXIMIZED),
(WindowState.PRESENTATION, WindowState.FULLSCREEN),
(WindowState.PRESENTATION, WindowState.PRESENTATION),
# Complex state changes on cocoa:
(WindowState.MINIMIZED, WindowState.FULLSCREEN),
(WindowState.FULLSCREEN, WindowState.MINIMIZED),
],
)
@pytest.mark.parametrize(
Expand Down Expand Up @@ -825,6 +806,7 @@ async def test_window_state_rapid_assignment(
await second_window_probe.wait_for_window(
f"Secondary window is in {states[-1]}", state_switch_not_from_normal=True
)

# Verify that the backend handled rapid assignments by checking if
# the window reached the correct final window state.
assert second_window_probe.instantaneous_state == states[-1]
Expand Down

0 comments on commit 18aef1a

Please sign in to comment.