summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/scrollbar.test37
-rw-r--r--tests/ttk/checkbutton.test16
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index 3b16821..bd14067 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -662,6 +662,43 @@ test scrollbar-10.2 {<MouseWheel> event on scrollbar} -constraints {win|unix} -s
destroy .t .s
} -result {1.4}
+test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body {
+ proc destroy_scrollbar {} {
+ if {[winfo exists .top.s]} {
+ destroy .top.s
+ }
+ }
+ toplevel .top
+ scrollbar .top.s
+ bind .top.s <2> {destroy_scrollbar}
+ pack .top.s
+ focus -force .top.s
+ update
+ event generate .top.s <2>
+ update ; # shall not trigger error invalid command name ".top.s"
+} -cleanup {
+ destroy .top.s .top
+} -result {}
+test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body {
+ proc destroy_scrollbar {{y 0}} {
+ if {[winfo exists .top.s]} {
+ destroy .top.s
+ }
+ }
+ toplevel .top
+ wm minsize .top 50 400
+ update
+ scrollbar .top.s
+ bind .top.s <2> {after idle destroy_scrollbar}
+ pack .top.s -expand true -fill y
+ focus -force .top.s
+ update
+ event generate .top.s <2> -x 2 -y [expr {[winfo height .top.s] / 2}]
+ update ; # shall not trigger error invalid command name ".top.s"
+} -cleanup {
+ destroy .top.s .top
+} -result {}
+
catch {destroy .s}
catch {destroy .t}
diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test
index e18ff32..6b79287 100644
--- a/tests/ttk/checkbutton.test
+++ b/tests/ttk/checkbutton.test
@@ -45,4 +45,20 @@ test checkbutton-1.6 "Checkbutton default variable" -body {
lappend result [info exists .cb] [set .cb] [.cb state]
} -result [list .cb 0 alternate 1 on selected 1 off {}]
+# Bug [109865fa01]
+test checkbutton-1.7 "Button destroyed by click" -body {
+ proc destroy_button {} {
+ destroy .top
+ }
+ toplevel .top
+ ttk::menubutton .top.mb -text Button -style TLabel
+ bind .top.mb <ButtonRelease-1> destroy_button
+ pack .top.mb
+ focus -force .top.mb
+ update
+ event generate .top.mb <1>
+ event generate .top.mb <ButtonRelease-1>
+ update ; # shall not trigger error invalid command name ".top.b"
+} -result {}
+
tcltest::cleanupTests