summaryrefslogtreecommitdiffstats
path: root/tests/spinbox.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-15 13:15:14 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-15 13:15:14 (GMT)
commit418fba3d3d0db14e0f74b19da9c077903f7dbdcd (patch)
tree9228e48dd6be2573326e1506c130a0932a45ac66 /tests/spinbox.test
parent405efb77f1e112a07406b05b1dfca6b8622cc9c9 (diff)
parent51da8fabbfe52df8ccaa273c48fcf127f35f79fd (diff)
downloadtk-418fba3d3d0db14e0f74b19da9c077903f7dbdcd.zip
tk-418fba3d3d0db14e0f74b19da9c077903f7dbdcd.tar.gz
tk-418fba3d3d0db14e0f74b19da9c077903f7dbdcd.tar.bz2
Merge 8.7. Make test-cases on MacOS and X11 pass (win32 not tested yet)
Diffstat (limited to 'tests/spinbox.test')
-rw-r--r--tests/spinbox.test230
1 files changed, 140 insertions, 90 deletions
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 65c5bd9..df1613c 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -12,6 +12,7 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
# For xscrollcommand
+set scrollInfo {}
proc scroll args {
global scrollInfo
set scrollInfo $args
@@ -93,7 +94,7 @@ test spinbox-1.5 {configuration option: "bd"} -setup {
.e cget -bd
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-1.6 {configuration option: "bd" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -137,7 +138,7 @@ test spinbox-1.9 {configuration option: "borderwidth"} -setup {
.e cget -borderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.10 {configuration option: "borderwidth" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -281,7 +282,7 @@ test spinbox-1.22 {configuration option: "exportselection"} -setup {
.e cget -exportselection
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.23 {configuration option: "exportselection" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -457,7 +458,7 @@ test spinbox-1.38 {configuration option: "highlightthickness"} -setup {
.e cget -highlightthickness
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-1.39 {configuration option: "highlightthickness" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -479,7 +480,7 @@ test spinbox-1.40 {configuration option: "highlightthickness"} -setup {
.e cget -highlightthickness
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-1.41 {configuration option: "increment"} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
@@ -535,7 +536,7 @@ test spinbox-1.45 {configuration option: "insertborderwidth"} -setup {
.e cget -insertborderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.46 {configuration option: "insertborderwidth" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -557,7 +558,7 @@ test spinbox-1.47 {configuration option: "insertofftime"} -setup {
.e cget -insertofftime
} -cleanup {
destroy .e
-} -result {100}
+} -result 100
test spinbox-1.48 {configuration option: "insertofftime" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -579,7 +580,7 @@ test spinbox-1.49 {configuration option: "insertontime"} -setup {
.e cget -insertontime
} -cleanup {
destroy .e
-} -result {100}
+} -result 100
test spinbox-1.50 {configuration option: "insertontime" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -691,7 +692,7 @@ test spinbox-1.59 {configuration option: "repeatdelay"} -setup {
.e cget -repeatdelay
} -cleanup {
destroy .e
-} -result {500}
+} -result 500
test spinbox-1.60 {configuration option: "repeatdelay" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -713,7 +714,7 @@ test spinbox-1.61 {configuration option: "repeatinterval"} -setup {
.e cget -repeatinterval
} -cleanup {
destroy .e
-} -result {-500}
+} -result -500
test spinbox-1.62 {configuration option: "repeatinterval" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -757,7 +758,7 @@ test spinbox-1.65 {configuration option: "selectborderwidth"} -setup {
.e cget -selectborderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.66 {configuration option: "selectborderwidth" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -937,7 +938,7 @@ test spinbox-1.81 {configuration option: "width"} -setup {
.e cget -width
} -cleanup {
destroy .e
-} -result {402}
+} -result 402
test spinbox-1.82 {configuration option: "width" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -959,7 +960,7 @@ test spinbox-1.83 {configuration option: "wrap"} -setup {
.e cget -wrap
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.84 {configuration option: "wrap" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -1154,7 +1155,7 @@ test spinbox-3.14 {SpinboxWidgetCmd procedure, "cget" widget command} -setup {
.e cget -bd
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setup {
spinbox .e
pack .e
@@ -1163,7 +1164,7 @@ test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setu
llength [.e configure]
} -cleanup {
destroy .e
-} -result {51}
+} -result 51
test spinbox-3.16 {SpinboxWidgetCmd procedure, "configure" widget command} -setup {
spinbox .e
} -body {
@@ -1179,7 +1180,7 @@ test spinbox-3.17 {SpinboxWidgetCmd procedure, "configure" widget command} -setu
lindex [.e configure -bd] 4
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-3.18 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
} -body {
@@ -1218,7 +1219,7 @@ test spinbox-3.22 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {014567890}
+} -result 014567890
test spinbox-3.23 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
} -body {
@@ -1227,7 +1228,7 @@ test spinbox-3.23 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {0123457890}
+} -result 0123457890
test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1259,7 +1260,7 @@ test spinbox-3.25 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1272,7 +1273,7 @@ test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1285,7 +1286,7 @@ test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.27 {SpinboxWidgetCmd procedure, "get" widget command} -setup {
spinbox .e
} -body {
@@ -1315,7 +1316,7 @@ test spinbox-3.30 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-3.31 {SpinboxWidgetCmd procedure, "index" widget command} -setup {
spinbox .e
} -body {
@@ -1401,7 +1402,7 @@ test spinbox-3.40 {SpinboxWidgetCmd procedure, "insert" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup {
spinbox .e
pack .e
@@ -1414,7 +1415,7 @@ test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.41 {SpinboxWidgetCmd procedure, "insert" widget command} -setup {
spinbox .e
} -body {
@@ -1474,7 +1475,7 @@ test spinbox-3.46 {SpinboxWidgetCmd procedure, "scan" widget command} -constrain
.e index @0
} -cleanup {
destroy .e
-} -result {2}
+} -result 2
test spinbox-3.47 {SpinboxWidgetCmd procedure, "select" widget command} -setup {
spinbox .e
} -body {
@@ -1543,7 +1544,7 @@ test spinbox-3.52 {SpinboxWidgetCmd procedure, "selection present" widget comman
.e selection present
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup {
spinbox .e
pack .e
@@ -1556,7 +1557,7 @@ test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget comman
.e selection present
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup {
spinbox .e
pack .e
@@ -1569,7 +1570,7 @@ test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget comman
.e selection present
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-3.55 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup {
spinbox .e
} -body {
@@ -1597,7 +1598,7 @@ test spinbox-3.57 {SpinboxWidgetCmd procedure, "selection adjust" widget command
selection get
} -cleanup {
destroy .e
-} -result {123}
+} -result 123
test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup {
spinbox .e
pack .e
@@ -1611,7 +1612,7 @@ test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command
selection get
} -cleanup {
destroy .e
-} -result {234}
+} -result 234
test spinbox-3.59 {SpinboxWidgetCmd procedure, "selection from" widget command} -setup {
spinbox .e
} -body {
@@ -1825,7 +1826,7 @@ test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {32}
+} -result 32
test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1839,7 +1840,7 @@ test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {29}
+} -result 29
test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1871,11 +1872,11 @@ test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e insert end "runs off the end of the window quite a bit."
.e xview 0
update
- .e xview -4
+ .e xview -1
.e index @0
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1887,7 +1888,7 @@ test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {73}
+} -result 73
test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1926,7 +1927,7 @@ test spinbox-5.1 {ConfigureSpinbox procedure, -textvariable} -body {
.e get
} -cleanup {
destroy .e
-} -result {12345}
+} -result 12345
test spinbox-5.2 {ConfigureSpinbox procedure, -textvariable} -body {
set x 12345
spinbox .e -textvariable x
@@ -2013,11 +2014,14 @@ test spinbox-5.7 {ConfigureSpinbox procedure} -setup {
} -body {
.e configure -font {Courier -12} -width 4 -xscrollcommand scroll
.e insert end "01234567890"
- update
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e configure -width 5
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {0.000000 0.363636}
test spinbox-5.8 {ConfigureSpinbox procedure} -constraints {
@@ -2142,7 +2146,7 @@ test spinbox-6.4 {SpinboxComputeGeometry procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-6.5 {SpinboxComputeGeometry procedure} -setup {
spinbox .e -highlightthickness 2
pack .e
@@ -2154,7 +2158,7 @@ test spinbox-6.5 {SpinboxComputeGeometry procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-6.6 {SpinboxComputeGeometry procedure} -constraints {
fonts
} -setup {
@@ -2217,11 +2221,14 @@ test spinbox-7.1 {InsertChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 2 XXX
- update
+ vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {abXXXcde abXXXcde {0.000000 1.000000}}
test spinbox-7.2 {InsertChars procedure} -setup {
@@ -2232,11 +2239,14 @@ test spinbox-7.2 {InsertChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 500 XXX
- update
+ vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {abcdeXXX abcdeXXX {0.000000 1.000000}}
test spinbox-7.3 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
@@ -2305,7 +2315,7 @@ test spinbox-7.7 {InsertChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {7}
+} -result 7
test spinbox-7.8 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2316,7 +2326,7 @@ test spinbox-7.8 {InsertChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-7.9 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2328,7 +2338,7 @@ test spinbox-7.9 {InsertChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {7}
+} -result 7
test spinbox-7.10 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2340,7 +2350,7 @@ test spinbox-7.10 {InsertChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-7.11 {InsertChars procedure} -constraints {
fonts
@@ -2354,7 +2364,7 @@ test spinbox-7.11 {InsertChars procedure} -constraints {
winfo reqwidth .e
} -cleanup {
destroy .e
-} -result {70}
+} -result 70
test spinbox-8.1 {DeleteChars procedure} -setup {
unset -nocomplain contents
@@ -2364,11 +2374,14 @@ test spinbox-8.1 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 2 4
- update
+ vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {abe abe {0.000000 1.000000}}
test spinbox-8.2 {DeleteChars procedure} -setup {
unset -nocomplain contents
@@ -2378,11 +2391,14 @@ test spinbox-8.2 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
- .e delete -2 2
- update
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
+ .e delete -1 2
+ vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {cde cde {0.000000 1.000000}}
test spinbox-8.3 {DeleteChars procedure} -setup {
unset -nocomplain contents
@@ -2392,11 +2408,14 @@ test spinbox-8.3 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 3 1000
- update
+ vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {abc abc {0.000000 1.000000}}
test spinbox-8.4 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
@@ -2533,7 +2552,7 @@ test spinbox-8.12 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.13 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2546,7 +2565,7 @@ test spinbox-8.13 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.14 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2559,7 +2578,7 @@ test spinbox-8.14 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-8.15 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2572,7 +2591,7 @@ test spinbox-8.15 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.16 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2585,7 +2604,7 @@ test spinbox-8.16 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.17 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2598,7 +2617,7 @@ test spinbox-8.17 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-8.18 {DeleteChars procedure} -setup {
spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2625,7 +2644,7 @@ test spinbox-8.18 {DeleteChars procedure} -setup {
} -cleanup {
destroy .e
unset XPAD buttonWidth expected
-} -result {1}
+} -result 1
test spinbox-9.1 {SpinboxValueChanged procedure} -setup {
unset -nocomplain x
@@ -2705,7 +2724,7 @@ test spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup
.e index @0
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup {
unset -nocomplain x
spinbox .e -highlightthickness 2 -bd 2
@@ -2721,7 +2740,7 @@ test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup
.e index @0
} -cleanup {
destroy .e
-} -result {10}
+} -result 10
test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup {
unset -nocomplain x
spinbox .e -highlightthickness 2 -bd 2
@@ -2736,7 +2755,7 @@ test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup
.e index insert
} -cleanup {
destroy .e
-} -result {3}
+} -result 3
test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup {
unset -nocomplain x
spinbox .e -highlightthickness 2 -bd 2
@@ -2750,7 +2769,7 @@ test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup
.e index insert
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-11.1 {SpinboxEventProc procedure} -setup {
spinbox .e -highlightthickness 2 -bd 2 -font {Helvetica -12}
@@ -2794,7 +2813,7 @@ test spinbox-13.1 {GetSpinboxIndex procedure} -setup {
.e index end
} -cleanup {
destroy .e
-} -result {21}
+} -result 21
test spinbox-13.2 {GetSpinboxIndex procedure} -body {
spinbox .e
.e index abogus
@@ -2813,7 +2832,7 @@ test spinbox-13.3 {GetSpinboxIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-13.4 {GetSpinboxIndex procedure} -setup {
spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken
pack .e
@@ -2826,7 +2845,7 @@ test spinbox-13.4 {GetSpinboxIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-13.5 {GetSpinboxIndex procedure} -setup {
spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken
pack .e
@@ -2840,7 +2859,7 @@ test spinbox-13.5 {GetSpinboxIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {15}
+} -result 15
test spinbox-13.6 {GetSpinboxIndex procedure} -setup {
spinbox .e
} -body {
@@ -2859,7 +2878,7 @@ test spinbox-13.7 {GetSpinboxIndex procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {2}
+} -result 2
test spinbox-13.8 {GetSpinboxIndex procedure} -setup {
spinbox .e
} -body {
@@ -2919,7 +2938,7 @@ test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body {
.e index sel.first
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-13.12 {GetSpinboxIndex procedure} -constraints x11 -body {
# Previous settings:
@@ -3031,7 +3050,7 @@ test spinbox-13.16 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @4
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3042,7 +3061,7 @@ test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @11
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3053,7 +3072,7 @@ test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @12
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3064,7 +3083,7 @@ test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @[expr {[winfo width .e] - 6-11}]
} -cleanup {
destroy .e
-} -result {8}
+} -result 8
test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3075,7 +3094,7 @@ test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @[expr {[winfo width .e] - 5}]
} -cleanup {
destroy .e
-} -result {9}
+} -result 9
test spinbox-13.21 {GetSpinboxIndex procedure} -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3086,7 +3105,7 @@ test spinbox-13.21 {GetSpinboxIndex procedure} -body {
.e index @1000
} -cleanup {
destroy .e
-} -result {9}
+} -result 9
test spinbox-13.22 {GetSpinboxIndex procedure} -setup {
spinbox .e
pack .e
@@ -3103,10 +3122,10 @@ test spinbox-13.23 {GetSpinboxIndex procedure} -body {
.e insert 0 012345678901234567890
.e xview 4
update
- .e index -10
+ .e index -1
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-13.24 {GetSpinboxIndex procedure} -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3117,7 +3136,7 @@ test spinbox-13.24 {GetSpinboxIndex procedure} -body {
.e index 12
} -cleanup {
destroy .e
-} -result {12}
+} -result 12
test spinbox-13.25 {GetSpinboxIndex procedure} -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3128,7 +3147,7 @@ test spinbox-13.25 {GetSpinboxIndex procedure} -body {
.e index 49
} -cleanup {
destroy .e
-} -result {21}
+} -result 21
# XXX Still need to write tests for SpinboxScanTo and SpinboxSelectTo.
@@ -3154,7 +3173,7 @@ test spinbox-14.3 {SpinboxFetchSelection procedure} -setup {
string compare [selection get] $x
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-15.1 {SpinboxLostSelection} -body {
spinbox .e
@@ -3191,42 +3210,53 @@ test spinbox-16.2 {SpinboxVisibleRange procedure} -body {
test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 0 end
.e insert 0 123
- update
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {0.000000 1.000000}
test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
.e insert 0 0123456789abcdef
+ update idletasks
+ set timeout [after 500 {set $scrollInfo {-1000000 -1000000}}]
.e xview 3
- update
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
+ after cancel $timeout
} -result {0.187500 0.812500}
test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcdefghijklmnopqrs
- .e xview 6
- update
+ .e xview
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
-} -result {0.315789 0.842105}
+ after cancel $timeout
+} -result {0.000000 0.526316}
test spinbox-17.4 {SpinboxUpdateScrollbar procedure} -setup {
proc bgerror msg {
global x
set x $msg
}
} -body {
- spinbox .e -width 5 -xscrollcommand thisisnotacommand
+ spinbox .e -width 5
pack .e
- update
+ update idletasks
+ .e configure -xscrollcommand thisisnotacommand
+ vwait x
list $x $errorInfo
} -cleanup {
destroy .e
@@ -3246,7 +3276,7 @@ test spinbox-18.1 {Spinbox widget vs hiding} -setup {
set res1 [list [winfo children .] [interp hidden]]
set res2 [list {} $l]
expr {$res1 == $res2}
-} -result {1}
+} -result 1
##
## Spinbox widget VALIDATION tests
@@ -3606,7 +3636,7 @@ test spinbox-19.19 {spinbox widget validation} -setup {
list [.e cget -validate] [.e get] $::vVals
} -cleanup {
destroy .e
-} -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
+} -result {none nextdata {.e -1 -1 nextdata nextdata {} all forced}}
## This leaves validate alone because we trigger validation through the
## textvar (a write trace), and the write during validation triggers
@@ -3632,6 +3662,26 @@ test spinbox-19.20 {spinbox widget validation} -setup {
} -cleanup {
destroy .e
} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
+
+## 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 spinbox-19.21 {spinbox widget validation - bug 40e4bf6198} -setup {
+ unset -nocomplain ::e ::vVals
+} -body {
+ spinbox .e -validate key \
+ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
+ -textvariable ::e
+ pack .e
+ set ::e origdata
+ .e insert 0 A
+ list [.e cget -validate] [.e get] $::e $::vVals
+} -cleanup {
+ destroy .e
+} -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}}
+
##
## End validation tests
##
@@ -3787,7 +3837,7 @@ test spinbox-22.1 {spinbox config, -from changes SF bug 559078} -body {
set val
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body {
set val 5
spinbox .e -from 1 -to 10 -textvariable val
@@ -3795,7 +3845,7 @@ test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body {
set val
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body {
set val 5
spinbox .e -from 3 -to 10 -textvariable val
@@ -3803,7 +3853,7 @@ test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body {
set val
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-23.1 {selection present while disabled, bug 637828} -body {
spinbox .e