summaryrefslogtreecommitdiffstats
path: root/tests/ttk
diff options
context:
space:
mode:
authorculler <culler>2020-11-10 13:59:25 (GMT)
committerculler <culler>2020-11-10 13:59:25 (GMT)
commitd94200fdcf927707b43670e7751208ea902b382e (patch)
treec8f724ce055955eef67c4b799866138c5389715d /tests/ttk
parenta49d6e52a72b1f086503ae32cb28b0da62e5fa99 (diff)
parent6133a711414cfb8fcc3a8b52ecf25b59a09e5800 (diff)
downloadtk-d94200fdcf927707b43670e7751208ea902b382e.zip
tk-d94200fdcf927707b43670e7751208ea902b382e.tar.gz
tk-d94200fdcf927707b43670e7751208ea902b382e.tar.bz2
Merge main
Diffstat (limited to 'tests/ttk')
-rw-r--r--tests/ttk/all.tcl7
-rw-r--r--tests/ttk/checkbutton.test3
-rw-r--r--tests/ttk/combobox.test7
-rw-r--r--tests/ttk/entry.test33
-rw-r--r--tests/ttk/image.test7
-rw-r--r--tests/ttk/labelframe.test39
-rw-r--r--tests/ttk/layout.test5
-rw-r--r--tests/ttk/notebook.test9
-rw-r--r--tests/ttk/panedwindow.test19
-rw-r--r--tests/ttk/progressbar.test7
-rw-r--r--tests/ttk/radiobutton.test3
-rw-r--r--tests/ttk/scrollbar.test55
-rw-r--r--tests/ttk/spinbox.test76
-rw-r--r--tests/ttk/treetags.test5
-rw-r--r--tests/ttk/treeview.test43
-rw-r--r--tests/ttk/ttk.test41
-rw-r--r--tests/ttk/validate.test4
-rw-r--r--tests/ttk/vsapi.test7
18 files changed, 211 insertions, 159 deletions
diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl
index f03cd56..8a75ba7 100644
--- a/tests/ttk/all.tcl
+++ b/tests/ttk/all.tcl
@@ -4,7 +4,7 @@
# tests. Execute it by invoking "source all.tcl" when running tktest
# in this directory.
#
-# Copyright (c) 2007 by the Tk developers.
+# Copyright © 2007 by the Tk developers.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,5 +16,6 @@ tcltest::configure -testdir [file normalize [file dirname [info script]]]
tcltest::configure -loadfile \
[file join [file dirname [tcltest::testsDirectory]] constraints.tcl]
tcltest::configure -singleproc 1
-tcltest::runAllTests
-
+set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)]
+encoding system utf-8
+if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1}
diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test
index 5e929de..39a6e35 100644
--- a/tests/ttk/checkbutton.test
+++ b/tests/ttk/checkbutton.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test checkbutton-1.1 "Checkbutton check" -body {
diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test
index c14db9b..48179f3 100644
--- a/tests/ttk/combobox.test
+++ b/tests/ttk/combobox.test
@@ -2,8 +2,9 @@
# ttk::combobox widget tests
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test combobox-1.0 "Combobox tests -- setup" -body {
@@ -12,7 +13,7 @@ test combobox-1.0 "Combobox tests -- setup" -body {
test combobox-1.1 "Bad -values list" -body {
.cb configure -values "bad \{list"
-} -result "unmatched open brace in list" -returnCodes 1
+} -result "unmatched open brace in list" -returnCodes error
test combobox-1.end "Combobox tests -- cleanup" -body {
destroy .cb
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index 26edca9..501bad6 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -2,10 +2,13 @@
# Tile package: entry widget tests
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+
variable scrollInfo
proc scroll args {
global scrollInfo
@@ -74,7 +77,7 @@ test entry-2.1 "Create entry before scrollbar" -body {
-expand false -fill x
} -cleanup {destroy .te .tsb}
-test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body {
+test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints failsOnUbuntu -body {
pack [ttk::entry .te -xscrollcommand [list .tsb set]] \
-expand true -fill both
.te insert end [string repeat "abc" 50]
@@ -84,7 +87,7 @@ test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body {
-expand false -fill x
update ; # no error
lappend res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update
-} -result {1} -cleanup {destroy .te .tsb}
+} -result 1 -cleanup {destroy .te .tsb}
test entry-2.2 "Initial scroll position" -body {
ttk::entry .e -font fixed -width 5 -xscrollcommand scroll
@@ -106,7 +109,7 @@ test entry-3.0 "Series 3 setup" -body {
variable cw [font measure $fixed a]
variable ch [font metrics $fixed -linespace]
variable bd 2 ;# border + padding
- variable ux [font measure $fixed \u4e4e]
+ variable ux [font measure $fixed 乎]
pack [ttk::entry .e -font $fixed -width 20]
update
@@ -128,28 +131,28 @@ test entry-3.3 "xview" -body {
.e insert end abcdefghijklmnopqrstuvwxyz
.e xview end
set result [.e index @0]
-} -result {7}
+} -result 7
test entry-3.4 "xview" -body {
.e delete 0 end;
.e insert end abcdefghijklmnopqrstuvwxyz
.e xview moveto 1.0
set result [.e index @0]
-} -result {7}
+} -result 7
test entry-3.5 "xview" -body {
.e delete 0 end;
.e insert end abcdefghijklmnopqrstuvwxyz
.e xview scroll 5 units
set result [.e index @0]
-} -result {5}
+} -result 5
test entry-3.6 "xview" -body {
.e delete 0 end;
.e insert end [string repeat abcdefghijklmnopqrstuvwxyz 5]
.e xview scroll 2 pages
set result [.e index @0]
-} -result {40}
+} -result 40
test entry-3.last "Series 3 cleanup" -body {
destroy .e
@@ -342,6 +345,18 @@ test entry-10.2 {configuration option: "-placeholderforeground"} -setup {
destroy .e
} -result {red}
+test entry-10.3 {styling option: "-placeholderforeground"} -setup {
+ pack [ttk::entry .e]
+} -body {
+ set current [ttk::style configure TEntry -placeholderforeground]
+ ttk::style configure TEntry -placeholderforeground blue
+ set res [ttk::style configure TEntry -placeholderforeground]
+ ttk::style configure TEntry -placeholderforeground $current
+ set res
+} -cleanup {
+ destroy .e
+} -result {blue}
+
test entry-11.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup {
pack [ttk::entry .e]
update
diff --git a/tests/ttk/image.test b/tests/ttk/image.test
index 5e48d5c..bb593fc 100644
--- a/tests/ttk/image.test
+++ b/tests/ttk/image.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test image-1.1 "Bad image element" -body {
@@ -11,7 +12,7 @@ test image-1.2 "Duplicate element" -setup {
ttk::style element create testElement image test.element
} -body {
ttk::style element create testElement image test.element
-} -returnCodes 1 -result "Duplicate element testElement"
+} -returnCodes error -result "Duplicate element testElement"
test image-2.0 "Deletion of displayed image (label)" -setup {
image create photo test.image -width 10 -height 10
diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test
index 649c35f..9ffffd8 100644
--- a/tests/ttk/labelframe.test
+++ b/tests/ttk/labelframe.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test labelframe-1.0 "Setup" -body {
@@ -10,60 +11,60 @@ test labelframe-2.1 "Can't use indirect descendant as labelwidget" -body {
ttk::frame .lf.t
ttk::checkbutton .lf.t.cb
.lf configure -labelwidget .lf.t.cb
-} -returnCodes 1 -result "can't *" -match glob \
+} -returnCodes error -result "can't *" -match glob \
-cleanup { destroy .lf.t } ;
test labelframe-2.2 "Can't use toplevel as labelwidget" -body {
toplevel .lf.t
.lf configure -labelwidget .lf.t
-} -returnCodes 1 -result "can't *" -match glob \
+} -returnCodes error -result "can't *" -match glob \
-cleanup { destroy .lf.t } ;
test labelframe-2.3 "Can't use non-windows as -labelwidget" -body {
.lf configure -labelwidget BogusWindowName
-} -returnCodes 1 -result {bad window path name "BogusWindowName"}
+} -returnCodes error -result {bad window path name "BogusWindowName"}
test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body {
.lf configure -labelwidget .nosuchwindow
-} -returnCodes 1 -result {bad window path name ".nosuchwindow"}
+} -returnCodes error -result {bad window path name ".nosuchwindow"}
###
# See also series labelframe-4.x
#
-test labelframe-3.1 "Add child slave" -body {
+test labelframe-3.1 "Add child content" -body {
checkbutton .lf.cb -text "abcde"
.lf configure -labelwidget .lf.cb
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 1 labelframe]
-test labelframe-3.2 "Remove child slave" -body {
+test labelframe-3.2 "Remove child content" -body {
.lf configure -labelwidget {}
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 0 {}]
-test labelframe-3.3 "Re-add child slave" -body {
+test labelframe-3.3 "Re-add child content" -body {
.lf configure -labelwidget .lf.cb
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 1 labelframe]
-test labelframe-3.4 "Re-manage child slave" -body {
+test labelframe-3.4 "Re-manage child content" -body {
pack .lf.cb -side right
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] [.lf cget -labelwidget]
} -result [list 1 pack {}]
-test labelframe-3.5 "Re-add child slave" -body {
+test labelframe-3.5 "Re-add child content" -body {
.lf configure -labelwidget .lf.cb
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 1 labelframe]
-test labelframe-3.6 "Destroy child slave" -body {
+test labelframe-3.6 "Destroy child content" -body {
destroy .lf.cb
.lf cget -labelwidget
} -result {}
###
-# Re-run series labelframe-3.x with nonchild slaves.
+# Re-run series labelframe-3.x with nonchild content.
#
# @@@ ODDITY, 14 Nov 2005:
# @@@ labelframe-4.1 fails if .cb is a [checkbutton],
@@ -73,7 +74,7 @@ test labelframe-3.6 "Destroy child slave" -body {
# @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc
# @@@ (see manager.c r1.11). There's still probably a race condition in here.
#
-test labelframe-4.1 "Add nonchild slave" -body {
+test labelframe-4.1 "Add nonchild content" -body {
checkbutton .cb -text "abcde"
.lf configure -labelwidget .cb
update
@@ -81,32 +82,32 @@ test labelframe-4.1 "Add nonchild slave" -body {
} -result [list 1 1 labelframe]
-test labelframe-4.2 "Remove nonchild slave" -body {
+test labelframe-4.2 "Remove nonchild content" -body {
.lf configure -labelwidget {}
update;
list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb]
} -result [list 0 0 {}]
-test labelframe-4.3 "Re-add nonchild slave" -body {
+test labelframe-4.3 "Re-add nonchild content" -body {
.lf configure -labelwidget .cb
list [update; winfo viewable .cb] [winfo manager .cb]
} -result [list 1 labelframe]
-test labelframe-4.4 "Re-manage nonchild slave" -body {
+test labelframe-4.4 "Re-manage nonchild content" -body {
pack .cb -side right
list [update; winfo viewable .cb] \
[winfo manager .cb] \
[.lf cget -labelwidget]
} -result [list 1 pack {}]
-test labelframe-4.5 "Re-add nonchild slave" -body {
+test labelframe-4.5 "Re-add nonchild content" -body {
.lf configure -labelwidget .cb
list [update; winfo viewable .cb] \
[winfo manager .cb] \
[.lf cget -labelwidget]
} -result [list 1 labelframe .cb]
-test labelframe-4.6 "Destroy nonchild slave" -body {
+test labelframe-4.6 "Destroy nonchild content" -body {
destroy .cb
.lf cget -labelwidget
} -result {}
diff --git a/tests/ttk/layout.test b/tests/ttk/layout.test
index 52f44b4..5dfce9b 100644
--- a/tests/ttk/layout.test
+++ b/tests/ttk/layout.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test layout-1.1 "Size computations for mixed-orientation layouts" -body {
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
index ac63088..e58812a 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test notebook-1.0 "Setup" -body {
@@ -24,11 +25,11 @@ test notebook-1.3 "Cannot add toplevel" -body {
.nb add [toplevel .nb.t]
} -cleanup {
destroy .t.nb
-} -returnCodes 1 -match glob -result "can't add .nb.t*"
+} -returnCodes error -match glob -result "can't add .nb.t*"
test notebook-1.4 "Try to select bad tab" -body {
.nb select @6000,6000
-} -returnCodes 1 -match glob -result "* not found"
+} -returnCodes error -match glob -result "* not found"
#
# Now add stuff:
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test
index c1fc6ac..528d56b 100644
--- a/tests/ttk/panedwindow.test
+++ b/tests/ttk/panedwindow.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
proc propagate-geometry {} { update idletasks }
@@ -46,7 +47,7 @@ test panedwindow-1.7 "Make sure empty panedwindow still still doesn't crash" -bo
test panedwindow-1.8 "Re-forget pane" -body {
.pw forget .pw.f1
-} -returnCodes 1 -result ".pw.f1 is not managed by .pw"
+} -returnCodes error -result ".pw.f1 is not managed by .pw"
test panedwindow-1.end "Cleanup" -body {
destroy .pw
@@ -118,11 +119,11 @@ test panedwindow-3.0 "configure pane" -body {
test panedwindow-3.1 "configure pane -- errors" -body {
.pw pane 1 -weight -4
-} -returnCodes 1 -match glob -result "-weight must be nonnegative"
+} -returnCodes error -match glob -result "-weight must be nonnegative"
test panedwindow-3.2 "add pane -- errors" -body {
.pw add [ttk::label .pw.l] -weight -1
-} -returnCodes 1 -match glob -result "-weight must be nonnegative"
+} -returnCodes error -match glob -result "-weight must be nonnegative"
test panedwindow-3.end "cleanup" -body { destroy .pw }
@@ -146,7 +147,7 @@ test panedwindow-4.1 "forget" -body {
test panedwindow-4.2 "forget forgotten" -body {
.pw forget .pw.l1
-} -returnCodes 1 -result ".pw.l1 is not managed by .pw"
+} -returnCodes error -result ".pw.l1 is not managed by .pw"
# checkorder $winlist --
# Ensure that Y coordinates windows in $winlist are strictly increasing.
@@ -262,7 +263,7 @@ test paned-propagation-1 "Initial request size" -body {
list [winfo reqwidth .pw] [winfo reqheight .pw]
} -result [list 100 105]
-test paned-propagation-2 "Slave change before map" -body {
+test paned-propagation-2 "Pane change before map" -body {
.pw.f1 configure -width 200 -height 100
propagate-geometry
list [winfo reqwidth .pw] [winfo reqheight .pw]
@@ -274,13 +275,13 @@ test paned-propagation-3 "Map window" -body {
list [winfo width .pw] [winfo height .pw] [.pw sashpos 0]
} -result [list 200 155 100]
-test paned-propagation-4 "Slave change after map, off-axis" -body {
+test paned-propagation-4 "Pane change after map, off-axis" -body {
.pw.f1 configure -width 100 ;# should be granted
propagate-geometry
list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0]
} -result [list 100 155 100]
-test paned-propagation-5 "Slave change after map, on-axis" -body {
+test paned-propagation-5 "Pane change after map, on-axis" -body {
.pw.f1 configure -height 50 ;# should be denied
propagate-geometry
list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0]
diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test
index 7c888c6..8e2fdb9 100644
--- a/tests/ttk/progressbar.test
+++ b/tests/ttk/progressbar.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
@@ -76,7 +77,7 @@ test progressbar-2.5 "error in write trace" -body {
trace variable PB w { error "YIPES!" ;# }
.pb step
set PB ;# NOTREACHED
-} -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!"
+} -cleanup { unset PB } -returnCodes error -match glob -result "*YIPES!"
test progressbar-end "Cleanup" -body {
destroy .pb
diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test
index ba02954..09abcb8 100644
--- a/tests/ttk/radiobutton.test
+++ b/tests/ttk/radiobutton.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test radiobutton-1.1 "Radiobutton check" -body {
diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test
index 443687a..75d11e7 100644
--- a/tests/ttk/scrollbar.test
+++ b/tests/ttk/scrollbar.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}]
@@ -70,7 +71,7 @@ test scrollbar-1.3 "Change orientation" -body {
expr {$h < $w}
} -result 1
-test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -yscrollcommand {.s set}] -side left
@@ -84,22 +85,8 @@ test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -
} -cleanup {
destroy .t .s
} -result {5.0}
-test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -yscrollcommand {.s set}] -side left
- for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
- pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
- update
- focus -force .s
- event generate .s <MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {5.0}
-test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -113,21 +100,7 @@ test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constr
} -cleanup {
destroy .t .s
} -result {1.4}
-test scrollbar-10.2.2 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -xscrollcommand {.s set} -wrap none] -side top
- for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
- pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
- update
- focus -force .s
- event generate .s <Shift-MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {1.4}
-test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2.2 {<MouseWheel> event on horizontal scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -141,20 +114,6 @@ test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints
} -cleanup {
destroy .t .s
} -result {1.4}
-test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -xscrollcommand {.s set} -wrap none] -side top
- for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
- pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
- update
- focus -force .s
- event generate .s <MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {1.4}
#
# Scale tests:
@@ -165,7 +124,7 @@ test scale-1.0 "Self-destruction" -body {
ttk::scale .s -variable v
pack .s ; update
.s set 1 ; update
-} -returnCodes 1 -match glob -result "*"
+} -returnCodes error -match glob -result "*"
test scale-2.1 "-state option" -setup {
ttk::scale .s
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
index 38bae14..673f3bf 100644
--- a/tests/ttk/spinbox.test
+++ b/tests/ttk/spinbox.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test spinbox-1.0 "Spinbox tests -- setup" -body {
@@ -126,7 +127,7 @@ test spinbox-1.8.2 "option -validate" -setup {
.sb cget -validate
} -cleanup {
destroy .sb
-} -result {none}
+} -result none
test spinbox-1.8.3 "option -validate" -setup {
ttk::spinbox .sb -from 0 -to 100
@@ -148,7 +149,7 @@ test spinbox-1.8.4 "-validate option: " -setup {
set ::spinbox_test
} -cleanup {
destroy .sb
-} -result {50}
+} -result 50
test spinbox-2.0 "current command -- unset should be 0" -constraints nyi -setup {
@@ -204,22 +205,85 @@ test spinbox-3.0 "textarea should expand to fill widget" -setup {
set ::spinbox_test {}
ttk::spinbox .sb -from 0 -to 10 -textvariable SBV
} -body {
- grid .sb -sticky ew
grid columnconfigure . 0 -weight 1
+ update idletasks
+ set timer [after 500 {set ::spinbox_test timedout}]
bind . <Map> {
after idle {
wm geometry . "210x80"
- after 100 {set ::spinbox_test [.sb identify element 5 5]}
+ update idletasks
+ set ::spinbox_test [.sb identify element 25 5]
}
bind . <Map> {}
}
- after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
+ grid .sb -sticky ew
+ vwait ::spinbox_test
set ::spinbox_test
} -cleanup {
destroy .sb
unset -nocomplain ::spinbox_test SBV
} -result {textarea}
+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 {
+ 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 one two one six two 5 4 three two one six}
+
+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 {
+ .sb set three
+ set ::spinbox_test [.sb get]
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Increment>>
+ lappend ::spinbox_test [.sb get]
+ }
+ .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]
+ }
+ set ::spinbox_test
+} -cleanup {
+ 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
#
diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test
index fd3a0c5..d7fa23a 100644
--- a/tests/ttk/treetags.test
+++ b/tests/ttk/treetags.test
@@ -1,6 +1,7 @@
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
### treeview tag invariants:
@@ -170,7 +171,7 @@ test treetags-2.3 "Virtual events delivered to focus item" -body {
test treetags-2.4 "Bad events" -body {
$tv tag bind bad <Enter> { puts "Entered!" }
-} -returnCodes 1 -result "unsupported event <Enter>*" -match glob
+} -returnCodes error -result "unsupported event <Enter>*" -match glob
test treetags-3.0 "tag configure - set" -body {
$tv tag configure tag1 -foreground blue -background red
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index 43dd249..8e31fe9 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -3,8 +3,9 @@
# what it currently does)
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
# consistencyCheck --
@@ -45,33 +46,33 @@ test treeview-1.1 "columns" -body {
test treeview-1.2 "Bad columns" -body {
#.tv configure -columns {illegal "list"value}
ttk::treeview .badtv -columns {illegal "list"value}
-} -returnCodes 1 -result "list element in quotes followed by*" -match glob
+} -returnCodes error -result "list element in quotes followed by*" -match glob
test treeview-1.3 "bad displaycolumns" -body {
.tv configure -displaycolumns {a b d}
-} -returnCodes 1 -result "Invalid column index d"
+} -returnCodes error -result "Invalid column index d"
test treeview-1.4 "more bad displaycolumns" -body {
.tv configure -displaycolumns {1 2 3}
-} -returnCodes 1 -result "Column index 3 out of bounds"
+} -returnCodes error -result "Column index 3 out of bounds"
test treeview-1.5 "Don't forget to check negative numbers" -body {
.tv configure -displaycolumns {1 -2 3}
-} -returnCodes 1 -result "Column index -2 out of bounds"
+} -returnCodes error -result "Column index -2 out of bounds"
# Item creation.
#
test treeview-2.1 "insert -- not enough args" -body {
.tv insert
-} -returnCodes 1 -result "wrong # args: *" -match glob
+} -returnCodes error -result "wrong # args: *" -match glob
test treeview-2.3 "insert -- bad integer index" -body {
.tv insert {} badindex
-} -returnCodes 1 -result "expected integer *" -match glob
+} -returnCodes error -result "expected integer *" -match glob
test treeview-2.4 "insert -- bad parent node" -body {
.tv insert badparent end
-} -returnCodes 1 -result "Item badparent not found" -match glob
+} -returnCodes error -result "Item badparent not found" -match glob
test treeview-2.5 "insert -- finaly insert a node" -body {
.tv insert {} end -id newnode -text "New node"
@@ -83,7 +84,7 @@ test treeview-2.6 "insert -- make sure node was inserted" -body {
test treeview-2.7 "insert -- prevent duplicate node names" -body {
.tv insert {} end -id newnode
-} -returnCodes 1 -result "Item newnode already exists"
+} -returnCodes error -result "Item newnode already exists"
test treeview-2.8 "insert -- new node at end" -body {
.tv insert {} end -id lastnode
@@ -125,7 +126,7 @@ test treeview-2.13 "insert -- one more at beginning" -body {
test treeview-2.14 "insert -- bad options" -body {
.tv insert {} end -badoption foo
-} -returnCodes 1 -result {unknown option "-badoption"}
+} -returnCodes error -result {unknown option "-badoption"}
test treeview-2.15 "insert -- at position 0 w/no children" -body {
.tv insert newnode 0 -id newnode.n2 -text "Foo"
@@ -201,7 +202,7 @@ test treeview-3.11 "Can't detach root item" -body {
.tv detach [list {}]
update
consistencyCheck .tv
-} -returnCodes 1 -result "Cannot detach root item"
+} -returnCodes error -result "Cannot detach root item"
consistencyCheck .tv
test treeview-3.12 "Reattach" -body {
@@ -274,7 +275,7 @@ test treeview-4.3 "opened - closed node" -body {
test treeview-5.1 "item -- error checks" -body {
.tv item newnode -text "Bad values" -values "{bad}list"
-} -returnCodes 1 -result "list element in braces followed by*" -match glob
+} -returnCodes error -result "list element in braces followed by*" -match glob
test treeview-5.2 "item -- error leaves options unchanged " -body {
.tv item newnode -text
@@ -297,11 +298,11 @@ test treeview-5.5 "set cell" -body {
test treeview-5.6 "set illegal cell" -body {
.tv set newnode #0 YYY
-} -returnCodes 1 -result "Display column #0 cannot be set"
+} -returnCodes error -result "Display column #0 cannot be set"
test treeview-5.7 "set illegal cell" -body {
.tv set newnode 3 YY ;# 3 == current #columns
-} -returnCodes 1 -result "Column index 3 out of bounds"
+} -returnCodes error -result "Column index 3 out of bounds"
test treeview-5.8 "set display columns" -body {
.tv configure -displaycolumns [list 2 1 0]
@@ -317,7 +318,7 @@ test treeview-5.9 "display columns part 2" -body {
test treeview-5.10 "cannot set column -id" -body {
.tv column #1 -id X
-} -returnCodes 1 -result "Attempt to change read-only option"
+} -returnCodes error -result "Attempt to change read-only option"
test treeview-5.11 "get" -body {
.tv set newnode #1
@@ -405,7 +406,7 @@ test treeview-7.1 "move" -body {
test treeview-7.2 "illegal move" -body {
.tv move d d2 end
-} -returnCodes 1 -result "Cannot insert d as descendant of d2"
+} -returnCodes error -result "Cannot insert d as descendant of d2"
test treeview-7.3 "illegal move has no effect" -body {
consistencyCheck .tv
@@ -426,7 +427,7 @@ test treeview-7.5 "replace children - precondition" -body {
test treeview-7.6 "Replace children - illegal move" -body {
.tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3]
-} -returnCodes 1 -result "Cannot insert newnode.n1 as descendant of newnode.n1"
+} -returnCodes error -result "Cannot insert newnode.n1 as descendant of newnode.n1"
consistencyCheck .tv
@@ -457,7 +458,7 @@ test treeview-8.4 "Selection - clear" -body {
test treeview-8.5 "Selection - bad operation" -body {
.tv selection badop foo
-} -returnCodes 1 -match glob -result {bad selection operation "badop": must be *}
+} -returnCodes error -match glob -result {bad selection operation "badop": must be *}
test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body {
.tv selection set {}
@@ -466,7 +467,7 @@ test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body {
.tv selection add newnode.n1
update
set res
-} -result {1}
+} -result 1
test treeview-8.7 "<<TreeviewSelect>> on selected item deletion" -body {
.tv selection set {}
@@ -560,7 +561,7 @@ test treeview-9.3 {scrolling on see command, requested item is closed} -setup {
expr $after < $before
} -cleanup {
destroy .top
-} -result {1}
+} -result 1
### identify tests:
#
diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test
index 53da18a..fdd3eae 100644
--- a/tests/ttk/ttk.test
+++ b/tests/ttk/ttk.test
@@ -1,6 +1,7 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
proc skip args {}
@@ -31,7 +32,7 @@ test ttk-6.1 "Self-destructing checkbutton" -body {
trace variable sd w [list selfdestruct .sd]
update
.sd invoke
-} -returnCodes 1
+} -returnCodes error
test ttk-6.2 "Checkbutton self-destructed" -body {
winfo exists .sd
} -result 0
@@ -145,7 +146,7 @@ test ttk-1.2 "Check style" -body {
test ttk-1.3 "Set bad style" -body {
.t configure -style "nosuchstyle"
-} -returnCodes 1 -result {Layout nosuchstyle not found}
+} -returnCodes error -result {Layout nosuchstyle not found}
test ttk-1.4 "Original style preserved" -body {
.t cget -style
@@ -234,11 +235,11 @@ foreach wc $widgetClasses {
# misc. error detection
test ttk-3.0 "Bad option" -body {
ttk::button .bad -badoption foo
-} -returnCodes 1 -result {unknown option "-badoption"} -match glob
+} -returnCodes error -result {unknown option "-badoption"} -match glob
test ttk-3.1 "Make sure widget command not created" -body {
.bad state disabled
-} -returnCodes 1 -result {invalid command name ".bad"} -match glob
+} -returnCodes error -result {invalid command name ".bad"} -match glob
test ttk-3.2 "Propagate errors from variable traces" -body {
set A 0
@@ -251,7 +252,7 @@ test ttk-3.2 "Propagate errors from variable traces" -body {
test ttk-3.3 "Constructor failure with cursor" -body {
ttk::button .b -cursor bottom_right_corner -style BadStyle
-} -returnCodes 1 -result "Layout BadStyle not found"
+} -returnCodes error -result "Layout BadStyle not found"
test ttk-3.4 "SF#2009213" -body {
ttk::style configure TScale -sliderrelief {}
@@ -387,12 +388,12 @@ test ttk-8.4 "ImageChanged" -body {
test ttk-9.1 "Traces on nonexistant namespaces" -body {
ttk::checkbutton .tcb -variable foo::bar
-} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
+} -returnCodes error -result "*parent namespace doesn't exist*" -match glob
test ttk-9.2 "Traces on nonexistant namespaces II" -body {
ttk::checkbutton .tcb -variable X
.tcb configure -variable foo::bar
-} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
+} -returnCodes error -result "*parent namespace doesn't exist*" -match glob
test ttk-9.3 "Restore saved options on configure error" -body {
.tcb cget -variable
@@ -457,7 +458,7 @@ test ttk-10.3 "Check class resource" -body {
test ttk-10.4 "Try to modify class resource" -body {
.f configure -class Bar
-} -returnCodes 1 -match glob -result "*read-only option*"
+} -returnCodes error -match glob -result "*read-only option*"
test ttk-10.5 "Check class resource again" -body {
.f cget -class
@@ -547,14 +548,14 @@ test ttk-12.4 "-borderwidth frame option" -body {
test ttk-13.1 "Custom styles -- bad -style option" -body {
ttk::button .tb1 -style badstyle
-} -returnCodes 1 -result "*badstyle not found*" -match glob
+} -returnCodes error -result "*badstyle not found*" -match glob
test ttk-13.4 "Custom styles -- bad -style option" -body {
ttk::button .tb1
.tb1 configure -style badstyle
} -cleanup {
destroy .tb1
-} -returnCodes 1 -result "*badstyle not found*" -match glob
+} -returnCodes error -result "*badstyle not found*" -match glob
test ttk-13.5 "Custom layouts -- missing element definition" -body {
ttk::style layout badstyle {
@@ -572,17 +573,17 @@ test ttk-13.5 "Custom layouts -- missing element definition" -body {
test ttk-14.1 "-variable in nonexistant namespace" -body {
ttk::checkbutton .tw -variable ::nsn::foo
-} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \
-match glob -cleanup { destroy .tw }
test ttk-14.2 "-textvariable in nonexistant namespace" -body {
ttk::label .tw -textvariable ::nsn::foo
-} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \
-match glob -cleanup { destroy .tw }
test ttk-14.3 "-textvariable in nonexistant namespace" -body {
ttk::entry .tw -textvariable ::nsn::foo
-} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \
-match glob -cleanup { destroy .tw }
test ttk-15.1 {Bug 3062331} -setup {
@@ -628,27 +629,27 @@ proc wrong#varargs {varpart args} {
test ttk-ensemble-0 "style element create: insufficient args" -body {
ttk::style
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs arg ttk::style option]
test ttk-ensemble-1 "style element create: insufficient args" -body {
ttk::style element
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs arg ttk::style element option]
test ttk-ensemble-2 "style element create: insufficient args" -body {
ttk::style element create
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs {-option value} ttk::style element create name type]
test ttk-ensemble-3 "style element create: insufficient args" -body {
ttk::style element create plain.background
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs {-option value} ttk::style element create name type]
test ttk-ensemble-4 "style element create: insufficient args" -body {
ttk::style element create plain.background from
-} -returnCodes 1 -result [wrong#args theme ?element?]
+} -returnCodes error -result [wrong#args theme ?element?]
test ttk-ensemble-5 "style element create: valid" -body {
ttk::style element create plain.background from default
diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test
index 5755943..5430903 100644
--- a/tests/ttk/validate.test
+++ b/tests/ttk/validate.test
@@ -3,8 +3,8 @@
## Derived from core test suite entry-19.1 through entry-19.20
##
-package require Tk 8.5
-package require tcltest 2.1
+package require Tk
+package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test
index bb88fef..ec4e9e7 100644
--- a/tests/ttk/vsapi.test
+++ b/tests/ttk/vsapi.test
@@ -1,12 +1,13 @@
# -*- tcl -*-
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
testConstraint xpnative \
- [expr {[lsearch -exact [ttk::style theme names] xpnative] != -1}]
+ [expr {"xpnative" in [ttk::style theme names]}]
test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints {xpnative} -body {
ttk::style element create smallclose vsapi \