summaryrefslogtreecommitdiffstats
path: root/tests/spinbox.test
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2025-05-23 02:28:37 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2025-05-23 02:28:37 (GMT)
commit25f16a070dd42bc33af26334d2071a81377aee5c (patch)
treef20dcb1268a10aa292953f0ffa965881fefed78b /tests/spinbox.test
parente1675428ff056ed7a44fcc26a26dc5adb8e5f9eb (diff)
parentf8e4b115fdb0f0886cd853323937b8ea757fcc21 (diff)
downloadtk-core-tip-716.zip
tk-core-tip-716.tar.gz
tk-core-tip-716.tar.bz2
Merge core-9-0-branchcore-tip-716
Diffstat (limited to 'tests/spinbox.test')
-rw-r--r--tests/spinbox.test432
1 files changed, 209 insertions, 223 deletions
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 87fb946..94e0b5f 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -11,35 +11,15 @@ 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
+foreach i {1 2 3} {
+ set validateCmd$i [list validateCommand$i %W %d %i %P %s %S %v %V]
}
-proc doval3 {W d i P s S v V} {
- set ::vVals [list $W $d $i $P $s $S $v $V]
- return 0
-}
-
set cy [font metrics {Courier -12} -linespace]
+
test spinbox-1.1 {configuration option: "activebackground"} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -1233,20 +1213,20 @@ test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
update
- set x {}
+ set textVar {}
} -body {
# UTF
.e insert end "01234乎67890"
.e delete 6
- lappend x [.e get]
+ lappend textVar [.e get]
.e delete 0 end
.e insert end "012345乎7890"
.e delete 6
- lappend x [.e get]
+ lappend textVar [.e get]
.e delete 0 end
.e insert end "0123456乎890"
.e delete 6
- lappend x [.e get]
+ lappend textVar [.e get]
} -cleanup {
destroy .e
} -result [list "01234乎7890" "0123457890" "012345乎890"]
@@ -1900,13 +1880,13 @@ test spinbox-3.81 {SpinboxWidgetCmd 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 textVar {}
.e xview moveto .1
- lappend x [format {%.6f} [lindex [.e xview] 0]]
+ lappend textVar [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .11
- lappend x [format {%.6f} [lindex [.e xview] 0]]
+ lappend textVar [format {%.6f} [lindex [.e xview] 0]]
.e xview moveto .12
- lappend x [format {%.6f} [lindex [.e xview] 0]]
+ lappend textVar [format {%.6f} [lindex [.e xview] 0]]
} -cleanup {
destroy .e
} -result {0.095745 0.106383 0.117021}
@@ -1922,47 +1902,47 @@ test spinbox-3.82 {SpinboxWidgetCmd procedure} -setup {
} -returnCodes error -result {bad option "gorp": must be bbox, cget, configure, delete, get, icursor, identify, index, insert, invoke, scan, selection, set, validate, or xview}
test spinbox-5.1 {ConfigureSpinbox procedure, -textvariable} -body {
- set x 12345
- spinbox .e -textvariable x
+ set textVar 12345
+ spinbox .e -textvariable textVar
.e get
} -cleanup {
destroy .e
} -result 12345
test spinbox-5.2 {ConfigureSpinbox procedure, -textvariable} -body {
- set x 12345
- spinbox .e -textvariable x
+ set textVar 12345
+ spinbox .e -textvariable textVar
set y abcde
.e configure -textvariable y
- set x 54321
+ set textVar 54321
.e get
} -cleanup {
destroy .e
} -result {abcde}
test spinbox-5.3 {ConfigureSpinbox procedure, -textvariable} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .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 spinbox-5.4 {ConfigureSpinbox procedure, -textvariable} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .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
+ trace remove variable textVar write override
} -result {12345 12345}
test spinbox-5.5 {ConfigureSpinbox procedure} -setup {
- set x {}
+ set textVar {}
spinbox .e1
spinbox .e2
} -body {
@@ -1972,13 +1952,13 @@ test spinbox-5.5 {ConfigureSpinbox procedure} -setup {
pack .e1 .e2
.e2 select from 0
.e2 select to 10
- lappend x [selection get]
+ lappend textVar [selection get]
.e1 select from 1
.e1 select to 5
- lappend x [selection get]
+ lappend textVar [selection get]
.e1 configure -exportselection 1
- lappend x [selection get]
- set x
+ lappend textVar [selection get]
+ set textVar
} -cleanup {
destroy .e1 .e2
} -result {{This is so} {This is so} 1234}
@@ -2012,7 +1992,7 @@ test spinbox-5.7 {ConfigureSpinbox procedure} -setup {
spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2
pack .e
} -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
@@ -2218,7 +2198,7 @@ test spinbox-7.1 {InsertChars procedure} -setup {
pack .e
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
.e insert 0 abcde
update
set scrollInfo wrong
@@ -2235,7 +2215,7 @@ test spinbox-7.2 {InsertChars procedure} -setup {
pack .e
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
.e insert 0 abcde
update
set scrollInfo wrong
@@ -2253,9 +2233,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {5 9 5 8}
@@ -2267,9 +2247,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {2 9 2 8}
@@ -2281,9 +2261,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {2 9 2 8}
@@ -2295,9 +2275,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 5
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {2 6 2 5}
@@ -2305,7 +2285,7 @@ test spinbox-7.7 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
} -body {
- .e configure -xscrollcommand scroll
+ .e configure -xscrollcommand setScrollInfo
.e insert 0 0123456789
.e icursor 4
.e insert 4 XXX
@@ -2369,7 +2349,7 @@ test spinbox-8.1 {DeleteChars procedure} -setup {
pack .e
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
.e insert 0 abcde
update
set scrollInfo wrong
@@ -2385,7 +2365,7 @@ test spinbox-8.2 {DeleteChars procedure} -setup {
pack .e
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
.e insert 0 abcde
update
set scrollInfo wrong
@@ -2401,7 +2381,7 @@ test spinbox-8.3 {DeleteChars procedure} -setup {
pack .e
focus .e
} -body {
- .e configure -textvariable contents -xscrollcommand scroll
+ .e configure -textvariable contents -xscrollcommand setScrollInfo
.e insert 0 abcde
update
set scrollInfo wrong
@@ -2421,9 +2401,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 5
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {1 6 1 5}
@@ -2437,9 +2417,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 4
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {1 5 1 4}
@@ -2453,9 +2433,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 5
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {1 2 1 5}
@@ -2483,9 +2463,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {3 4 3 8}
@@ -2512,9 +2492,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 8
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {3 5 5 8}
@@ -2528,9 +2508,9 @@ test spinbox-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 textVar "[.e index sel.first] [.e index sel.last]"
.e select to 4
- lappend x [.e index sel.first] [.e index sel.last]
+ lappend textVar [.e index sel.first] [.e index sel.last]
} -cleanup {
destroy .e
} -result {3 8 4 8}
@@ -2641,24 +2621,24 @@ test spinbox-8.18 {DeleteChars procedure} -setup {
} -result {1}
test spinbox-9.1 {SpinboxValueChanged procedure} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
} -body {
- trace add variable x write override
- spinbox .e -textvariable x -width 0
+ trace add variable textVar write override
+ spinbox .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
+ trace remove variable textVar write override
} -result {12345 12345}
test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body {
- set x abcde
+ set textVar abcde
set y ab
spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0
pack .e
- .e configure -textvariable x
+ .e configure -textvariable textVar
.e configure -textvariable y
update
list [.e get] [winfo reqwidth .e]
@@ -2666,100 +2646,100 @@ test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body {
destroy .e
} -result {ab 35}
test spinbox-10.2 {SpinboxSetValue procedure, updating selection} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2
pack .e
} -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 spinbox-10.3 {SpinboxSetValue procedure, updating selection} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2
pack .e
} -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 spinbox-10.4 {SpinboxSetValue procedure, updating selection} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2
pack .e
} -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 spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .e -highlightthickness 2 -bd 2
pack .e
} -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 spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .e -highlightthickness 2 -bd 2
pack .e
} -body {
- .e configure -width 10 -font {Courier -12} -textvariable x
+ .e configure -width 10 -font {Courier -12} -textvariable textVar
pack .e
.e insert 0 "abcdefghjklmnopqrstuvwxyz"
.e xview 10
update
- set x "1234567890123456789012"
+ set textVar "1234567890123456789012"
update
.e index @0
} -cleanup {
destroy .e
} -result 10
test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .e -highlightthickness 2 -bd 2
pack .e
update
} -body {
- .e configure -width 10 -font {Courier -12} -textvariable x
+ .e configure -width 10 -font {Courier -12} -textvariable textVar
pack .e
.e insert 0 "abcdefghjklmnopqrstuvwxyz"
.e icursor 5
- set x "123"
+ set textVar "123"
.e index insert
} -cleanup {
destroy .e
} -result 3
test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup {
- unset -nocomplain x
+ unset -nocomplain textVar
spinbox .e -highlightthickness 2 -bd 2
pack .e
} -body {
- .e configure -width 10 -font {Courier -12} -textvariable x
+ .e configure -width 10 -font {Courier -12} -textvariable textVar
pack .e
.e insert 0 "abcdefghjklmnopqrstuvwxyz"
.e icursor 5
- set x "123456"
+ set textVar "123456"
.e index insert
} -cleanup {
destroy .e
@@ -2776,14 +2756,14 @@ test spinbox-11.1 {SpinboxEventProc procedure} -setup {
destroy .e
} -result {}
test spinbox-11.2 {SpinboxEventProc procedure} -setup {
- set x {}
+ set textVar {}
} -body {
spinbox .e1 -fg #112233
rename .e1 .e2
- lappend x [winfo children .]
- lappend x [.e2 cget -fg]
+ lappend textVar [winfo children .]
+ lappend textVar [.e2 cget -fg]
destroy .e1
- lappend x [info command .e*] [winfo children .]
+ lappend textVar [info command .e*] [winfo children .]
} -cleanup {
destroy .e1
} -result {.e1 #112233 {} {}}
@@ -3155,16 +3135,16 @@ test spinbox-14.1 {SpinboxFetchSelection procedure} -body {
destroy .e
} -result {his is a test str}
test spinbox-14.3 {SpinboxFetchSelection 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 {
spinbox .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
@@ -3202,7 +3182,7 @@ test spinbox-16.2 {SpinboxVisibleRange procedure} -body {
test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body {
- spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
+ spinbox .e -width 10 -xscrollcommand setScrollInfo -font {Courier -12}
pack .e
update
set scrollInfo wrong
@@ -3214,7 +3194,7 @@ test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body {
destroy .e
} -result {0.000000 1.000000}
test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body {
- spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
+ spinbox .e -width 10 -xscrollcommand setScrollInfo -font {Courier -12}
pack .e
.e insert 0 0123456789abcdef
update
@@ -3226,7 +3206,7 @@ test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body {
destroy .e
} -result {0.187500 0.812500}
test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body {
- spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
+ spinbox .e -width 10 -xscrollcommand setScrollInfo -font {Courier -12}
pack .e
update
set scrollInfo wrong
@@ -3239,8 +3219,8 @@ test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body {
} -result {0.000000 0.526316}
test spinbox-17.4 {SpinboxUpdateScrollbar procedure} -setup {
proc bgerror msg {
- global x
- set x $msg
+ global textVar
+ set textVar $msg
}
} -body {
spinbox .e -width 5
@@ -3249,7 +3229,7 @@ test spinbox-17.4 {SpinboxUpdateScrollbar procedure} -setup {
set scrollInfo wrong
.e configure -xscrollcommand thisisnotacommand
update
- list $x $errorInfo
+ list $textVar $errorInfo
} -cleanup {
destroy .e
rename bgerror {}
@@ -3280,125 +3260,125 @@ test spinbox-18.1 {Spinbox widget vs hiding} -setup {
# test cases. This was replaced by inserting recently set configurations
# that matters for the test case
test spinbox-19.1 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.e insert 0 a
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e 1 0 a {} a all key}
test spinbox-19.2 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.e insert 0 a ;# previous settings
.e insert 1 b
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {.e 1 1 ab a b all key}
test spinbox-19.3 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.4 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.5 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.6 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.7 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.e insert end abc ;# previous settings
- set ::vVals {}
+ set validationData {}
.e insert end d
- set ::vVals
+ set validationData
} -cleanup {
destroy .e
} -result {}
test spinbox-19.8 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.e configure -validate focus ;# previous settings
@@ -3406,18 +3386,18 @@ test spinbox-19.8 {spinbox 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 spinbox-19.9 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.e insert end abcd ;# previous settings
@@ -3427,36 +3407,36 @@ test spinbox-19.9 {spinbox 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 spinbox-19.10 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.11 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.e insert end abcd ;# previous settings
@@ -3466,144 +3446,144 @@ test spinbox-19.11 {spinbox 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 spinbox-19.12 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.13 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.14 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.15 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.16 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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 spinbox-19.17 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
.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}}
-# proc doval changed - returns 0
+# Note: changed validateCmd - returns 0
test spinbox-19.18 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
- 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}}
@@ -3611,21 +3591,21 @@ test spinbox-19.18 {spinbox widget validation} -setup {
## This sets validate to none because it shows that we prevent a possible
## loop condition in the validation, when the spinbox textvar is also set
-# proc doval2 used
+# proc validateCmd2 used
test spinbox-19.19 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
- 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}}
@@ -3636,21 +3616,21 @@ test spinbox-19.19 {spinbox widget validation} -setup {
## one of those "dangerous" conditions where the user will have a
## different value in the spinbox widget shown as is in the textvar.
test spinbox-19.20 {spinbox widget validation} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .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
- 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}}
@@ -3661,15 +3641,15 @@ test spinbox-19.20 {spinbox 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 spinbox-19.21 {spinbox widget validation - bug 40e4bf6198} -setup {
- unset -nocomplain ::e ::vVals
+ unset -nocomplain textVar validationData
} -body {
spinbox .e -validate key \
- -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
- -textvariable ::e
+ -validatecommand $validateCmd2 \
+ -textvariable textVar
pack .e
- 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}}
@@ -3916,9 +3896,15 @@ test spinbox-25.3 {Bugs [2a32225cd1] and [9fa3e08243]} -setup {
# XXX Still need to write tests for SpinboxScanTo and SpinboxSelectTo.
# No tests for EventuallyRedraw
+#
+# CLEANUP
+#
+
# option clear
-# cleanup
+foreach i {1 2 3} {
+ unset validateCmd$i
+}
+unset i
+testutils forget entry scroll
cleanupTests
return
-
-