feat(e2e): say where a resize border is pressed on the Windows guest

The left, right and bottom borders of a window reach outside its visible
frame (the invisible DWM border), so the press is 4 px outside; the top has
none and its border is inside the window, so the press is in its first
rows. Outside the top the press hit the desktop and no drag started.
This commit is contained in:
LGUG2Z committed 2026-10-30 18:22:45 -07:00
1 parent 271abc3e9c
commit fb549f5685
2 files changed
+36

No files matched your search

@@ -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)
@@ -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"