From ab5ff1e5af4e2083b9636db058a19d7566ae1088 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 30 Nov 2024 16:55:10 +0000 Subject: [PATCH] Provide a potential fallback for proc menubarheight. --- tests/constraints.tcl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/constraints.tcl b/tests/constraints.tcl index ab59617a0..264f7a72e 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -241,6 +241,27 @@ namespace eval tk { } namespace export controlPointerWarpTiming + # On macOS windows are not allowed to overlap the menubar at the top of the + # screen or the dock. So tests which move a window and then check whether it + # got moved to the requested location should use a y coordinate larger than the + # height of the menubar (normally 23 pixels) and an x coordinate larger than the + # width of the dock, if it happens to be on the left. + # menubarheight deals with this issue but may not be available from the test + # environment, therefore provide a fallback here + if {[llength [info procs menubarheight]] == 0} { + if {[tk windowingsystem] ne "aqua"} { + # Windows may overlap the menubar + proc menubarheight {} { + return 0 + } + } else { + # Windows may not overlap the menubar + proc menubarheight {} { + return 30 ; # arbitrary value known to be larger than the menubar height + } + } + namespace export menubarheight + } } }