summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-10-27 20:35:50 (GMT)
committerculler <culler>2019-10-27 20:35:50 (GMT)
commit994168db27369739039f976a737abd04145de0a4 (patch)
tree96c87a39c2b8640dfbd8a9a918cb591f0720da4d
parentb2dd0a10365c974b7d3f0601c83bb1d4ee6faa66 (diff)
downloadtk-994168db27369739039f976a737abd04145de0a4.zip
tk-994168db27369739039f976a737abd04145de0a4.tar.gz
tk-994168db27369739039f976a737abd04145de0a4.tar.bz2
Add a regression test for computing local mouse coordinates in embedded windows in Aqua.
-rw-r--r--tests/unixEmbed.test38
1 files changed, 36 insertions, 2 deletions
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index d46818a..2ebf9c2 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -85,6 +85,8 @@ proc colorsFree {w {red 31} {green 245} {blue 192}} {
&& ([lindex $vals 2]/256 == $blue)
}
+testConstraint pressbutton [llength [info commands pressbutton]]
+
test unixEmbed-1.1 {TkpUseWindow procedure, bad window identifier} -constraints {
unix
} -setup {
@@ -1276,9 +1278,41 @@ test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints {
focus -force .t
focus -force .embed
focus
- } -cleanup {
- deleteWindows
+} -cleanup {
+ deleteWindows
} -result .embed
+test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints {
+ unix pressbutton
+} -setup {
+ deleteWindows
+} -body {
+ toplevel .main
+ set result {}
+ pack [button .main.b -text "Main Button" \
+ -command {lappend result ".main.b"}] -padx 30 -pady 30
+ pack [frame .main.f -container 1 -width 200 -height 200] -fill both
+ update idletasks
+ toplevel .embed -use [winfo id .main.f] -bg green
+ pack [button .embed.b -text "Emb Button" \
+ -command {lappend result ".embed.b"}] -padx 30 -pady 30
+ wm geometry .main 200x400+100+100
+ update idletasks
+ focus -force .main
+ set x [expr {[winfo x .main ] + [winfo x .main.b] + 40}]
+ set y [expr {[winfo y .main ] + [winfo y .main.b] + 38}]
+ lappend result [winfo containing $x $y]
+ after 200
+ pressbutton $x $y
+ update
+ set y [expr {$y + 80}]
+ lappend result [winfo containing $x $y]
+ after 200
+ pressbutton $x $y
+ update
+ set result
+} -cleanup {
+ deleteWindows
+} -result {.main.b .main.b .embed.b .embed.b}
# cleanup