summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-04-03 04:40:50 (GMT)
committerhobbs <hobbs>2001-04-03 04:40:50 (GMT)
commit5c2ad0a34a4a78a7879cd6dc7e4523f789aa3d0e (patch)
treea525aba7f40d33313e28afdfe008bcd9322aae02 /tests
parent9eb72b9d79626c34c27d968c36568bce309c741f (diff)
downloadtk-5c2ad0a34a4a78a7879cd6dc7e4523f789aa3d0e.zip
tk-5c2ad0a34a4a78a7879cd6dc7e4523f789aa3d0e.tar.gz
tk-5c2ad0a34a4a78a7879cd6dc7e4523f789aa3d0e.tar.bz2
* tests/entry.test: added tests entry-20.*, delete during widget
activity * generic/tkEntry.c (DestroyEntry, EntryEventProc): fixed the entry widget to survive deletion while processing scrollbar updates and validation.
Diffstat (limited to 'tests')
-rw-r--r--tests/entry.test56
1 files changed, 51 insertions, 5 deletions
diff --git a/tests/entry.test b/tests/entry.test
index ecaf4f3..fd4d7e3 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: entry.test,v 1.10 2000/05/29 01:43:15 hobbs Exp $
+# RCS: @(#) $Id: entry.test,v 1.11 2001/04/03 04:40:50 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -1506,9 +1506,9 @@ proc doval {W d i P s S v V} {
set ::vVals [list $W $d $i $P $s $S $v $V]
return 0
}
-.e configure -validate all
test entry-19.18 {entry widget validation} {
+ .e configure -validate all
set ::e nextdata
list [.e cget -validate] $::vVals
} {none {.e -1 -1 nextdata newdata {} all forced}}
@@ -1518,23 +1518,22 @@ proc doval {W d i P s S v V} {
set ::e mydata
return 1
}
-.e configure -validate all
## This sets validate to none because it shows that we prevent a possible
## loop condition in the validation, when the entry textvar is also set
test entry-19.19 {entry widget validation} {
+ .e configure -validate all
.e validate
list [.e cget -validate] [.e get] $::vVals
} {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
-.e configure -validate all
-
## This leaves validate alone because we trigger validation through the
## textvar (a write trace), and the write during validation triggers
## nothing (by definition of avoiding loops on var traces). This is
## one of those "dangerous" conditions where the user will have a
## different value in the entry widget shown as is in the textvar.
test entry-19.20 {entry widget validation} {
+ .e configure -validate all
set ::e testdata
list [.e cget -validate] [.e get] $::e $::vVals
} {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
@@ -1546,6 +1545,53 @@ catch {unset ::e ::vVals}
## End validation tests
##
+test entry-20.1 {widget deletion while active} {
+ destroy .e
+ entry .e -validate all \
+ -validatecommand { destroy %W ; return 1 } \
+ -invalidcommand bell
+ update
+ .e insert 0 abc
+ winfo exists .e
+} 0
+test entry-20.2 {widget deletion while active} {
+ destroy .e
+ entry .e -validate all \
+ -validatecommand { return 0 } \
+ -invalidcommand { destroy %W }
+ .e insert 0 abc
+ winfo exists .e
+} 0
+test entry-20.3 {widget deletion while active} {
+ destroy .e
+ entry .e -validate all \
+ -validatecommand { rename .e {} ; return 1 }
+ .e insert 0 abc
+ winfo exists .e
+} 0
+test entry-20.4 {widget deletion while active} {
+ destroy .e
+ entry .e -validate all \
+ -validatecommand { return 0 } \
+ -invalidcommand { rename .e {} }
+ .e insert 0 abc
+ winfo exists .e
+} 0
+test entry-20.5 {widget deletion while active} {
+ destroy .e
+ entry .e -validatecommand { destroy .e ; return 0 }
+ .e validate
+ winfo exists .e
+} 0
+test entry-20.6 {widget deletion while active} {
+ destroy .e
+ pack [entry .e]
+ update
+ .e config -xscrollcommand { destroy .e }
+ update idle
+ winfo exists .e
+} 0
+
# XXX Still need to write tests for EntryBlinkProc, EntryFocusProc,
# and EntryTextVarProc.