summaryrefslogtreecommitdiffstats
path: root/tests/ttk
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2020-06-16 22:24:44 (GMT)
committerfvogel <fvogelnew1@free.fr>2020-06-16 22:24:44 (GMT)
commitfb4bf25105389d2e3c0cae6cf736d3b6b3330a1a (patch)
tree4ca12dbc8bbb229d96770ece61ae5ac47a0c2831 /tests/ttk
parent136539153502fe4e2a2bb4f8c3868c457ef8b20b (diff)
downloadtk-fb4bf25105389d2e3c0cae6cf736d3b6b3330a1a.zip
tk-fb4bf25105389d2e3c0cae6cf736d3b6b3330a1a.tar.gz
tk-fb4bf25105389d2e3c0cae6cf736d3b6b3330a1a.tar.bz2
Add another non-regression test, this time exercising the -wrap false case.
Diffstat (limited to 'tests/ttk')
-rw-r--r--tests/ttk/spinbox.test25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
index 6a7b883..5a720ea 100644
--- a/tests/ttk/spinbox.test
+++ b/tests/ttk/spinbox.test
@@ -220,7 +220,7 @@ test spinbox-3.0 "textarea should expand to fill widget" -setup {
unset -nocomplain ::spinbox_test SBV
} -result {textarea}
-test spinbox-4.0 "Increment with duplicates in -values" -setup {
+test spinbox-4.0 "Increment with duplicates in -values, wrap" -setup {
ttk::spinbox .sb -values {one two three 4 5 two six} -wrap true
set max [expr {[llength [.sb cget -values]] + 2}]
} -body {
@@ -239,7 +239,7 @@ test spinbox-4.0 "Increment with duplicates in -values" -setup {
unset -nocomplain ::spinbox_test max
} -result {one two three 4 5 two six one two one six two 5 4 three two one six}
-test spinbox-4.1 "Increment with duplicates in -values, initial value set" -setup {
+test spinbox-4.1 "Increment with duplicates in -values, wrap, initial value set" -setup {
ttk::spinbox .sb -values {one two three 4 5 two six} -wrap true
set max [expr {[llength [.sb cget -values]] + 2}]
} -body {
@@ -249,7 +249,7 @@ test spinbox-4.1 "Increment with duplicates in -values, initial value set" -setu
event generate .sb <<Increment>>
lappend ::spinbox_test [.sb get]
}
- .sb set two
+ .sb set two ; # the first "two" in the -values list becomes the current value
for {set i 0} {$i < $max} {incr i} {
event generate .sb <<Decrement>>
lappend ::spinbox_test [.sb get]
@@ -259,6 +259,25 @@ test spinbox-4.1 "Increment with duplicates in -values, initial value set" -setu
destroy .sb
unset -nocomplain ::spinbox_test max
} -result {three 4 5 two six one two three 4 5 one six two 5 4 three two one six}
+test spinbox-4.2 "Increment with duplicates in -values, no wrap" -setup {
+ ttk::spinbox .sb -values {one two three 4 5 two six} -wrap false
+ set max [expr {[llength [.sb cget -values]] + 2}]
+} -body {
+ set ::spinbox_test [.sb get]
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Increment>>
+ lappend ::spinbox_test [.sb get]
+ }
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Decrement>>
+ lappend ::spinbox_test [.sb get]
+ }
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+ unset -nocomplain ::spinbox_test max
+} -result {one two three 4 5 two six six six two 5 4 three two one one one one}
+
# nostomp: NB intentional difference between ttk::spinbox and tk::spinbox;
# see also #1439266