summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-06-02 09:26:57 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-06-02 09:26:57 (GMT)
commit5098f86b8c628ee641dfd130ec9f516d91805eff (patch)
treebc1b4e39a7f4d9c50c7e9fa7d09c7cda6e968889 /tests
parent90c1a43eb7a8a363aef33e43ff390646b70aff1f (diff)
downloadtk-5098f86b8c628ee641dfd130ec9f516d91805eff.zip
tk-5098f86b8c628ee641dfd130ec9f516d91805eff.tar.gz
tk-5098f86b8c628ee641dfd130ec9f516d91805eff.tar.bz2
[Bug 2799589] Avoid setting the focus on a deleted window during delayed activation.
Diffstat (limited to 'tests')
-rw-r--r--tests/winWm.test46
1 files changed, 45 insertions, 1 deletions
diff --git a/tests/winWm.test b/tests/winWm.test
index 9ba872f..0f2f8d3 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -9,7 +9,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: winWm.test,v 1.21 2008/10/06 23:13:19 patthoyts Exp $
+# RCS: @(#) $Id: winWm.test,v 1.22 2009/06/02 09:26:57 patthoyts Exp $
package require tcltest 2.2
namespace import ::tcltest::*
@@ -445,6 +445,50 @@ test winWm-8.2 {Tk_WmCmd procedure, "iconphoto" option} -constraints win -setup
destroy .t
} -result {}
+test winWm-9.0 "Bug #2799589 - delayed activation of destroyed window" -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}}
+ }
+ 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}
+
destroy .t
# cleanup