summaryrefslogtreecommitdiffstats
path: root/tests/winWm.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/winWm.test')
-rw-r--r--tests/winWm.test209
1 files changed, 168 insertions, 41 deletions
diff --git a/tests/winWm.test b/tests/winWm.test
index ff537a4..2864418 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -10,10 +10,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
# Measure the height of a single menu line
@@ -23,17 +20,17 @@ frame .t.f -width 100 -height 50
pack .t.f
menu .t.m
.t.m add command -label "thisisreallylong"
-.t conf -menu .t.m
-wm geom .t -0-0
+.t configure -menu .t.m
+wm geometry .t -0-0
update
set menuheight [winfo y .t]
.t.m add command -label "thisisreallylong"
-wm geom .t -0-0
+wm geometry .t -0-0
update
-set menuheight [expr $menuheight - [winfo y .t]]
+set menuheight [expr {$menuheight - [winfo y .t]}]
destroy .t
-test winWm-1.1 {TkWmMapWindow} {pcOnly} {
+test winWm-1.1 {TkWmMapWindow} win {
toplevel .t
wm override .t 1
wm geometry .t +0+0
@@ -42,7 +39,7 @@ test winWm-1.1 {TkWmMapWindow} {pcOnly} {
destroy .t
set result
} {0 0}
-test winWm-1.2 {TkWmMapWindow} {pcOnly} {
+test winWm-1.2 {TkWmMapWindow} win {
toplevel .t
wm transient .t .
update
@@ -54,16 +51,16 @@ test winWm-1.2 {TkWmMapWindow} {pcOnly} {
destroy .t
set msg
} {can't iconify ".t": it is a transient}
-test winWm-1.3 {TkWmMapWindow} {pcOnly} {
+test winWm-1.3 {TkWmMapWindow} win {
toplevel .t
update
toplevel .t2
update
- set result [expr [winfo x .t] != [winfo x .t2]]
+ set result [expr {[winfo x .t] != [winfo x .t2]}]
destroy .t .t2
set result
} 1
-test winWm-1.4 {TkWmMapWindow} {pcOnly} {
+test winWm-1.4 {TkWmMapWindow} win {
toplevel .t
wm geometry .t +10+10
update
@@ -74,7 +71,7 @@ test winWm-1.4 {TkWmMapWindow} {pcOnly} {
destroy .t .t2
set result
} {10 40}
-test winWm-1.5 {TkWmMapWindow} {pcOnly} {
+test winWm-1.5 {TkWmMapWindow} win {
toplevel .t
wm iconify .t
update
@@ -83,7 +80,7 @@ test winWm-1.5 {TkWmMapWindow} {pcOnly} {
set result
} iconic
-test winWm-2.1 {TkpWmSetState} {pcOnly} {
+test winWm-2.1 {TkpWmSetState} win {
toplevel .t
wm geometry .t 150x50+10+10
update
@@ -97,7 +94,7 @@ test winWm-2.1 {TkpWmSetState} {pcOnly} {
destroy .t
set result
} {normal iconic normal}
-test winWm-2.2 {TkpWmSetState} {pcOnly} {
+test winWm-2.2 {TkpWmSetState} win {
toplevel .t
wm geometry .t 150x50+10+10
update
@@ -114,7 +111,7 @@ test winWm-2.2 {TkpWmSetState} {pcOnly} {
destroy .t
set result
} {normal withdrawn iconic normal}
-test winWm-2.2 {TkpWmSetState} {pcOnly} {
+test winWm-2.3 {TkpWmSetState} win {
toplevel .t
wm geometry .t 150x50+10+10
update
@@ -131,7 +128,7 @@ test winWm-2.2 {TkpWmSetState} {pcOnly} {
destroy .t
set result
} {normal withdrawn iconic normal}
-test winWm-2.4 {TkpWmSetState} {pcOnly} {
+test winWm-2.4 {TkpWmSetState} win {
set result {}
toplevel .t
wm geometry .t 150x50+10+10
@@ -150,7 +147,7 @@ test winWm-2.4 {TkpWmSetState} {pcOnly} {
set result
} {{normal 150x50+10+10} {iconic 150x50+10+10} {iconic 150x50+10+10} {normal 200x50+10+10}}
-test winWm-3.1 {ConfigureTopLevel: window geometry propagation} {pcOnly} {
+test winWm-3.1 {ConfigureTopLevel: window geometry propagation} win {
toplevel .t
wm geometry .t +0+0
button .t.b
@@ -164,38 +161,43 @@ test winWm-3.1 {ConfigureTopLevel: window geometry propagation} {pcOnly} {
update
pack .t.b
update
- set x [expr $x == [winfo x .t.b]]
+ set x [expr {$x == [winfo x .t.b]}]
destroy .t
set x
} 1
-test winWm-4.1 {ConfigureTopLevel: menu resizing} {pcOnly} {
+test winWm-4.1 {ConfigureTopLevel: menu resizing} win {
set result {}
toplevel .t
- frame .t.f -width 150 -height 50 -bg red
+ frame .t.f -width 150 -height 50 -background red
pack .t.f
wm geometry .t -0-0
update
set y [winfo y .t]
menu .t.m
.t.m add command -label foo
- .t conf -menu .t.m
+ .t configure -menu .t.m
update
- set result [expr $y - [winfo y .t]]
+ set result [expr {$y - [winfo y .t]}]
destroy .t
set result
-} [expr $menuheight + 1]
+} [expr {$menuheight + 1}]
-test winWm-5.1 {UpdateGeometryInfo: menu resizing} {pcOnly} {
+# This test works on 8.0p2 but has not worked on anything since 8.2.
+# It would be very strange to have a windows application increase the size
+# of the clientarea when a menu wraps so I believe this test to be wrong.
+# Original result was {50 50 50} new result may depend on the default menu
+# font
+test winWm-5.1 {UpdateGeometryInfo: menu resizing} win {
set result {}
toplevel .t
- frame .t.f -width 150 -height 50 -bg red
+ frame .t.f -width 150 -height 50 -background red
pack .t.f
update
set result [winfo height .t]
menu .t.m
.t.m add command -label foo
- .t conf -menu .t.m
+ .t configure -menu .t.m
update
lappend result [winfo height .t]
.t.m add command -label "thisisreallylong"
@@ -203,25 +205,26 @@ test winWm-5.1 {UpdateGeometryInfo: menu resizing} {pcOnly} {
update
lappend result [winfo height .t]
destroy .t
+
set result
-} {50 50 50}
-test winWm-5.2 {UpdateGeometryInfo: menu resizing} {pcOnly} {
+} {50 50 31}
+test winWm-5.2 {UpdateGeometryInfo: menu resizing} win {
set result {}
toplevel .t
- frame .t.f -width 150 -height 50 -bg red
+ frame .t.f -width 150 -height 50 -background red
pack .t.f
- wm geom .t -0-0
+ wm geometry .t -0-0
update
set y [winfo rooty .t]
lappend result [winfo height .t]
menu .t.m
- .t conf -menu .t.m
+ .t configure -menu .t.m
.t.m add command -label foo
.t.m add command -label "thisisreallylong"
.t.m add command -label "thisisreallylong"
update
lappend result [winfo height .t]
- lappend result [expr $y - [winfo rooty .t]]
+ lappend result [expr {$y - [winfo rooty .t]}]
destroy .t
set result
} {50 50 0}
@@ -230,7 +233,7 @@ test winWm-6.1 {wm attributes} win {
destroy .t
toplevel .t
wm attributes .t
-} {-alpha 1.0 -transparentcolor {} -disabled 0 -toolwindow 0 -topmost 0}
+} {-alpha 1.0 -transparentcolor {} -disabled 0 -fullscreen 0 -toolwindow 0 -topmost 0}
test winWm-6.2 {wm attributes} win {
destroy .t
toplevel .t
@@ -241,7 +244,7 @@ test winWm-6.3 {wm attributes} win {
destroy .t
toplevel .t
list [catch {wm attributes .t -foo} msg] $msg
-} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}}
+} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}}
test winWm-6.4 {wm attributes -alpha} win {
# Expect this to return all 1.0 {} on pre-2K/XP
@@ -307,8 +310,8 @@ test winWm-6.8 {wm attributes -transparentcolor} win {
list [catch {wm attributes .t -tr foo} msg] $msg
} {1 {unknown color name "foo"}}
-test winWm-7.1 {deiconify on an unmapped toplevel
- will raise the window and set the focus} {pcOnly} {
+test winWm-7.1 {deiconify on an unmapped toplevel\
+ will raise the window and set the focus} win {
destroy .t
toplevel .t
lower .t
@@ -318,8 +321,8 @@ test winWm-7.1 {deiconify on an unmapped toplevel
list [wm stackorder .t isabove .] [focus]
} {1 .t}
-test winWm-7.2 {deiconify on an already mapped toplevel
- will raise the window and set the focus} {pcOnly} {
+test winWm-7.2 {deiconify on an already mapped toplevel\
+ will raise the window and set the focus} win {
destroy .t
toplevel .t
lower .t
@@ -365,8 +368,132 @@ test winWm-8.2 {Tk_WmCmd procedure, "iconphoto" option} win {
image delete blank16 blank32
} {}
+test winWm-9.0 "Bug #2799589 - delayed activation of destroyed window" -constraints win -setup {
+ proc winwm90click {w} {
+ if {![winfo ismapped $w]} { update }
+ event generate $w <Enter>
+ focus -force $w
+ event generate $w <ButtonPress-1> -x 5 -y 5
+ event generate $w <ButtonRelease-1> -x 5 -y 5
+ }
+ proc winwm90proc3 {} {
+ global winwm90done winwm90check
+ set w .sd
+ toplevel $w
+ pack [button $w.b -text "OK" -command {set winwm90check 1}]
+ bind $w.b <Map> {after idle {winwm90click %W}}
+ update idletasks
+ tkwait visibility $w
+ grab $w
+ tkwait variable winwm90check
+ grab release $w
+ destroy $w
+ after idle {set winwm90done ok}
+ }
+ proc winwm90proc2 {w} { winwm90proc3; destroy $w }
+ proc winwm90proc1 {w} {
+ toplevel $w
+ pack [button $w.b -text "Do dialog" -command [list winwm90proc2 $w]]
+ bind $w.b <Map> {bind %W <Map> {}; after idle {winwm90click %W}}
+ }
+ destroy .t
+ global winwm90done
+ set winwm90done wait
+ toplevel .t
+} -body {
+ pack [button .t.b -text "Show" -command {winwm90proc1 .tx}]
+ bind .t.b <Map> {bind %W <Map> {}; after idle {winwm90click %W}}
+ after 5000 {set winwm90done timeout}
+ vwait winwm90done
+ set winwm90done
+} -cleanup {
+ foreach cmd {proc1 proc2 proc3 click} {
+ rename winwm90$cmd {}
+ }
+ destroy .tx .t .sd
+} -result {ok}
+
+test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win -setup {
+ proc winwm91click {w} {
+ if {![winfo ismapped $w]} { update }
+ event generate $w <Enter>
+ focus -force $w
+ event generate $w <ButtonPress-1> -x 5 -y 5
+ event generate $w <ButtonRelease-1> -x 5 -y 5
+ }
+ proc winwm91proc3 {} {
+ global winwm91done winwm91check
+ set w .sd
+ toplevel $w
+ pack [button $w.b -text "OK" -command {set winwm91check 1}]
+ bind $w.b <Map> {after idle {winwm91click %W}}
+ update idletasks
+ tkwait visibility $w
+ grab $w
+ tkwait variable winwm91check
+ #skip the release: #grab release $w
+ destroy $w
+ after idle {set winwm91done ok}
+ }
+ proc winwm91proc2 {w} { winwm91proc3; destroy $w }
+ proc winwm91proc1 {w} {
+ toplevel $w
+ pack [button $w.b -text "Do dialog" -command [list winwm91proc2 $w]]
+ bind $w.b <Map> {bind %W <Map> {}; after idle {winwm91click %W}}
+ }
+ destroy .t
+ global winwm91done
+ set winwm91done wait
+ toplevel .t
+} -body {
+ pack [button .t.b -text "Show" -command {winwm91proc1 .tx}]
+ bind .t.b <Map> {bind %W <Map> {}; after idle {winwm91click %W}}
+ after 5000 {set winwm91done timeout}
+ vwait winwm91done
+ set winwm91done
+} -cleanup {
+ foreach cmd {proc1 proc2 proc3 click} {
+ rename winwm91$cmd {}
+ }
+ destroy .tx .t .sd
+} -result {ok}
+
+test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup {
+ destroy .t
+ toplevel .t
+ set winwm92 {}
+ frame .t.f -background blue -height 200 -width 200
+ frame .t.f.x -background red -height 100 -width 100
+} -body {
+ pack .t.f.x
+ pack .t.f
+ set aid [after 1000 {set ::winwm92 timeout}]
+ after 100 {
+ wm manage .t.f
+ wm iconify .t
+ after 100 {
+ wm forget .t.f
+ wm deiconify .t
+ after 100 {
+ pack .t.f
+ after 100 {set ::winwm92 [expr {[winfo rooty .t.f.x] == 0 ? "failed" : "ok"}]}
+ }
+ }
+ }
+ vwait ::winwm92
+ after cancel $aid
+ set winwm92
+} -cleanup {
+ destroy .t.f.x .t.f .t
+ unset -nocomplain winwm92 aid
+} -result ok
+
destroy .t
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
+
+# Local variables:
+# mode: tcl
+# End: