summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-29 19:40:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-29 19:40:55 (GMT)
commit2817b85e0527030b511e160a195365123fed2d07 (patch)
tree2bfba12abff371ec499d717c0a713b5ad8b4b7c0 /tests
parent2a199bdd9fa352a6111e39f8ff18135da47a6e3c (diff)
parent2cf5a82a75201dd866c90d3add0462c19854d88f (diff)
downloadtk-2817b85e0527030b511e160a195365123fed2d07.zip
tk-2817b85e0527030b511e160a195365123fed2d07.tar.gz
tk-2817b85e0527030b511e160a195365123fed2d07.tar.bz2
Merge 8.6
Diffstat (limited to 'tests')
-rw-r--r--tests/imgPhoto.test33
-rw-r--r--tests/menu.test2
-rw-r--r--tests/menubut.test26
-rw-r--r--tests/scale.test59
-rw-r--r--tests/send.test18
-rw-r--r--tests/text.test15
-rw-r--r--tests/unixButton.test24
-rw-r--r--tests/unixEmbed.test648
-rw-r--r--tests/unixWm.test39
-rw-r--r--tests/wm.test14
10 files changed, 775 insertions, 103 deletions
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index 97fb7ae..c45c5fb 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -1212,6 +1212,39 @@ test imgPhoto-14.5 {Bug [fbaed1f66b] - GIF decoder with deferred clear code} -se
image create photo -file $fileName -format "gif -index 2"
} -returnCodes error -result {no image data for this index}
+test imgPhoto-14.6 {Access Subimage after Subimage with buffer overflow. Ticket 4da2191b} -setup {
+ set data {
+ R0lGODlhYwA5APcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgAysnGy8hKzM
+ hASs3MTcjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDAwP8AAAD/
+ AP//AAAA//8A/wD//////ywAAAAAYwA5AAAI/wAZCBxIsKDBgwgTKlzIsKHD
+ hxAjSpxIsaLFixgzatzIsaPHjyBDihxJsqTJkyhTqlzJsqXLlzBjypxJs6bN
+ mzhz6tzJs6fPn0CDCh1KtKhRiwoSKEXAtGlTpUqPGkyagOmCq1edNsWalWkC
+ BUSXIuDqFepBqFWtZv3KU+zYrkrBSqT6dgECtjOTbu16NwFHvV3lshRLti/J
+ qlgRCE6ZuO9ik4Dt+k0ZVyZiyVIvXr77ODPEy5g9T4zMWfTEzXdNz1VbWvXn
+ uqldP1TAOrbshqBb314Y2W7n3Qdpv7UNPCHpycUVbv6dnODy5sqzQldIe8H0
+ hciva9/Ovbv37+BzBgE7ACH5BAFkAAMALAAAAAAEAAQAAAMEKLrckgA7
+ }
+} -body {
+ image create photo photo1 -data $data -format "GIF -index 1"
+} -cleanup {
+ catch {image delete photo1}
+} -result photo1
+
test imgPhoto-15.1 {photo images can fail to allocate memory gracefully} -constraints {
nonPortable
} -body {
diff --git a/tests/menu.test b/tests/menu.test
index 95699ff..9ad2a0c 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -1606,7 +1606,7 @@ test menu-3.47 {MenuWidgetCmd procedure, "post" option} -setup {
.m1 post
} -cleanup {
destroy .m1
-} -returnCodes error -result {wrong # args: should be ".m1 post x y"}
+} -returnCodes error -result {wrong # args: should be ".m1 post x y ?index?"}
test menu-3.48 {MenuWidgetCmd procedure, "post" option} -setup {
destroy .m1
} -body {
diff --git a/tests/menubut.test b/tests/menubut.test
index 6efdb0f..88f4330 100644
--- a/tests/menubut.test
+++ b/tests/menubut.test
@@ -542,7 +542,11 @@ test menubutton-6.1 {MenuButtonCmdDeletedProc procedure} -setup {
deleteWindows
} -result {{} {}}
-
+if {[tk windowingsystem] == "aqua"} {
+ set extraWidth 36
+} else {
+ set extraWidth 0
+}
test menubutton-7.1 {ComputeMenuButtonGeometry procedure} -constraints {
testImageType
} -setup {
@@ -555,33 +559,33 @@ test menubutton-7.1 {ComputeMenuButtonGeometry procedure} -constraints {
} -cleanup {
deleteWindows
imageCleanup
-} -result {38 23}
+} -result [list [expr {38 + $extraWidth}] 23]
test menubutton-7.2 {ComputeMenuButtonGeometry procedure} -constraints {
testImageType
} -setup {
deleteWindows
image create test image1
} -body {
- menubutton .mb -image image1 -bd 1 -highlightthickness 2
+ menubutton .mb -image image1 -bd 3 -highlightthickness 1
pack .mb
list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
deleteWindows
imageCleanup
-} -result {36 21}
+} -result [list [expr {38 + $extraWidth}] 23]
test menubutton-7.3 {ComputeMenuButtonGeometry procedure} -constraints {
testImageType
} -setup {
deleteWindows
image create test image1
} -body {
- menubutton .mb -image image1 -bd 0 -highlightthickness 2 -padx 5 -pady 5
+ menubutton .mb -image image1 -bd 1 -highlightthickness 3 -padx 5 -pady 5
pack .mb
list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
deleteWindows
imageCleanup
-} -result {34 19}
+} -result [list [expr {38 + $extraWidth}] 23]
test menubutton-7.4 {ComputeMenuButtonGeometry procedure} -constraints {
testImageType
} -setup {
@@ -595,7 +599,7 @@ test menubutton-7.4 {ComputeMenuButtonGeometry procedure} -constraints {
} -cleanup {
deleteWindows
imageCleanup
-} -result {48 23}
+} -result [list [expr {48 + $extraWidth}] 23]
test menubutton-7.5 {ComputeMenuButtonGeometry procedure} -constraints {
testImageType
} -setup {
@@ -609,7 +613,7 @@ test menubutton-7.5 {ComputeMenuButtonGeometry procedure} -constraints {
} -cleanup {
deleteWindows
imageCleanup
-} -result {38 38}
+} -result [list [expr {38 + $extraWidth}] 38]
test menubutton-7.6 {ComputeMenuButtonGeometry procedure} -setup {
deleteWindows
} -body {
@@ -619,7 +623,7 @@ test menubutton-7.6 {ComputeMenuButtonGeometry procedure} -setup {
list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
deleteWindows
-} -result {25 35}
+} -result [list [expr {25 + $extraWidth}] 35]
test menubutton-7.7 {ComputeMenuButtonGeometry procedure} -setup {
deleteWindows
} -body {
@@ -629,7 +633,7 @@ test menubutton-7.7 {ComputeMenuButtonGeometry procedure} -setup {
list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
deleteWindows
-} -result {46 33}
+} -result [list [expr {46 + $extraWidth}] 33]
test menubutton-7.8 {ComputeMenuButtonGeometry procedure} -setup {
deleteWindows
} -body {
@@ -639,7 +643,7 @@ test menubutton-7.8 {ComputeMenuButtonGeometry procedure} -setup {
list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
deleteWindows
-} -result {23 56}
+} -result [list [expr {23 + $extraWidth}] 56]
test menubutton-7.9 {ComputeMenuButtonGeometry procedure} -constraints {
fonts
} -setup {
diff --git a/tests/scale.test b/tests/scale.test
index 79524eb..7fa3a62 100644
--- a/tests/scale.test
+++ b/tests/scale.test
@@ -1104,78 +1104,78 @@ test scale-13.6 {SetScaleValue procedure} -body {
destroy .s
pack [scale .s]
update
-test scale-14.1 {RoundToResolution procedure} -body {
+test scale-14.1 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 84 152
} -result 72
-test scale-14.2 {RoundToResolution procedure} -body {
+test scale-14.2 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
} -result 76
-test scale-14.3 {RoundToResolution procedure} -body {
+test scale-14.3 {RoundValueToResolution procedure} -body {
.s configure -from 100 -to 0 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 84 152
} -result 28
-test scale-14.4 {RoundToResolution procedure} -body {
+test scale-14.4 {RoundValueToResolution procedure} -body {
.s configure -from 100 -to 0 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
} -result 24
-test scale-14.5 {RoundToResolution procedure} -body {
+test scale-14.5 {RoundValueToResolution procedure} -body {
.s configure -from -100 -to 0 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 84 152
} -result {-28}
-test scale-14.6 {RoundToResolution procedure} -body {
+test scale-14.6 {RoundValueToResolution procedure} -body {
.s configure -from -100 -to 0 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
} -result {-24}
-test scale-14.7 {RoundToResolution procedure} -body {
+test scale-14.7 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 84 152
} -result {-72}
-test scale-14.8 {RoundToResolution procedure} -body {
+test scale-14.8 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
} -result {-76}
-test scale-14.9 {RoundToResolution procedure} -body {
+test scale-14.9 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 2.25 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 0
update
.s get 84 152
} -result {1.64}
-test scale-14.10 {RoundToResolution procedure} -body {
+test scale-14.10 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 2.25 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 0
update
.s get 86 152
} -result {1.69}
-test scale-14.11 {RoundToResolution procedure} -body {
+test scale-14.11 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 225 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 0 -digits 5
update
.s get 84 152
} -result {164.25}
-test scale-14.12 {RoundToResolution procedure} -body {
+test scale-14.12 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 225 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 0 -digits 5
update
@@ -1183,6 +1183,41 @@ test scale-14.12 {RoundToResolution procedure} -body {
} -result {168.75}
destroy .s
+test scale-14.13 {RoundValueToResolution procedure, round-off errors} -setup {
+ # see [220665ffff], and duplicates [220265ffff] and [779559ffff]
+ set x NotSet
+ pack [scale .s -orient horizontal -resolution .1 -from -180 -to 180 -command "set x"]
+ update
+} -body {
+ .s configure -background red
+ update
+ set x
+} -cleanup {
+ destroy .s
+} -result {NotSet}
+
+test scale-14a.1 {RoundValueToResolution, RoundIntervalToResolution procedures} -setup {
+ pack [scale .s -orient horizontal]
+ update
+} -body {
+ .s configure -length 400 -bd 0 -from 1 -to 9 -resolution 2 -tickinterval 1
+ update
+ .s get 200 0
+} -cleanup {
+ destroy .s
+} -result {5}
+test scale-14a.2 {RoundValueToResolution, RoundIntervalToResolution procedures} -setup {
+ pack [scale .s -orient horizontal]
+ update
+} -body {
+ .s configure -length 400 -bd 0 -from -1.5 -to 1.5 -resolution 1 \
+ -tickinterval 1 -digits 2
+ update
+ .s get 250 0
+} -cleanup {
+ destroy .s
+} -result {0.5}
+
test scale-15.1 {ScaleVarProc procedure} -setup {
deleteWindows
diff --git a/tests/send.test b/tests/send.test
index 945d4d0..403a207 100644
--- a/tests/send.test
+++ b/tests/send.test
@@ -197,7 +197,8 @@ test send-7.4 {Tk_SetAppName procedure, name in use} {secureserver testsend} {
list [tk appname foo] [testsend prop root InterpRegistry]
} "{foo #4} {$commId foo #4\n$id foo\n$id foo #2\n$id foo #3\n}"
-test send-8.1 {Tk_SendCmd procedure, options} {secureserver} {
+#macOS does not send to other processes
+test send-8.1 {Tk_SendCmd procedure, options} {secureserver notAqua} {
setupbg
set app [dobg {tk appname}]
set a 66
@@ -222,10 +223,11 @@ test send-8.2 {Tk_SendCmd procedure, options} {secureserver altDisplay} {
cleanupbg
set result
} {altDisplay homeDisplay}
-test send-8.3 {Tk_SendCmd procedure, options} {secureserver} {
+# Since macOS has no registry of interpreters, 8.3, 8.4 and 8.10 will fail.
+test send-8.3 {Tk_SendCmd procedure, options} {secureserver notAqua} {
list [catch {send -- -async foo bar baz} msg] $msg
} {1 {no application named "-async"}}
-test send-8.4 {Tk_SendCmd procedure, options} {secureserver} {
+test send-8.4 {Tk_SendCmd procedure, options} {secureserver notAqua} {
list [catch {send -gorp foo bar baz} msg] $msg
} {1 {no application named "-gorp"}}
test send-8.5 {Tk_SendCmd procedure, options} {secureserver} {
@@ -253,7 +255,7 @@ test send-8.9 {Tk_SendCmd procedure, local execution} {secureserver} {
"open bad_file"
invoked from within
"send [tk appname] open bad_file"} {posix enoent {no such file or directory}}}
-test send-8.10 {Tk_SendCmd procedure, no such interpreter} {secureserver} {
+test send-8.10 {Tk_SendCmd procedure, no such interpreter} {secureserver notAqua} {
list [catch {send bogus_name bogus_command} msg] $msg
} {1 {no application named "bogus_name"}}
@@ -542,7 +544,8 @@ test send-12.1 {TimeoutProc procedure} {secureserver testsend} {
catch {testsend prop root InterpRegistry ""}
-test send-12.2 {TimeoutProc procedure} {secureserver} {
+#macOS does not send to other processes
+test send-12.2 {TimeoutProc procedure} {secureserver notAqua} {
winfo interps
tk appname tktest
update
@@ -557,16 +560,17 @@ test send-12.2 {TimeoutProc procedure} {secureserver} {
set result
} {1 {target application died}}
+#macOS does not send to other processes
winfo interps
tk appname tktest
-test send-13.1 {DeleteProc procedure} {secureserver} {
+test send-13.1 {DeleteProc procedure} {secureserver notAqua} {
setupbg
set app [dobg {rename send {}; tk appname}]
set result [list [catch {send $app foo} msg] $msg [winfo interps]]
cleanupbg
set result
} {1 {no application named "tktest #2"} tktest}
-test send-13.2 {DeleteProc procedure} {secureserver} {
+test send-13.2 {DeleteProc procedure} {secureserver notAqua} {
winfo interps
tk appname tktest
rename send {}
diff --git a/tests/text.test b/tests/text.test
index aaddc2c..be25ca6 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -3474,6 +3474,12 @@ test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
# minimum size and it was interfering with the size requested by the -setgrid.
# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
# to the appropriate size.
+# On macOS, however, there is no way to make the window overlap the menubar.
+if {[tk windowingsystem] == "aqua"} {
+ set minY 23
+} else {
+ set minY 0
+}
test text-14.19 {ConfigureText procedure} -setup {
toplevel .top
text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
@@ -3481,16 +3487,17 @@ test text-14.19 {ConfigureText procedure} -setup {
.top.t configure -width 20 -height 10 -setgrid 1
wm overrideredirect .top 1
pack .top.t
- wm geometry .top +0+0
+ wm geometry .top +0+$minY
update
wm geometry .top
} -cleanup {
destroy .top
-} -result {20x10+0+0}
+} -result "20x10+0+$minY"
# This test was failing on Windows because the title bar on .t was a certain
# minimum size and it was interfering with the size requested by the -setgrid.
# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
# to the appropriate size.
+# On macOS we again use minY as a workaround.
test text-14.20 {ConfigureText procedure} -setup {
toplevel .top
text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
@@ -3498,7 +3505,7 @@ test text-14.20 {ConfigureText procedure} -setup {
.top.t configure -width 20 -height 10 -setgrid 1
wm overrideredirect .top 1
pack .top.t
- wm geometry .top +0+0
+ wm geometry .top +0+$minY
update
set result [wm geometry .top]
wm geometry .top 15x8
@@ -3509,7 +3516,7 @@ test text-14.20 {ConfigureText procedure} -setup {
lappend result [wm geometry .top]
} -cleanup {
destroy .top
-} -result {20x10+0+0 15x8+0+0 15x8+0+0}
+} -result "20x10+0+$minY 15x8+0+$minY 15x8+0+$minY"
test text-15.1 {TextWorldChanged procedure, spacing options} -constraints {
diff --git a/tests/unixButton.test b/tests/unixButton.test
index 137ef33..325f497 100644
--- a/tests/unixButton.test
+++ b/tests/unixButton.test
@@ -35,7 +35,15 @@ proc bogusTrace args {
error "trace aborted"
}
-
+if {[tk windowingsystem] eq "aqua"} {
+ set smallIndicator 20
+ set bigIndicator 20
+ set defaultBorder 10
+} else {
+ set smallIndicator 27
+ set bigIndicator 40
+ set defaultBorder 20
+}
test unixbutton-1.1 {TkpComputeButtonGeometry procedure} -constraints {
unix testImageType
} -setup {
@@ -57,7 +65,10 @@ test unixbutton-1.1 {TkpComputeButtonGeometry procedure} -constraints {
} -cleanup {
deleteWindows
image delete image1
-} -result {68 48 74 54 112 52 112 52}
+} -result [list 68 48 \
+ 74 54 \
+ [expr {72 + $bigIndicator}] 52 \
+ [expr {72 + $bigIndicator}] 52]
test unixbutton-1.2 {TkpComputeButtonGeometry procedure} -constraints {
unix
} -setup {
@@ -75,7 +86,10 @@ test unixbutton-1.2 {TkpComputeButtonGeometry procedure} -constraints {
[winfo reqwidth .b4] [winfo reqheight .b4]
} -cleanup {
deleteWindows
-} -result {23 33 29 39 54 37 54 37}
+} -result [list 23 33 \
+ 29 39 \
+ [expr {27 + $smallIndicator}] 37 \
+ [expr {27 + $smallIndicator}] 37]
test unixbutton-1.3 {TkpComputeButtonGeometry procedure} -constraints {
unix
} -setup {
@@ -186,7 +200,7 @@ test unixbutton-1.9 {TkpComputeButtonGeometry procedure} -constraints {
list [winfo reqwidth .b2] [winfo reqheight .b2]
} -cleanup {
deleteWindows
-} -result {37 47}
+} -result [list [expr {17 + $defaultBorder}] [expr {27 + $defaultBorder}]]
test unixbutton-1.10 {TkpComputeButtonGeometry procedure} -constraints {
unix
} -setup {
@@ -196,7 +210,7 @@ test unixbutton-1.10 {TkpComputeButtonGeometry procedure} -constraints {
list [winfo reqwidth .b2] [winfo reqheight .b2]
} -cleanup {
deleteWindows
-} -result {37 47}
+} -result [list [expr {17 + $defaultBorder}] [expr {27 + $defaultBorder}]]
test unixbutton-1.11 {TkpComputeButtonGeometry procedure} -constraints {
unix
} -setup {
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index 8aaa3c4..99f7265 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -1,4 +1,4 @@
-# This file is a Tcl script to test out the procedures in the file
+# This file is a Tcl script to test out the procedures in the file
# tkUnixEmbed.c. It is organized in the standard fashion for Tcl
# tests.
#
@@ -11,6 +11,37 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
+namespace eval ::_test_tmp {}
+
+# ------------------------------------------------------------------------------
+# Proc ::_test_tmp::testInterp
+# ------------------------------------------------------------------------------
+# Command that creates an unsafe child interpreter and tries to load Tk.
+# This code is borrowed from safePrimarySelection.test
+# This is necessary for loading Tktest if the tests are done in the build
+# directory without installing Tk. In that case the usual auto_path loading
+# mechanism cannot work because the tk binary is not where pkgIndex.tcl says
+# it is.
+# ------------------------------------------------------------------------------
+
+namespace eval ::_test_tmp {
+ variable TkLoadCmd
+}
+
+foreach pkg [info loaded] {
+ if {[lindex $pkg 1] eq "Tk"} {
+ set ::_test_tmp::TkLoadCmd [list load {*}$pkg]
+ break
+ }
+}
+
+proc ::_test_tmp::testInterp {name} {
+ variable TkLoadCmd
+ interp create $name
+ $name eval [list set argv [list -name $name]]
+ catch {{*}$TkLoadCmd $name}
+}
+
setupbg
dobg {wm withdraw .}
@@ -55,14 +86,14 @@ proc colorsFree {w {red 31} {green 245} {blue 192}} {
}
test unixEmbed-1.1 {TkpUseWindow procedure, bad window identifier} -constraints {
- unix
+ unix
} -setup {
deleteWindows
} -body {
toplevel .t -use xyz
} -returnCodes error -result {expected integer but got "xyz"}
test unixEmbed-1.2 {TkpUseWindow procedure, bad window identifier} -constraints {
- unix
+ unix
} -setup {
deleteWindows
} -body {
@@ -97,7 +128,7 @@ test unixEmbed-1.4 {TkpUseWindow procedure, inheriting colormap} -constraints {
} -result {1}
test unixEmbed-1.5 {TkpUseWindow procedure, creating Container records} -constraints {
- unix testembed
+ unix testembed notAqua
} -setup {
deleteWindows
} -body {
@@ -113,8 +144,29 @@ test unixEmbed-1.5 {TkpUseWindow procedure, creating Container records} -constra
} -cleanup {
deleteWindows
} -result {{{XXX {} {} .t}} 0}
+test unixEmbed-1.5a {TkpUseWindow procedure, creating Container records} -constraints {
+ unix testembed
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ frame .f2 -container 1 -width 200 -height 50
+ pack .f1 .f2
+ slave alias w winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t -use [w]
+ list [testembed] [expr {[lindex [lindex [testembed all] 0] 0] - [w]}]
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{{XXX {} {} .t}} 0}
test unixEmbed-1.6 {TkpUseWindow procedure, creating Container records} -constraints {
- unix testembed
+ unix testembed notAqua
} -setup {
deleteWindows
} -body {
@@ -132,6 +184,29 @@ test unixEmbed-1.6 {TkpUseWindow procedure, creating Container records} -constra
} -cleanup {
deleteWindows
} -result {{XXX {} {} .t2} {XXX {} {} .t1}}
+test unixEmbed-1.6a {TkpUseWindow procedure, creating Container records} -constraints {
+ unix testembed
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ frame .f2 -container 1 -width 200 -height 50
+ pack .f1 .f2
+ slave alias w1 winfo id .f1
+ slave alias w2 winfo id .f2
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ toplevel .t2 -use [w2]
+ testembed
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{XXX {} {} .t2} {XXX {} {} .t1}}
test unixEmbed-1.7 {TkpUseWindow procedure, container and embedded in same app} -constraints {
unix testembed
} -setup {
@@ -152,7 +227,7 @@ test unixEmbed-1.7 {TkpUseWindow procedure, container and embedded in same app}
test unixEmbed-2.1 {EmbeddedEventProc procedure} -constraints {
- unix testembed
+ unix testembed notAqua
} -setup {
deleteWindows
} -body {
@@ -172,8 +247,32 @@ test unixEmbed-2.1 {EmbeddedEventProc procedure} -constraints {
} -cleanup {
deleteWindows
} -result {}
+test unixEmbed-2.1a {EmbeddedEventProc procedure} -constraints {
+ unix testembed
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ testembed
+ }
+ destroy .f1
+ update
+ slave eval {
+ testembed
+ }
+} -cleanup {
+ deleteWindows
+} -result {}
test unixEmbed-2.2 {EmbeddedEventProc procedure} -constraints {
- unix testembed
+ unix testembed notAqua
} -setup {
deleteWindows
} -body {
@@ -190,8 +289,30 @@ test unixEmbed-2.2 {EmbeddedEventProc procedure} -constraints {
} -cleanup {
deleteWindows
} -result {}
+test unixEmbed-2.2a {EmbeddedEventProc procedure} -constraints {
+ unix testembed
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ testembed
+ destroy .t1
+ testembed
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {}
test unixEmbed-2.3 {EmbeddedEventProc procedure} -constraints {
- unix testembed
+ unix testembed notAqua
} -setup {
deleteWindows
} -body {
@@ -207,21 +328,20 @@ test unixEmbed-2.4 {EmbeddedEventProc procedure} -constraints {
} -setup {
deleteWindows
} -body {
- frame .f1 -container 1 -width 200 -height 50
- pack .f1
+ pack [frame .f1 -container 1 -width 200 -height 50]
toplevel .t1 -use [winfo id .f1]
+ set x [testembed]
update
destroy .t1
- set x [testembed]
update
- list $x [testembed]
+ list $x [winfo exists .t1] [winfo exists .f1] [testembed]
} -cleanup {
deleteWindows
-} -result {{{XXX .f1 {} {}}} {}}
+} -result "{{XXX .f1 {} .t1}} 0 0 {}"
test unixEmbed-3.1 {ContainerEventProc procedure, detect creation} -constraints {
- unix testembed nonPortable
+ unix testembed notPortable
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
@@ -236,10 +356,32 @@ test unixEmbed-3.1 {ContainerEventProc procedure, detect creation} -constraints
} -cleanup {
deleteWindows
} -result {{{XXX .f1 {} {}}} {{XXX .f1 XXX {}}}}
+test unixEmbed-3.1a {ContainerEventProc procedure, detect creation} -constraints {
+ unix testembed
+} -setup {
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ set x [testembed]
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ wm withdraw .t1
+ }
+ list $x [testembed]
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{{XXX .f1 {} {}}} {{XXX .f1 {} {}}}}
test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} -constraints {
- unix
+ unix
} -setup {
deleteWindows
+ update
} -body {
toplevel .t1 -container 1
wm geometry .t1 +0+0
@@ -250,7 +392,7 @@ test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} -constra
deleteWindows
} -result {200x200+0+0}
test unixEmbed-3.3 {ContainerEventProc procedure, disallow position changes} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -270,8 +412,31 @@ test unixEmbed-3.3 {ContainerEventProc procedure, disallow position changes} -co
} -cleanup {
deleteWindows
} -result {200x200+0+0}
+test unixEmbed-3.3a {ContainerEventProc procedure, disallow position changes} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1] -bd 2 -relief raised
+ update
+ wm geometry .t1 +30+40
+ update
+ wm geometry .t1
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {200x200+0+0}
test unixEmbed-3.4 {ContainerEventProc procedure, disallow position changes} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -291,8 +456,31 @@ test unixEmbed-3.4 {ContainerEventProc procedure, disallow position changes} -co
} -cleanup {
deleteWindows
} -result {300x100+0+0}
+test unixEmbed-3.4a {ContainerEventProc procedure, disallow position changes} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ update
+ wm geometry .t1 300x100+30+40
+ update
+ wm geometry .t1
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {300x100+0+0}
test unixEmbed-3.5 {ContainerEventProc procedure, geometry requests} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -312,8 +500,30 @@ test unixEmbed-3.5 {ContainerEventProc procedure, geometry requests} -constraint
} -cleanup {
deleteWindows
} -result {300 80 300x80+0+0}
+test unixEmbed-3.5a {ContainerEventProc procedure, geometry requests} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ .t1 configure -width 300 -height 80
+ update
+ }
+ list [winfo width .f1] [winfo height .f1] [slave eval {wm geometry .t1}]
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {300 80 300x80+0+0}
test unixEmbed-3.6 {ContainerEventProc procedure, map requests} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -335,8 +545,33 @@ test unixEmbed-3.6 {ContainerEventProc procedure, map requests} -constraints {
} -cleanup {
deleteWindows
} -result {mapped}
+test unixEmbed-3.6a {ContainerEventProc procedure, map requests} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ set x unmapped
+ bind .t1 <Map> {set x mapped}
+ update
+ after 100
+ update
+ set x
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {mapped}
test unixEmbed-3.7 {ContainerEventProc procedure, destroy events} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -358,10 +593,34 @@ test unixEmbed-3.7 {ContainerEventProc procedure, destroy events} -constraints {
} -cleanup {
deleteWindows
} -result {dead 0}
-
+test unixEmbed-3.7a {ContainerEventProc procedure, destroy events} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ bind .f1 <Destroy> {set x dead}
+ set x alive
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ update
+ destroy .t1
+ }
+ update
+ list $x [winfo exists .f1]
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {dead 0}
test unixEmbed-4.1 {EmbedStructureProc procedure, configure events} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -383,8 +642,31 @@ test unixEmbed-4.1 {EmbedStructureProc procedure, configure events} -constraints
} -cleanup {
deleteWindows
} -result {180x100+0+0}
+test unixEmbed-4.1a {EmbedStructureProc procedure, configure events} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ update
+ .t1 configure -width 180 -height 100
+ update
+ winfo geometry .t1
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {180x100+0+0}
test unixEmbed-4.2 {EmbedStructureProc procedure, destroy events} -constraints {
- unix testembed
+ unix testembed notAqua
} -setup {
deleteWindows
} -body {
@@ -398,14 +680,38 @@ test unixEmbed-4.2 {EmbedStructureProc procedure, destroy events} -constraints {
update
set x [testembed]
destroy .f1
+ update
list $x [testembed]
} -cleanup {
deleteWindows
} -result {{{XXX .f1 XXX {}}} {}}
+test unixEmbed-4.2a {EmbedStructureProc procedure, destroy events} -constraints {
+ unix testembed
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ update
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ }
+ set x [testembed]
+ destroy .f1
+ list $x [testembed]
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result "{{XXX .f1 {} {}}} {}"
test unixEmbed-5.1 {EmbedFocusProc procedure, FocusIn events} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -425,8 +731,34 @@ test unixEmbed-5.1 {EmbedFocusProc procedure, FocusIn events} -constraints {
} -cleanup {
deleteWindows
} -result {{focus in .t1}}
+test unixEmbed-5.1a {EmbedFocusProc procedure, FocusIn events} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ bind .t1 <FocusIn> {lappend x "focus in %W"}
+ bind .t1 <FocusOut> {lappend x "focus out %W"}
+ update
+ set x {}
+ }
+ focus -force .f1
+ update
+ slave eval {set x}
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{focus in .t1}}
test unixEmbed-5.2 {EmbedFocusProc procedure, focusing on dead window} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -447,8 +779,32 @@ test unixEmbed-5.2 {EmbedFocusProc procedure, focusing on dead window} -constrai
} -cleanup {
deleteWindows
} -result {}
+test unixEmbed-5.2a {EmbedFocusProc procedure, focusing on dead window} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ update
+ after 200 {destroy .t1}
+ }
+ after 400
+ focus -force .f1
+ update
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {}
test unixEmbed-5.3 {EmbedFocusProc procedure, FocusOut events} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -471,10 +827,39 @@ test unixEmbed-5.3 {EmbedFocusProc procedure, FocusOut events} -constraints {
} -cleanup {
deleteWindows
} -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}}
+test unixEmbed-5.3a {EmbedFocusProc procedure, FocusOut events} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ set x {}
+ bind .t1 <FocusIn> {lappend x "focus in %W"}
+ bind .t1 <FocusOut> {lappend x "focus out %W"}
+ update
+ }
+ focus -force .f1
+ update
+ set x [slave eval {update; set x }]
+ focus .
+ update
+ list $x [slave eval {update; set x}]
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}}
test unixEmbed-6.1 {EmbedGeometryRequest procedure, window changes size} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -484,9 +869,7 @@ test unixEmbed-6.1 {EmbedGeometryRequest procedure, window changes size} -constr
dobg {
eval destroy [winfo child .]
toplevel .t1 -use $w1
- }
- update
- dobg {
+ update
bind .t1 <Configure> {lappend x {configure .t1 %w %h}}
set x {}
.t1 configure -width 300 -height 120
@@ -496,8 +879,33 @@ test unixEmbed-6.1 {EmbedGeometryRequest procedure, window changes size} -constr
} -cleanup {
deleteWindows
} -result {{{configure .t1 300 120}} 300x120+0+0}
+test unixEmbed-6.1a {EmbedGeometryRequest procedure, window changes size} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ update
+ bind .t1 <Configure> {set x {configure .t1 %w %h}}
+ set x {}
+ .t1 configure -width 300 -height 120
+ update
+ list $x [winfo geom .t1]
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{configure .t1 300 120} 300x120+0+0}
test unixEmbed-6.2 {EmbedGeometryRequest procedure, window changes size} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -507,25 +915,47 @@ test unixEmbed-6.2 {EmbedGeometryRequest procedure, window changes size} -constr
dobg {
eval destroy [winfo child .]
toplevel .t1 -use $w1
- }
- after 300 {set x done}
- vwait x
- dobg {
+ update
bind .t1 <Configure> {lappend x {configure .t1 %w %h}}
set x {}
.t1 configure -width 300 -height 120
- update
+ update
list $x [winfo geom .t1]
}
} -cleanup {
deleteWindows
} -result {{{configure .t1 200 200}} 200x200+0+0}
+test unixEmbed-6.2a {EmbedGeometryRequest procedure, window changes size} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ place .f1 -width 200 -height 200
+ update
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ update
+ bind .t1 <Configure> {set x {configure .t1 %w %h}}
+ set x {}
+ .t1 configure -width 300 -height 120
+ update
+ list $x [winfo geom .t1]
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{configure .t1 200 200} 200x200+0+0}
# Can't think up any tests for TkpGetOtherWindow procedure.
-
test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -553,8 +983,41 @@ test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constrain
deleteWindows
bind . <KeyPress> {}
} -result {{{key a 1}} {}}
+test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ deleteWindows
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ }
+ focus -force .
+ bind . <KeyPress> {lappend x {key %A %E}}
+ set x {}
+ set y [slave eval {
+ update
+ bind .t1 <KeyPress> {lappend y {key %A}}
+ set y {}
+ event generate .t1 <KeyPress> -keysym a
+ set y
+ }]
+ update
+ list $x $y
+} -cleanup {
+ interp delete slave
+ deleteWindows
+ bind . <KeyPress> {}
+} -result {{{key a 1}} {}}
test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints {
- unix
+ unix notAqua
} -setup {
deleteWindows
} -body {
@@ -583,9 +1046,44 @@ test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width
deleteWindows
bind . <KeyPress> {}
} -result {{} {{key b}}}
+test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints {
+ unix
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1]
+ }
+ update
+ focus -force .f1
+ update
+ bind . <KeyPress> {lappend x {key %A}}
+ set x {}
+ set y [slave eval {
+ update
+ bind .t1 <KeyPress> {lappend y {key %A}}
+ set y {}
+ event generate .t1 <KeyPress> -keysym b
+ set y
+ }]
+ update
+ list $x $y
+} -cleanup {
+ interp delete slave
+ deleteWindows
+ bind . <KeyPress> {}
+} -result {{} {{key b}}}
-
-test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints unix -setup {
+test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints {
+ unix notAqua
+} -setup {
deleteWindows
} -body {
frame .f1 -container 1 -width 200 -height 50
@@ -609,15 +1107,44 @@ test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints unix -setup {
} -cleanup {
deleteWindows
} -result {{{} .t1} .f1}
-test unixEmbed-8.2 {TkpClaimFocus procedure} -constraints unix -setup {
- deleteWindows
- catch {interp delete child}
+test unixEmbed-8.1a {TkpClaimFocus procedure} -constraints unix -setup {
deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
} -body {
frame .f1 -container 1 -width 200 -height 50
frame .f2 -width 200 -height 50
pack .f1 .f2
+ update
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken
+ }
+ # This should clear focus from the application embedded in .f1
+ focus -force .f2
+ update
+ list [slave eval {
+ set x [list [focus]]
+ focus .t1
+ update
+ lappend x [focus]
+ }] [focus]
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{{} .t1} .f1}
+test unixEmbed-8.2 {TkpClaimFocus procedure} -constraints unix -setup {
+ deleteWindows
+ catch {interp delete child}
interp create child
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ frame .f2 -width 200 -height 50
+ pack .f1 .f2
+ update
+ set w1 [winfo id .f1]
child eval "set argv {-use [winfo id .f1]}"
load {} Tk child
child eval {
@@ -636,7 +1163,6 @@ test unixEmbed-8.2 {TkpClaimFocus procedure} -constraints unix -setup {
} -result {{{} .} .f1}
catch {interp delete child}
-
test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints {
unix testembed
} -setup {
@@ -658,12 +1184,13 @@ test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints
deleteWindows
} -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}}
test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints {
- unix testembed
+ unix testembed notAqua
} -setup {
deleteWindows
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
+ update
dobg "set w1 [winfo id .f1]"
dobg {
eval destroy [winfo child .]
@@ -676,15 +1203,39 @@ test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraint
} -cleanup {
deleteWindows
} -result {{{XXX {} {} .t1}} {}}
+test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constraints {
+ unix testembed
+} -setup {
+ deleteWindows
+ catch {interp delete slave}
+ ::_test_tmp::testInterp slave
+ load {} Tktest slave
+} -body {
+ frame .f1 -container 1 -width 200 -height 50
+ pack .f1
+ slave alias w1 winfo id .f1
+ slave eval {
+ destroy [winfo child .]
+ toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken
+ set x {}
+ lappend x [testembed]
+ destroy .t1
+ lappend x [testembed]
+ }
+} -cleanup {
+ interp delete slave
+ deleteWindows
+} -result {{{XXX {} {} .t1}} {}}
test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints {
- unix
+ unix
} -setup {
deleteWindows
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
+ update
toplevel .t1 -use [winfo id .f1] -width 150 -height 80
update
wm geometry .t1 +40+50
@@ -694,7 +1245,7 @@ test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con
deleteWindows
} -result {150x80+0+0}
test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints {
- unix
+ unix
} -setup {
deleteWindows
} -body {
@@ -714,4 +1265,3 @@ deleteWindows
cleanupbg
cleanupTests
return
-
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 12a2142..c147bbf 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -40,8 +40,23 @@ proc makeToplevels {} {
}
}
+# On macOS windows are not allowed to overlap the menubar at the top
+# of the screen. 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).
+
+if {[tk windowingsystem] eq "aqua"} {
+ set Y0 23
+ set Y2 25
+ set Y5 28
+} else {
+ set Y0 0
+ set Y2 2
+ set Y5 5
+}
+
set i 1
-foreach geom {+20+80 +80+20 +0+0} {
+foreach geom "+23+80 +80+23 +0+$Y0" {
destroy .t
test unixWm-1.$i {initial window position} unix {
toplevel .t -width 200 -height 150
@@ -67,7 +82,7 @@ update
scan [wm geom .t] %dx%d+%d+%d width height x y
set xerr [expr 150-$x]
set yerr [expr 150-$y]
-foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} {
+foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
test unixWm-2.$i {moving window while mapped} unix {
wm geom .t $geom
update
@@ -79,7 +94,7 @@ foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} {
}
set i 1
-foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} {
+foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
test unixWm-3.$i {moving window while iconified} unix {
wm iconify .t
sleep 200
@@ -95,7 +110,7 @@ foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} {
}
set i 1
-foreach geom {+20+80 +100+40 +0+0} {
+foreach geom "+20+80 +100+40 +0+$Y0" {
test unixWm-4.$i {moving window while withdrawn} unix {
wm withdraw .t
sleep 200
@@ -179,27 +194,27 @@ test unixWm-5.7 {compounded state changes} {unix nonPortable} {
destroy .t
toplevel .t -width 200 -height 100
-wm geom .t +10+10
+wm geom .t +10+23
wm minsize .t 1 1
update
test unixWm-6.1 {size changes} unix {
.t config -width 180 -height 150
update
wm geom .t
-} 180x150+10+10
+} 180x150+10+23
test unixWm-6.2 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
update
wm geom .t
-} 250x60+10+10
+} 250x60+10+23
test unixWm-6.3 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
wm geom .t {}
update
wm geom .t
-} 170x140+10+10
+} 170x140+10+23
test unixWm-6.4 {size changes} {unix nonPortable userInteraction} {
wm minsize .t 1 1
update
@@ -1357,14 +1372,14 @@ test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on gr
test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already set} unix {
destroy .t
toplevel .t
- wm geometry .t 200x100+0+0
+ wm geometry .t 200x100+0+$Y0
listbox .t.l -height 20 -width 20
pack .t.l -fill both -expand 1
update
.t.l configure -setgrid 1
update
wm geometry .t
-} {20x20+0+0}
+} "20x20+0+$Y0"
test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix {
destroy .t
@@ -1559,10 +1574,10 @@ test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix {
tkwait visibility .t
wm overrideredirect .t 1
update
- wm geometry .t -30+2
+ wm geometry .t -30+$Y2
update
list [winfo x .t] [winfo y .t]
-} [list [expr [winfo screenwidth .t] - 110] 2]
+} [list [expr [winfo screenwidth .t] - 110] $Y2]
destroy .t
test unixWm-44.9 {UpdateGeometryInfo procedure, updating fixed dimensions} {unix testwrapper} {
diff --git a/tests/wm.test b/tests/wm.test
index 7b81985..c2bc385 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -1640,14 +1640,24 @@ test wm-transient-1.7 {usage} -returnCodes error -body {
wm transient .master .master
} -cleanup {
deleteWindows
-} -result {can't make ".master" its own master}
+} -result {setting ".master" as master creates a transient/master cycle}
test wm-transient-1.8 {usage} -returnCodes error -body {
+ toplevel .t1
+ toplevel .t2
+ toplevel .t3
+ wm transient .t2 .t1
+ wm transient .t3 .t2
+ wm transient .t1 .t3
+} -cleanup {
+ deleteWindows
+} -result {setting ".t3" as master creates a transient/master cycle}
+test wm-transient-1.9 {usage} -returnCodes error -body {
toplevel .master
frame .master.f
wm transient .master .master.f
} -cleanup {
deleteWindows
-} -result {can't make ".master" its own master}
+} -result {setting ".master" as master creates a transient/master cycle}
test wm-transient-2.1 {basic get/set of master} -setup {
set results [list]