summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2022-10-08 21:15:20 (GMT)
committerculler <culler>2022-10-08 21:15:20 (GMT)
commitad6d5ee2edbdcabf0d5beabf5170dd36ba7d1a55 (patch)
treee899deee7d567f35b819b0ce5a7c6339cdbac0a8
parent18c5d573bcfce125b6987108b18be6f851ef00a8 (diff)
downloadtk-ad6d5ee2edbdcabf0d5beabf5170dd36ba7d1a55.zip
tk-ad6d5ee2edbdcabf0d5beabf5170dd36ba7d1a55.tar.gz
tk-ad6d5ee2edbdcabf0d5beabf5170dd36ba7d1a55.tar.bz2
Add delays and updates to make tests pass on Ventura.
-rw-r--r--tests/raise.test1
-rw-r--r--tests/unixWm.test44
-rw-r--r--tests/wm.test12
3 files changed, 45 insertions, 12 deletions
diff --git a/tests/raise.test b/tests/raise.test
index f8674fc..f596b2f 100644
--- a/tests/raise.test
+++ b/tests/raise.test
@@ -20,6 +20,7 @@ proc raise_setup {} {
foreach i [winfo child .raise] {
destroy $i
}
+ update idletasks
foreach i {a b c d e} {
label .raise.$i -text $i -relief raised -bd 2
}
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 4f94cc1..c7978a3 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -16,6 +16,17 @@ namespace import -force ::tk::test:loadTkCommand
testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+# Starting with macOS Ventura it became necessary to wait for windows to be restacked
+# or to be raised after creation.
+
+if {[tk windowingsystem] == "aqua"} {
+ proc restackDelay {} {
+ after 100;
+ }
+} else {
+ proc restackDelay {} {}
+}
+
proc sleep ms {
global x
after $ms {set x 1}
@@ -1823,13 +1834,16 @@ test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, tit
test unixWm-50.2 {Tk_CoordsToWindow procedure, finding a toplevel, y-coords and overrideredirect} unix {
deleteWindows
toplevel .t -width 400 -height 300 -bg yellow
- wm geom .t +100+100
tkwait visibility .t
+ wm geom .t +100+100
+ update
+ restackDelay
toplevel .t2 -width 200 -height 100 -bg blue
+ tkwait visibility .t2
wm overrideredirect .t2 1
wm geom .t2 +200+200
- tkwait visibility .t2
raise .t2
+ restackDelay
set x [winfo rootx .t]
set y [winfo rooty .t]
set y2 [winfo rooty .t2]
@@ -1879,12 +1893,13 @@ test unixWm-50.4 {Tk_CoordsToWindow procedure, window in other application} unix
catch {interp delete child}
toplevel .t -width 200 -height 200 -bg green
- wm geometry .t +100+100
tkwait visibility .t
+ wm geometry .t +100+100
update
interp create child
load {} Tk child
- child eval {wm geometry . 200x200+100+100; tkwait visibility . ; update}
+ child eval {wm geometry . 200x200+100+100; update}
+ restackDelay
set result [list [winfo containing 200 200] \
[child eval {winfo containing 200 200}]]
interp delete child
@@ -1967,11 +1982,13 @@ test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUb
destroy .t
destroy .t2
toplevel .t -width 200 -height 200 -bg green
- wm geometry .t +0+0
tkwait visibility .t
+ wm geometry .t +0+0
+ update idletasks
toplevel .t2 -width 200 -height 200 -bg red
- wm geometry .t2 +0+0
tkwait visibility .t2
+ wm geometry .t2 +0+0
+ restackDelay
set result [list [winfo containing 100 100]]
wm iconify .t2
update idletasks
@@ -2048,24 +2065,28 @@ deleteWindows
test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapped} unix {
destroy .t
toplevel .t -width 200 -height 200 -bg green
- wm geometry .t +0+0
tkwait visibility .t
+ wm geometry .t +0+0
+ update
+ restackDelay
destroy .t2
toplevel .t2 -width 200 -height 200 -bg red
- wm geometry .t2 +0+0
+ # This test assumes that .t2 is not mapped yet, but that is not really guaranteed.
winfo containing 100 100
} {.t}
test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} {unix failsOnXQuarz} {
foreach w {.t .t2 .t3} {
destroy $w
- update
toplevel $w -width 200 -height 200 -bg green
wm geometry $w +0+0
+ update
}
raise .t .t2
+ restackDelay
update
set result [list [winfo containing 100 100]]
lower .t3
+ restackDelay
lappend result [winfo containing 100 100]
} {.t3 .t}
test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix {
@@ -2079,6 +2100,7 @@ test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix
wm overrideredirect .t2 1
wm geometry .t2 +0+0
tkwait visibility .t2
+ restackDelay
# Need to use vrootx and vrooty to make tests work correctly with
# virtual root window measures managers: overrideredirect windows
@@ -2089,8 +2111,10 @@ test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix
set y [expr 100-[winfo vrooty .]]
set result [list [winfo containing $x $y]]
raise .t
+ restackDelay
lappend result [winfo containing $x $y]
raise .t2
+ restackDelay
lappend result [winfo containing $x $y]
} {.t2 .t .t2}
# The mac won't put an overrideredirect window above the root,
@@ -2108,6 +2132,7 @@ test unixWm-51.9 {TkWmRestackToplevel procedure, other window overrideredirect}
update
}
lower .t3 .t2
+ restackDelay
update
# Need to use vrootx and vrooty to make tests work correctly with
@@ -2119,6 +2144,7 @@ test unixWm-51.9 {TkWmRestackToplevel procedure, other window overrideredirect}
set y [expr 100-[winfo vrooty .]]
set result [list [winfo containing $x $y]]
lower .t2
+ restackDelay
lappend result [winfo containing $x $y]
} {.t2 .t3}
if {[tk windowingsystem] == "aqua"} {
diff --git a/tests/wm.test b/tests/wm.test
index 52a2422..78cd6b7 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -1347,6 +1347,7 @@ deleteWindows
test wm-stackorder-2.1 {stacking order} -body {
toplevel .t ; update
+ raiseDelay
wm stackorder .
} -cleanup {
destroy .t
@@ -1399,6 +1400,7 @@ test wm-stackorder-2.5 {stacking order} -setup {
} -result {.parent.child2 .parent.child1 .parent}
test wm-stackorder-2.6 {stacking order: non-toplevel widgets ignored} -body {
toplevel .t1
+ raiseDelay
button .t1.b
pack .t1.b
update
@@ -1418,6 +1420,7 @@ test wm-stackorder-3.1 {unmapped toplevel} -constraints {failsOnUbuntu failsOnXQ
toplevel .t1 ; update
toplevel .t2 ; update
wm iconify .t1
+ raiseDelay
wm stackorder .
} -cleanup {
destroy .t1 .t2
@@ -1426,6 +1429,7 @@ test wm-stackorder-3.2 {unmapped toplevel} -body {
toplevel .t1 ; update
toplevel .t2 ; update
wm withdraw .t2
+ raiseDelay
wm stackorder .
} -cleanup {
destroy .t1 .t2
@@ -1459,6 +1463,7 @@ test wm-stackorder-3.6 {unmapped toplevel} -body {
toplevel .t1.t2 ; update
toplevel .t1.t2.t3 ; update
wm withdraw .t1.t2
+ raiseDelay
wm stackorder .t1
} -cleanup {
destroy .t1
@@ -1561,10 +1566,11 @@ test wm-stackorder-5.3 {An overrideredirect window\
} -result 1
test wm-stackorder-6.1 {An embedded toplevel does not appear in the \
- stacking order} -body {
+ stacking order} -body {
toplevel .real -container 1
+ raiseDelay
toplevel .embd -bg blue -use [winfo id .real]
- update
+ raiseDelay
wm stackorder .
} -cleanup {
deleteWindows
@@ -1936,7 +1942,7 @@ test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints
lappend result [winfo ismapped .t1] [winfo ismapped .t2]
wm deiconify .t1; update
lappend result [winfo ismapped .t1] [winfo ismapped .t2]
- raise .t1; update
+ raise .t1; raiseDelay; update
lappend result [lsearch -all -inline -glob [wm stackorder .] ".t?"]
} -cleanup {
deleteWindows