diff --git a/e2e/platforms/qemu_windows/tests/test_runner.py b/e2e/platforms/qemu_windows/tests/test_runner.py index 07a13e43..fc697ae7 100644 --- a/e2e/platforms/qemu_windows/tests/test_runner.py +++ b/e2e/platforms/qemu_windows/tests/test_runner.py @@ -279,3 +279,19 @@ def test_a_step_that_is_not_known_fails_as_it_did() -> None: assert checks.failed == 1 assert checks.known == [] + + +def test_the_press_points_of_a_resize_are_outside_but_for_the_top() -> None: + from komorebi_vm.core.geometry import Rect + + platform = _platform("") + frame = Rect(657, 393, 596, 332) + + assert platform.resize_grab(frame, "left") == (653, 559) + assert platform.resize_grab(frame, "right") == (1257, 559) + assert platform.resize_grab(frame, "bottom") == (955, 729) + # no invisible border on the top: inside the first rows, not the desktop + assert platform.resize_grab(frame, "top") == (955, 395) + assert platform.resize_grab(frame, "topleft") == (653, 395) + assert platform.resize_grab(frame, "topright") == (1257, 395) + assert platform.resize_grab(frame, "bottomright") == (1257, 729) diff --git a/e2e/platforms/qemu_windows/windows_platform.py b/e2e/platforms/qemu_windows/windows_platform.py index 75f2a07a..ac7724a6 100644 --- a/e2e/platforms/qemu_windows/windows_platform.py +++ b/e2e/platforms/qemu_windows/windows_platform.py @@ -333,6 +333,26 @@ class WindowsPlatform: ): raise RuntimeError("the display did not take the mode") + def resize_grab(self, frame: Rect, grab: str) -> tuple[int, int]: + # the left, right and bottom resize borders of a window reach 7 px + # outside its visible frame (the invisible border of the DWM): press 4 + # px outside. The top has none, its border is inside the window: press + # in its first rows, as outside is the desktop + outside, inside = 4, 2 + left, right = frame.x - outside, frame.x + frame.w + outside + top, bottom = frame.y + inside, frame.y + frame.h + outside + cx, cy = frame.x + frame.w // 2, frame.y + frame.h // 2 + return { + "left": (left, cy), + "right": (right, cy), + "top": (cx, top), + "bottom": (cx, bottom), + "topleft": (left, top), + "topright": (right, top), + "bottomleft": (left, bottom), + "bottomright": (right, bottom), + }[grab] + def exe_id(self, program: str) -> str: # kfw names the exe of a window with its extension return f"{program}.exe"