@@ -41,9 +41,55 @@ private final class DashboardBrowserImportGate {
4141 }
4242}
4343
44+ private final class DashboardWindowGestureSpy : NSWindow {
45+ private( set) var dragCount = 0
46+ private( set) var zoomCount = 0
47+
48+ override func performDrag ( with _ : NSEvent ) {
49+ self . dragCount += 1
50+ }
51+
52+ override func performZoom ( _ : Any ? ) {
53+ self . zoomCount += 1
54+ }
55+ }
56+
4457@ Suite ( . serialized )
4558@ MainActor
4659struct DashboardWindowSmokeTests {
60+ @ Test func `dashboard frame routes single click to drag and double click to zoom` ( ) throws {
61+ let window = DashboardWindowGestureSpy (
62+ contentRect : NSRect ( x : 0 , y : 0 , width : 800 , height : 600 ) ,
63+ styleMask : [ . titled , . resizable ] ,
64+ backing : . buffered ,
65+ defer : false )
66+ let dragRegion = DashboardWindowDragRegionView (
67+ frame : NSRect ( x : 0 , y : 0 , width : 300 , height : 12 ) )
68+ window . contentView = dragRegion
69+ let mouseDownEvent : ( Int ) -> NSEvent ? = { clickCount in
70+ NSEvent . mouseEvent (
71+ with : . leftMouseDown ,
72+ location : NSPoint ( x : 100 , y : 6 ) ,
73+ modifierFlags : [ ] ,
74+ timestamp : 0 ,
75+ windowNumber : window . windowNumber ,
76+ context : nil ,
77+ eventNumber : clickCount ,
78+ clickCount : clickCount ,
79+ pressure : 1 )
80+ }
81+
82+ dragRegion . mouseDown ( with : try #require ( mouseDownEvent ( 1 ) ) )
83+
84+ #expect ( window . dragCount == 1 )
85+ #expect ( window . zoomCount == 0 )
86+
87+ dragRegion . mouseDown ( with : try #require ( mouseDownEvent ( 2 ) ) )
88+
89+ #expect ( window . dragCount == 1 )
90+ #expect ( window . zoomCount == 1 )
91+ }
92+
4793 @ Test func `dashboard window controller shows and closes` ( ) throws {
4894 let url = try #require ( URL ( string : " http://127.0.0.1:18789/control/#token=device-token " ) )
4995 let controller = DashboardWindowController (
0 commit comments