summaryrefslogtreecommitdiffstats
path: root/tests/entry.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/entry.test')
-rw-r--r--tests/entry.test445
1 files changed, 215 insertions, 230 deletions
diff --git a/tests/entry.test b/tests/entry.test
index 82259b1..d20bb52 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -11,33 +11,12 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
-# For xscrollcommand
-set scrollInfo {}
-proc scroll args {
- global scrollInfo
- set scrollInfo $args
-}
-# For trace add variable
-proc override args {
- global x
- set x 12345
-}
+# Import utility procs for specific functional areas
+testutils import entry scroll
-# Procedures used in widget VALIDATION tests
-proc doval {W d i P s S v V} {
- set ::vVals [list $W $d $i $P $s $S $v $V]
- return 1
-}
-proc doval2 {W d i P s S v V} {
- set ::vVals [list $W $d $i $P $s $S $v $V]
- set ::e mydata
- return 1
-}
-proc doval3 {W d i P s S v V} {
- set ::vVals [list $W $d $i $P $s $S $v $V]
- return 0
+foreach i {1 2 3} {
+ set validateCmd$i [list validateCommand$i %W %d %i %P %s %S %v %V]
}
-
set cy [font metrics {Courier -12} -linespace]
@@ -895,20 +874,20 @@ test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
pack .e ; update idletasks
update
- set x {}
+ set result {}
} -body {
# UTF
.e insert end "01234乎67890"
.e delete 6
- lappend x [.e get]
+ lappend result [.e get]
.e delete 0 end
.e insert end "012345乎7890"
.e delete 6
- lappend x [.e get]
+ lappend result [.e get]
.e delete 0 end
.e insert end "0123456乎890"
.e delete 6
- lappend x [.e get]
+ lappend result [.e get]
} -cleanup {
destroy .e
} -result [list "01234乎7890" "0123457890" "012345乎890"]
@@ -1562,13 +1541,13 @@ test entry-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup {
# UTF
# If Tcl_NumUtfChars wasn't used, wrong answer would be:
# 0.106383 0.117021 0.117021
- set x {}
+ set result {}
.e xview moveto .1
- lappend x [format {%.6f} [lindex [.e xview] 0]]
+ lappend result [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .11
- lappend x [format {%.6f} [lindex [.e xview] 0]]
+ lappend result [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .12
- lappend x [format {%.6f} [lindex [.e xview] 0]]
+ lappend result [format {%.6f} [lindex [.e xview] 0]]
} -cleanup {
destroy .e
} -result {0.095745 0.106383 0.117021}
@@ -1588,7 +1567,7 @@ test entry-3.82 {EntryWidgetCmd procedure} -setup {
# ensure that resources get properly freed.
test entry-4.1 {DestroyEntry procedure} -body {
- entry .e -textvariable x -show *
+ entry .e -textvariable textVar -show *
pack .e ; update idletasks
.e insert end "Sample text"
update
@@ -1596,48 +1575,48 @@ test entry-4.1 {DestroyEntry procedure} -body {
} -result {}
test entry-5.1 {ConfigureEntry procedure, -textvariable} -body {
- set x 12345
- entry .e -textvariable x
+ set textVar 12345
+ entry .e -textvariable textVar
.e get
} -cleanup {
destroy .e
} -result 12345
test entry-5.2 {ConfigureEntry procedure, -textvariable} -body {
- set x 12345
- entry .e -textvariable x
+ set textVar 12345
+ entry .e -textvariable textVar
set y abcde
.e configure -textvariable y
- set x 54321
+ set textVar 54321
.e get
} -cleanup {
destroy .e
} -result {abcde}
test entry-5.3 {ConfigureEntry procedure, -textvariable} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e
} -body {
.e insert 0 "Some text"
- .e configure -textvariable x
- set x
+ .e configure -textvariable textVar
+ set textVar
} -cleanup {
destroy .e
} -result {Some text}
test entry-5.4 {ConfigureEntry procedure, -textvariable} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e
} -body {
- trace add variable x write override
+ trace add variable textVar write override
.e insert 0 "Some text"
- .e configure -textvariable x
- list $x [.e get]
+ .e configure -textvariable textVar
+ list $textVar [.e get]
} -cleanup {
destroy .e
- trace remove variable x write override
- unset x;
+ trace remove variable textVar write override
+ unset textVar
} -result {12345 12345}
test entry-5.5 {ConfigureEntry procedure} -setup {
- set x {}
+ set result {}
entry .e1
entry .e2
} -body {
@@ -1647,13 +1626,13 @@ test entry-5.5 {ConfigureEntry procedure} -setup {
pack .e1 .e2 ; update idletasks
.e2 select from 0
.e2 select to 10
- lappend x [selection get]
+ lappend result [selection get]
.e1 select from 1
.e1 select to 5
- lappend x [selection get]
+ lappend result [selection get]
.e1 configure -exportselection 1
- lappend x [selection get]
- set x
+ lappend result [selection get]
+ set result
} -cleanup {
destroy .e1 .e2
} -result {{This is so} {This is so} 1234}
@@ -1687,7 +1666,7 @@ test entry-5.7 {ConfigureEntry procedure} -setup {
entry .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2
pack .e ; update idletasks
} -body {
- .e configure -font {Courier -12} -width 4 -xscrollcommand scroll
+ .e configure -font {Courier -12} -width 4 -xscrollcommand setScrollInfo
.e insert end "01234567890"
update
set scrollInfo wrong
@@ -1881,11 +1860,11 @@ test entry-6.10 {EntryComputeGeometry procedure} -constraints {
.e configure -bd 1 -relief raised -width 0 -show .
.e insert 0 12345
update
- set x [winfo reqwidth .e]
+ set result [winfo reqwidth .e]
.e configure -show X
- lappend x [winfo reqwidth .e]
+ lappend result [winfo reqwidth .e]
.e configure -show ""
- lappend x [winfo reqwidth .e]
+ lappend result [winfo reqwidth .e]
} -cleanup {
destroy .e
} -result {23 53 43}
@@ -1900,15 +1879,15 @@ test entry-6.11 {EntryComputeGeometry procedure} -constraints {
update
set x1 [winfo reqwidth .e]
set x2 [expr {8+5*[font measure {helvetica 12} .]}]
- set x [expr {$x1 eq $x2}]
+ set result [expr {$x1 eq $x2}]
.e configure -show X
set x1 [winfo reqwidth .e]
set x2 [expr {8+5*[font measure {helvetica 12} X]}]
- lappend x [expr {$x1 eq $x2}]
+ lappend result [expr {$x1 eq $x2}]
.e configure -show ""
set x1 [winfo reqwidth .e]
set x2 [expr {8+[font measure {helvetica 12} 12345]}]
- lappend x [expr {$x1 eq $x2}]
+ lappend result [expr {$x1 eq $x2}]
} -cleanup {
destroy .e
} -result {1 1 1}
@@ -1933,7 +1912,7 @@ test entry-7.1 {InsertChars procedure} -setup {
pack .e ; update idletasks
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
update
set scrollInfo wrong
.e insert 0 abcde
@@ -1950,7 +1929,7 @@ test entry-7.2 {InsertChars procedure} -setup {
pack .e ; update idletasks
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
update
set scrollInfo wrong
.e insert 0 abcde
@@ -1968,9 +1947,9 @@ test entry-7.3 {InsertChars procedure} -setup {
.e select from 2
.e select to 6
.e insert 2 XXX
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {5 9 5 8}
@@ -1982,9 +1961,9 @@ test entry-7.4 {InsertChars procedure} -setup {
.e select from 2
.e select to 6
.e insert 3 XXX
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {2 9 2 8}
@@ -1996,9 +1975,9 @@ test entry-7.5 {InsertChars procedure} -setup {
.e select from 2
.e select to 6
.e insert 5 XXX
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {2 9 2 8}
@@ -2010,9 +1989,9 @@ test entry-7.6 {InsertChars procedure} -setup {
.e select from 2
.e select to 6
.e insert 6 XXX
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 5
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {2 6 2 5}
@@ -2020,7 +1999,7 @@ test entry-7.7 {InsertChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e ; update idletasks
} -body {
- .e configure -xscrollcommand scroll
+ .e configure -xscrollcommand setScrollInfo
.e insert 0 0123456789
.e icursor 4
.e insert 4 XXX
@@ -2084,7 +2063,7 @@ test entry-8.1 {DeleteChars procedure} -setup {
pack .e ; update idletasks
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
update
set scrollInfo wrong
.e insert 0 abcde
@@ -2100,7 +2079,7 @@ test entry-8.2 {DeleteChars procedure} -setup {
pack .e ; update idletasks
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
update
set scrollInfo wrong
.e insert 0 abcde
@@ -2116,7 +2095,7 @@ test entry-8.3 {DeleteChars procedure} -setup {
pack .e ; update idletasks
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
update
set scrollInfo wrong
.e insert 0 abcde
@@ -2136,9 +2115,9 @@ test entry-8.4 {DeleteChars procedure} -setup {
.e select to 8
.e delete 1 3
update
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 5
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {1 6 1 5}
@@ -2152,9 +2131,9 @@ test entry-8.5 {DeleteChars procedure} -setup {
.e select to 8
.e delete 1 4
update
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 4
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {1 5 1 4}
@@ -2168,9 +2147,9 @@ test entry-8.6 {DeleteChars procedure} -setup {
.e select to 8
.e delete 1 7
update
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 5
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {1 2 1 5}
@@ -2198,9 +2177,9 @@ test entry-8.8 {DeleteChars procedure} -setup {
.e select to 8
.e delete 3 7
update
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {3 4 3 8}
@@ -2227,9 +2206,9 @@ test entry-8.10 {DeleteChars procedure} -setup {
.e select to 3
.e delete 5 8
update
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {3 5 5 8}
@@ -2243,9 +2222,9 @@ test entry-8.11 {DeleteChars procedure} -setup {
.e select to 3
.e delete 8 10
update
- set x "[.e index sel.first] [.e index sel.last]"
+ set result "[.e index sel.first] [.e index sel.last]"
.e select to 4
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend result [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {3 8 4 8}
@@ -2351,25 +2330,25 @@ test entry-8.18 {DeleteChars procedure} -setup {
} -result {1}
test entry-9.1 {EntryValueChanged procedure} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
} -body {
- trace add variable x write override
- entry .e -textvariable x -width 0
+ trace add variable textVar write override
+ entry .e -textvariable textVar -width 0
.e insert 0 foo
- list $x [.e get]
+ list $textVar [.e get]
} -cleanup {
destroy .e
- trace remove variable x write override
- unset x
+ trace remove variable textVar write override
+ unset textVar
} -result {12345 12345}
test entry-10.1 {EntrySetValue procedure} -constraints fonts -body {
- set x abcde
+ set textVar abcde
set y ab
entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0
pack .e ; update idletasks
- .e configure -textvariable x
+ .e configure -textvariable textVar
.e configure -textvariable y
update
list [.e get] [winfo reqwidth .e]
@@ -2377,100 +2356,100 @@ test entry-10.1 {EntrySetValue procedure} -constraints fonts -body {
destroy .e
} -result {ab 24}
test entry-10.2 {EntrySetValue procedure, updating selection} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2
pack .e ; update idletasks
} -body {
- .e configure -textvariable x
+ .e configure -textvariable textVar
.e insert 0 "abcdefghjklmnopqrstu"
.e selection range 4 10
- set x "a"
+ set textVar "a"
.e index sel.first
} -cleanup {
destroy .e
} -returnCodes error -result {selection isn't in widget .e}
test entry-10.3 {EntrySetValue procedure, updating selection} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2
pack .e ; update idletasks
} -body {
- .e configure -textvariable x
+ .e configure -textvariable textVar
.e insert 0 "abcdefghjklmnopqrstu"
.e selection range 4 10
- set x "abcdefg"
+ set textVar "abcdefg"
list [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {4 7}
test entry-10.4 {EntrySetValue procedure, updating selection} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2
pack .e ; update idletasks
} -body {
- .e configure -textvariable x
+ .e configure -textvariable textVar
.e insert 0 "abcdefghjklmnopqrstu"
.e selection range 4 10
- set x "abcdefghijklmn"
+ set textVar "abcdefghijklmn"
list [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {4 10}
test entry-10.5 {EntrySetValue procedure, updating display position} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e -highlightthickness 2 -bd 2
pack .e ; update idletasks
} -body {
- .e configure -width 10 -font {Courier -12} -textvariable x
+ .e configure -width 10 -font {Courier -12} -textvariable textVar
.e insert 0 "abcdefghjklmnopqrstuvwxyz"
.e xview 10
update
- set x "abcdefg"
+ set textVar "abcdefg"
update
.e index @0
} -cleanup {
destroy .e
} -result 0
test entry-10.6 {EntrySetValue procedure, updating display position} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e -highlightthickness 2 -bd 2
pack .e ; update idletasks
} -body {
- .e configure -width 10 -font {Courier -12} -textvariable x
+ .e configure -width 10 -font {Courier -12} -textvariable textVar
pack .e ; update idletasks
.e insert 0 "abcdefghjklmnopqrstuvwxyz"
.e xview 10
update
- set x "1234567890123456789012"
+ set textVar "1234567890123456789012"
update
.e index @0
} -cleanup {
destroy .e
} -result 10
test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e -highlightthickness 2 -bd 2
pack .e ; update idletasks
update
} -body {
- .e configure -width 10 -font {Courier -12} -textvariable x
+ .e configure -width 10 -font {Courier -12} -textvariable textVar
pack .e ; update idletasks
.e insert 0 "abcdefghjklmnopqrstuvwxyz"
.e icursor 5
- set x "123"
+ set textVar "123"
.e index insert
} -cleanup {
destroy .e
} -result 3
test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
entry .e -highlightthickness 2 -bd 2
pack .e ; update idletasks
} -body {
- .e configure -width 10 -font {Courier -12} -textvariable x
+ .e configure -width 10 -font {Courier -12} -textvariable textVar
pack .e ; update idletasks
.e insert 0 "abcdefghjklmnopqrstuvwxyz"
.e icursor 5
- set x "123456"
+ set textVar "123456"
.e index insert
} -cleanup {
destroy .e
@@ -2487,14 +2466,14 @@ test entry-11.1 {EntryEventProc procedure} -setup {
destroy .e
} -result {}
test entry-11.2 {EntryEventProc procedure} -setup {
- set x {}
+ set result {}
} -body {
entry .e1 -fg #112233
rename .e1 .e2
- lappend x [winfo children .]
- lappend x [.e2 cget -fg]
+ lappend result [winfo children .]
+ lappend result [.e2 cget -fg]
destroy .e1
- lappend x [info command .e*] [winfo children .]
+ lappend result [info command .e*] [winfo children .]
} -cleanup {
destroy .e1
} -result {.e1 #112233 {} {}}
@@ -2894,16 +2873,16 @@ test entry-14.2 {EntryFetchSelection procedure} -body {
destroy .e
} -result {*****************}
test entry-14.3 {EntryFetchSelection procedure} -setup {
- set x {}
+ set textVar {}
for {set i 1} {$i <= 500} {incr i} {
- append x "This is line $i, out of 500\n"
+ append textVar "This is line $i, out of 500\n"
}
} -body {
entry .e
- .e insert end $x
+ .e insert end $textVar
.e select from 0
.e select to end
- string compare [selection get] $x
+ string compare [selection get] $textVar
} -cleanup {
destroy .e
} -result 0
@@ -2963,7 +2942,7 @@ test entry-16.4 {EntryVisibleRange procedure} -body {
test entry-17.1 {EntryUpdateScrollbar procedure} -body {
- entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
+ entry .e -width 10 -xscrollcommand setScrollInfo -font {Courier -12}
pack .e
update
set scrollInfo wrong
@@ -2975,7 +2954,7 @@ test entry-17.1 {EntryUpdateScrollbar procedure} -body {
destroy .e
} -result {0.000000 1.000000}
test entry-17.2 {EntryUpdateScrollbar procedure} -body {
- entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
+ entry .e -width 10 -xscrollcommand setScrollInfo -font {Courier -12}
pack .e
update
set scrollInfo wrong
@@ -2987,7 +2966,7 @@ test entry-17.2 {EntryUpdateScrollbar procedure} -body {
destroy .e
} -result {0.187500 0.812500}
test entry-17.3 {EntryUpdateScrollbar procedure} -body {
- entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
+ entry .e -width 10 -xscrollcommand setScrollInfo -font {Courier -12}
pack .e
update
set scrollInfo wrong
@@ -3000,8 +2979,8 @@ test entry-17.3 {EntryUpdateScrollbar procedure} -body {
} -result {0.315789 0.842105}
test entry-17.4 {EntryUpdateScrollbar procedure} -setup {
proc bgerror msg {
- global x
- set x $msg
+ global textVar
+ set textVar $msg
}
} -body {
entry .e -width 5
@@ -3010,7 +2989,7 @@ test entry-17.4 {EntryUpdateScrollbar procedure} -setup {
set scrollInfo wrong
.e configure -xscrollcommand thisisnotacommand
update
- list $x $errorInfo
+ list $textVar $errorInfo
} -cleanup {
destroy .e
rename bgerror {}
@@ -3042,125 +3021,125 @@ test entry-18.1 {Entry widget vs hiding} -setup {
# test cases. This was replaced by inserting recently set configurations
# that matters for the test case
test entry-19.1 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert 0 a
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e 1 0 a {} a all key}
test entry-19.2 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert 0 a ;# previous settings
.e insert 1 b
- return $::vVals
+ return $validationData
} -cleanup {
destroy .e
} -result {.e 1 1 ab a b all key}
test entry-19.3 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert 0 ab ;# previous settings
.e insert end c
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e 1 2 abc ab c all key}
test entry-19.4 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert 0 abc ;# previous settings
.e insert 1 123
- list $::vVals $::e
+ list $validationData $textVar
} -cleanup {
destroy .e
} -result {{.e 1 1 a123bc abc 123 all key} a123bc}
test entry-19.5 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert 0 a123bc ;# previous settings
.e delete 2
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e 0 2 a13bc a123bc 2 all key}
test entry-19.6 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert 0 a13bc ;# previous settings
.e configure -validate key
.e delete 1 3
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e 0 1 abc a13bc 13 key key}
test entry-19.7 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focus \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abc ;# previous settings
- set ::vVals {}
+ set validationData {}
.e insert end d
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {}
test entry-19.8 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e configure -validate focus ;# previous settings
@@ -3168,18 +3147,18 @@ test entry-19.8 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focus focusin}
test entry-19.9 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focus \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
@@ -3189,36 +3168,36 @@ test entry-19.9 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focus focusout}
test entry-19.10 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
focus -force .e
# update necessary to process FocusIn event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} all focusin}
test entry-19.11 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
@@ -3228,125 +3207,125 @@ test entry-19.11 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} all focusout}
test entry-19.12 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focusin \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert 0 abcd ;# previous settings
focus -force .e
# update necessary to process FocusIn event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focusin focusin}
test entry-19.13 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focusin \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
- set ::vVals {}
+ set validationData {}
focus -force .
# update necessary to process FocusOut event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {}
test entry-19.14 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focuso \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
- set ::vVals {} ;# previous settings
+ set validationData {} ;# previous settings
focus -force .e
# update necessary to process FocusIn event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {}
test entry-19.15 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focuso \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
- set ::vVals {} ;# previous settings
+ set validationData {} ;# previous settings
focus -force .e ;# previous settings
# update necessary to process FocusIn event
update ;# previous settings
focus -force .
# update necessary to process FocusOut event
update
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focusout focusout}
# the same as 19.16 but added [.e validate] to returned list
test entry-19.16 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focuso \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
- set ::vVals {} ;# previous settings
+ set validationData {} ;# previous settings
focus -force .e ;# previous settings
# update necessary to process FocusIn event
update ;# previous settings
focus -force .
# update necessary to process FocusOut event
update
- list [.e validate] $::vVals
+ list [.e validate] $validationData
} -cleanup {
destroy .e
} -result {1 {.e -1 -1 abcd abcd {} all forced}}
test entry-19.17 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate focuso \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
.e insert end abcd ;# previous settings
- set ::e newdata
- list [.e cget -validate] $::vVals
+ set textVar newdata
+ list [.e cget -validate] $validationData
} -cleanup {
destroy .e
} -result {focusout {.e -1 -1 newdata abcd {} focusout forced}}
@@ -3354,18 +3333,18 @@ test entry-19.17 {entry widget validation} -setup {
# proc doval changed - returns 0
test entry-19.18 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd3 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
- set ::e newdata ;# previous settings
+ set textVar newdata ;# previous settings
.e configure -validate all
- set ::e nextdata
- list [.e cget -validate] $::vVals
+ set textVar nextdata
+ list [.e cget -validate] $validationData
} -cleanup {
destroy .e
} -result {none {.e -1 -1 nextdata newdata {} all forced}}
@@ -3374,19 +3353,19 @@ test entry-19.18 {entry widget validation} -setup {
## loop condition in the validation, when the entry textvar is also set
# proc doval2 used
test entry-19.19 {entry widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd3 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
- set ::e nextdata ;# previous settings
+ set textVar nextdata ;# previous settings
- .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V]
+ .e configure -validatecommand $validateCmd2
.e validate
- list [.e cget -validate] [.e get] $::vVals
+ list [.e cget -validate] [.e get] $validationData
} -cleanup {
destroy .e
} -result {none nextdata {.e -1 -1 nextdata nextdata {} all forced}}
@@ -3397,21 +3376,21 @@ test entry-19.19 {entry widget validation} -setup {
## 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} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate all \
- -validatecommand [list doval %W %d %i %P %s %S %v %V] \
+ -validatecommand $validateCmd1 \
-invalidcommand bell \
- -textvariable ::e \
+ -textvariable textVar \
-background red -foreground white
pack .e ; update idletasks
- set ::e nextdata ;# previous settings
- .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev
+ set textVar nextdata ;# previous settings
+ .e configure -validatecommand $validateCmd2 ;# prev
.e validate ;# previous settings
.e configure -validate all
- set ::e testdata
- list [.e cget -validate] [.e get] $::e $::vVals
+ set textVar testdata
+ list [.e cget -validate] [.e get] $textVar $validationData
} -cleanup {
destroy .e
} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
@@ -3422,15 +3401,15 @@ test entry-19.20 {entry widget validation} -setup {
## 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.21 {entry widget validation - bug 40e4bf6198} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
entry .e -validate key \
- -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
- -textvariable ::e
+ -validatecommand $validateCmd2 \
+ -textvariable textVar
pack .e ; update idletasks
- set ::e origdata
+ set textVar origdata
.e insert 0 A
- list [.e cget -validate] [.e get] $::e $::vVals
+ list [.e cget -validate] [.e get] $textVar $validationData
} -cleanup {
destroy .e
} -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}}
@@ -3625,10 +3604,16 @@ test entry-25.3 {Bug [2a32225cd1] - Navigation in a password made of several wor
# XXX Still need to write tests for EntryScanTo and EntrySelectTo.
# No tests for EventuallyRedraw
+#
+# CLEANUP
+#
+
# option clear
-# cleanup
+foreach i {1 2 3} {
+ unset validateCmd$i
+}
+unset i
+testutils forget entry scroll
cleanupTests
return
-
-