From 75f5ceffaa492db189a76db6a33dca148aa1f3b5 Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 30 Nov 2026 18:40:48 +0100 Subject: [PATCH] Exercise the Windows Hand gesture with native hosted-desktop input --- .github/qa-windows-saves.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/qa-windows-saves.py b/.github/qa-windows-saves.py index 81e2dd9464..fcca373dc9 100644 --- a/.github/qa-windows-saves.py +++ b/.github/qa-windows-saves.py @@ -167,12 +167,37 @@ try: engine("file.open",path=str(path)) wait(lambda: object_count()==count, f"{path.name} should contain {count} rectangles") print(path.name,path.stat().st_size,digest(path),"objects:",count,flush=True) - view=state(); x,y,w,h=view["canvasRect"] + engine("file.new",width=700,height=500) engine("tool.select",tool="selection") call("ui.key",key="h") wait(lambda: state()["tool"]=="hand","H failed to select Hand") + time.sleep(.6) + # Send a real Windows mouse drag in the dedicated runner desktop; the drawing host reads + # native cursor location between egui frames while its Hand gesture is held. + view=state() + x,y,w,h=view["canvasRect"] + print("Native Hand drag in canvas",view["canvasRect"],"of window",view["window"],flush=True) + user=ctypes.WinDLL("user32",use_last_error=True) + hwnd=user.GetForegroundWindow() + owner=wintypes.DWORD() + user.GetWindowThreadProcessId(hwnd,ctypes.byref(owner)) + assert owner.value==process.pid,("foreground owner",owner.value,process.pid) + client=wintypes.RECT() + assert user.GetClientRect(hwnd,ctypes.byref(client)) + scale=client.right/view["window"][0] + pt=wintypes.POINT(round((x+w*.47)*scale),round((y+h*.64)*scale)) + assert user.ClientToScreen(hwnd,ctypes.byref(pt)) before=state()["view"] - call("ui.drag",x=x+w*.4,y=y+h*.4,toX=x+w*.4+60,toY=y+h*.4+40,steps=8) + assert user.SetCursorPos(pt.x,pt.y) + time.sleep(.4) + user.mouse_event(2,0,0,0,0) + try: + for i in range(1,11): + time.sleep(.06) + assert user.SetCursorPos(pt.x+i*6,pt.y+i*4) + finally: + user.mouse_event(4,0,0,0,0) + time.sleep(.5) after=state()["view"] assert before["zoom"]==after["zoom"] and before["center"]!=after["center"],(before,after) print("Hand selected by H moved the canvas centre",before["center"],after["center"],flush=True)