Artifact
28ebeababf5e937ae9102f3b9f0a8e83e60625ef75e71967602ce0556aaddd5a:
Attachment "exercise.tcl" to
ticket [b6f0d688]
added by
erikleunissen
2021-12-12 15:07:16.
#! /bin/sh
# If executed as a shell script, the next line replaces the shell \
exec tclsh "$0" ${1+"$@"}
package require tcltest
tcltest::configure -verbose beps
proc twait {duration} {
set ::_twait 1; after $duration {unset ::_twait}
vwait ::_twait
}
package require Tk
wm geometry . 200x200+300+300
tcltest::test winfo_container-1 {regular toplevel has no container window} -body {
winfo container .
} -result ""
tcltest::test winfo_container-2 {unmanaged window has no container window} -body {
frame .f; # not packed
twait 200
winfo container .f
} -cleanup {
destroy .f
} -result ""
tcltest::test winfo_container-3 {container window is parent} -body {
wm deiconify .
pack propagate . 0
pack [frame .f -bg green -width 50 -height 50]
twait 200
winfo container .f
} -cleanup {
destroy .f
twait 200
} -result "."
tcltest::test winfo_container-4 {container window is not parent} -body {
wm deiconify .
pack propagate . 0
pack [frame .f -bg green -width 50 -height 50]
pack propagate .f 0
pack [frame .g -bg yellow -width 20 -height 20] -in .f
twait 400
winfo container .g
} -cleanup {
destroy .f .g
twait 200
} -result ".f"
tcltest::cleanupTests