diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/canvPs.test | 40 | ||||
-rw-r--r-- | tests/config.test | 2137 |
2 files changed, 1612 insertions, 565 deletions
diff --git a/tests/canvPs.test b/tests/canvPs.test index 68c3b68..7b566e5 100644 --- a/tests/canvPs.test +++ b/tests/canvPs.test @@ -6,12 +6,14 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: canvPs.test,v 1.12 2006/03/14 05:01:48 dgp Exp $ +# RCS: @(#) $Id: canvPs.test,v 1.13 2008/08/07 23:05:15 aniap Exp $ -package require tcltest 2.1 +package require tcltest 2.2 +namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +# canvas used in 1.* and 2.* test cases canvas .c -width 400 -height 300 -bd 2 -relief sunken .c create rectangle 20 20 80 80 -fill red pack .c @@ -45,6 +47,7 @@ test canvPs-1.2 {test writing to a file, idempotency} -constraints { removeFile bar.ps } -result ok + test canvPs-2.1 {test writing to a channel} -constraints { unixOrPc } -setup { @@ -77,7 +80,7 @@ test canvPs-2.2 {test writing to channel, idempotency} -constraints { close $c2 set status ok if {[file size $bar] != [file size $foo]} { - set status broken + set status broken } set status } -cleanup { @@ -99,7 +102,7 @@ test canvPs-2.3 {test writing to channel and file, same output} -constraints { .c postscript -file $bar set status ok if {[file size $foo] != [file size $bar]} { - set status broken + set status broken } set status } -cleanup { @@ -121,21 +124,22 @@ test canvPs-2.4 {test writing to channel and file, same output} -constraints { .c postscript -file $bar set status ok if {[file size $foo] != [file size $bar]} { - set status broken + set status broken } set status } -cleanup { removeFile foo.ps removeFile bar.ps } -result ok +destroy .c + -test canvPs-3.1 {test ps generation with an embedded window} -setup { +test canvPs-3.1 {test ps generation with an embedded window} -constraints { + notAqua +} -setup { set bar [makeFile {} bar.ps] file delete $bar -} -constraints { - notAqua } -body { - destroy .c pack [canvas .c -width 200 -height 200 -background white] .c create rect 20 20 150 150 -tags rect0 -dash . -width 2 .c create arc 0 50 200 200 -tags arc0 \ @@ -152,13 +156,13 @@ test canvPs-3.1 {test ps generation with an embedded window} -setup { .c postscript -file $bar file exists $bar } -cleanup { + destroy .c removeFile bar.ps -} -result 1 +} -result {1} test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup { set bar [makeFile {} bar.ps] file delete $bar } -body { - destroy .c pack [canvas .c -width 200 -height 200 -background white] entry .c.e -background pink -foreground blue -width 14 .c.e insert 0 "we gonna be postscripted" @@ -166,15 +170,19 @@ test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup { .c postscript -file $bar file exists $bar } -cleanup { + destroy .c removeFile bar.ps -} -result 1 +} -result {1} -test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} {} { - destroy .c + +test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} -body { pack [canvas .c] .c create poly 10 20 10 20 - catch {.c postscript} -} 0 + .c postscript +} -cleanup { + destroy .c +} -returnCodes ok -match glob -result * + # cleanup unset -nocomplain foo bar diff --git a/tests/config.test b/tests/config.test index f27bb8d..fca6d5c 100644 --- a/tests/config.test +++ b/tests/config.test @@ -6,9 +6,10 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: config.test,v 1.8 2004/06/17 22:38:57 dkf Exp $ +# RCS: @(#) $Id: config.test,v 1.9 2008/08/07 23:05:15 aniap Exp $ -package require tcltest 2.1 +package require tcltest 2.2 +namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands @@ -16,436 +17,1038 @@ proc killTables {} { # Note: it's important to delete chain2 before chain1, because # chain2 depends on chain1. If chain1 is deleted first, the # delete of chain2 will crash. - + deleteWindows foreach t {alltypes chain2 chain1 configerror internal new notenoughparams twowindows} { - while {[testobjconfig info $t] != ""} { - testobjconfig delete $t - } + while {[testobjconfig info $t] != ""} { + testobjconfig delete $t + } } } + +option clear +deleteWindows if {[testConstraint testobjconfig]} { killTables } -test config-1.1 {Tk_CreateOptionTable - reference counts} testobjconfig { - deleteWindows - killTables +test config-1.1 {Tk_CreateOptionTable - reference counts} -constraints { + testobjconfig +} -body { set x {} testobjconfig alltypes .a lappend x [testobjconfig info alltypes] testobjconfig alltypes .b lappend x [testobjconfig info alltypes] - deleteWindows set x -} {{1 16 -boolean} {2 16 -boolean}} -test config-1.2 {Tk_CreateOptionTable - synonym initialization} testobjconfig { - deleteWindows +} -cleanup { + killTables +} -result {{1 16 -boolean} {2 16 -boolean}} +test config-1.2 {Tk_CreateOptionTable - synonym initialization} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a -synonym green .a cget -color -} {green} -test config-1.3 {Tk_CreateOptionTable - option database initialization} testobjconfig { - deleteWindows - option clear +} -cleanup { + killTables +} -result {green} +test config-1.3 {Tk_CreateOptionTable - option database initialization} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a option add *b.string different testobjconfig alltypes .b list [.a cget -string] [.b cget -string] -} {foo different} -test config-1.4 {Tk_CreateOptionTable - option database initialization} testobjconfig { - deleteWindows +} -cleanup { + killTables option clear +} -result {foo different} +test config-1.4 {Tk_CreateOptionTable - option database initialization} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a option add *b.String bar testobjconfig alltypes .b list [.a cget -string] [.b cget -string] -} {foo bar} -test config-1.5 {Tk_CreateOptionTable - default initialization} testobjconfig { - deleteWindows +} -cleanup { + killTables + option clear +} -result {foo bar} +test config-1.5 {Tk_CreateOptionTable - default initialization} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a .a cget -relief -} {raised} -test config-1.6 {Tk_CreateOptionTable - chained tables} testobjconfig { - deleteWindows +} -cleanup { killTables +} -result {raised} +test config-1.6 {Tk_CreateOptionTable - chained tables} -constraints { + testobjconfig +} -body { testobjconfig chain1 .a testobjconfig chain2 .b testobjconfig info chain2 -} {1 4 -three 2 2 -one} -test config-1.7 {Tk_CreateOptionTable - chained tables} testobjconfig { - deleteWindows +} -cleanup { killTables +} -result {1 4 -three 2 2 -one} +test config-1.7 {Tk_CreateOptionTable - chained tables} -constraints { + testobjconfig +} -body { testobjconfig chain2 .b testobjconfig chain1 .a testobjconfig info chain2 -} {1 4 -three 2 2 -one} -test config-1.8 {Tk_CreateOptionTable - chained tables} testobjconfig { - deleteWindows +} -cleanup { + killTables +} -result {1 4 -three 2 2 -one} +test config-1.8 {Tk_CreateOptionTable - chained tables} -constraints { + testobjconfig +} -body { testobjconfig chain1 .a testobjconfig chain2 .b - list [catch {.a cget -four} msg] $msg [.a cget -one] \ - [.b cget -four] [.b cget -one] -} {1 {unknown option "-four"} one four one} - -test config-2.1 {Tk_DeleteOptionTable - reference counts} testobjconfig { - deleteWindows + .a cget -four +} -cleanup { killTables +} -returnCodes error -result {unknown option "-four"} +test config-1.9 {Tk_CreateOptionTable - chained tables} -constraints { + testobjconfig +} -body { + testobjconfig chain1 .a + testobjconfig chain2 .b + catch {.a cget -four} + list [.a cget -one] [.b cget -four] [.b cget -one] +} -cleanup { + killTables +} -result {one four one} + + +test config-2.1 {Tk_DeleteOptionTable - reference counts} -constraints { + testobjconfig +} -body { + set x {} testobjconfig chain1 .a testobjconfig chain2 .b testobjconfig chain2 .c deleteWindows - set x {} testobjconfig delete chain2 lappend x [testobjconfig info chain2] [testobjconfig info chain1] testobjconfig delete chain2 lappend x [testobjconfig info chain2] [testobjconfig info chain1] -} {{1 4 -three 2 2 -one} {2 2 -one} {} {1 2 -one}} +} -cleanup { + killTables +} -result {{1 4 -three 2 2 -one} {2 2 -one} {} {1 2 -one}} # No tests for DestroyOptionHashTable; couldn't figure out how to test. -test config-3.1 {Tk_InitOptions - priority of chained tables} testobjconfig { - deleteWindows +test config-3.1 {Tk_InitOptions - priority of chained tables} -constraints { + testobjconfig +} -body { testobjconfig chain1 .a testobjconfig chain2 .b list [.a cget -two] [.b cget -two] -} {two {two and a half}} -test config-3.2 {Tk_InitOptions - initialize from database} testobjconfig { - deleteWindows - option clear +} -cleanup { + killTables +} -result {two {two and a half}} +test config-3.2 {Tk_InitOptions - initialize from database} -constraints { + testobjconfig +} -body { option add *a.color blue testobjconfig alltypes .a list [.a cget -color] -} {blue} -test config-3.3 {Tk_InitOptions - initialize from database} testobjconfig { - deleteWindows +} -cleanup { + killTables option clear +} -result {blue} +test config-3.3 {Tk_InitOptions - initialize from database} -constraints { + testobjconfig +} -body { option add *a.justify bogus testobjconfig alltypes .a list [.a cget -justify] -} {left} -test config-3.4 {Tk_InitOptions - initialize from widget class} testobjconfig { - deleteWindows +} -cleanup { + killTables + option clear +} -result {left} +test config-3.4 {Tk_InitOptions - initialize from widget class} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a list [.a cget -color] -} {red} -test config-3.5 {Tk_InitOptions - no initial value} testobjconfig { - deleteWindows +} -cleanup { + killTables +} -result {red} +test config-3.5 {Tk_InitOptions - no initial value} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a .a cget -anchor -} {} -test config-3.6 {Tk_InitOptions - bad initial value} testobjconfig { - deleteWindows +} -cleanup { + killTables +} -result {} +test config-3.6 {Tk_InitOptions - bad initial value} -constraints { + testobjconfig +} -body { + option add *a.color non-existent + testobjconfig alltypes .a +} -cleanup { + killTables option clear +} -returnCodes error -result {unknown color name "non-existent"} +test config-3.7 {Tk_InitOptions - bad initial value} -constraints { + testobjconfig +} -body { option add *a.color non-existent - list [catch {testobjconfig alltypes .a} msg] $msg $errorInfo -} {1 {unknown color name "non-existent"} {unknown color name "non-existent" + catch {testobjconfig alltypes .a} + return $errorInfo +} -cleanup { + killTables + option clear +} -result {unknown color name "non-existent" (database entry for "-color" in widget ".a") invoked from within -"testobjconfig alltypes .a"}} -option clear -test config-3.7 {Tk_InitOptions - bad initial value} testobjconfig { - deleteWindows - list [catch {testobjconfig configerror} msg] $msg $errorInfo -} {1 {expected integer but got "bogus"} {expected integer but got "bogus" +"testobjconfig alltypes .a"} + +test config-3.8 {Tk_InitOptions - bad initial value} -constraints { + testobjconfig +} -body { + testobjconfig configerror +} -returnCodes error -result {expected integer but got "bogus"} +test config-3.9 {Tk_InitOptions - bad initial value} -constraints { + testobjconfig +} -body { + catch {testobjconfig configerror} + return $errorInfo +} -result {expected integer but got "bogus" (default value for "-int") invoked from within -"testobjconfig configerror"}} -option clear +"testobjconfig configerror"} -test config-4.1 {DoObjConfig - boolean} testobjconfig { +test config-4.1 {DoObjConfig - boolean} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -boolean 0 +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.2 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -boolean 0} msg] $msg [catch {.foo cget -boolean} result] $result [catch {rename .foo {}}] -} {0 .foo 0 0 0} -test config-4.2 {DoObjConfig - boolean} testobjconfig { +} -body { + testobjconfig alltypes .foo -boolean 0 + .foo cget -boolean +} -cleanup { + killTables +} -returnCodes ok -result {0} +test config-4.3 {DoObjConfig - boolean} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -boolean 0 + .foo cget -boolean + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.4 {DoObjConfig - boolean} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -boolean 1 +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.5 {DoObjConfig - boolean} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -boolean 1 + .foo cget -boolean +} -cleanup { + killTables +} -returnCodes ok -result {1} +test config-4.6 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -boolean 1} msg] $msg [catch {.foo cget -boolean} result] $result [catch {rename .foo {}}] -} {0 .foo 0 1 0} -test config-4.3 {DoObjConfig - invalid boolean} testobjconfig { +} -body { + testobjconfig alltypes .foo -boolean 1 + .foo cget -boolean + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.7 {DoObjConfig - invalid boolean} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -boolean {}} msg] $msg -} {1 {expected boolean value but got ""}} -test config-4.4 {DoObjConfig - boolean internal value} testobjconfig { +} -body { + testobjconfig alltypes .foo -boolean {} +} -cleanup { + killTables +} -returnCodes error -result {expected boolean value but got ""} +test config-4.8 {DoObjConfig - boolean internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -boolean 0 .foo cget -boolean -} {0} -test config-4.5 {DoObjConfig - integer} testobjconfig { +} -cleanup { + killTables +} -result {0} + +test config-4.9 {DoObjConfig - integer} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -integer 3} msg] $msg [catch {.foo cget -integer} result] $result [catch {rename .foo {}}] -} {0 .foo 0 3 0} -test config-4.6 {DoObjConfig - invalid integer} testobjconfig { +} -body { + testobjconfig alltypes .foo -integer 3 +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.10 {DoObjConfig - integer} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -integer bar} msg] $msg -} {1 {expected integer but got "bar"}} -test config-4.7 {DoObjConfig - integer internal value} testobjconfig { +} -body { + testobjconfig alltypes .foo -integer 3 + .foo cget -integer +} -cleanup { + killTables +} -returnCodes ok -result {3} +test config-4.11 {DoObjConfig - integer} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -integer 3 + .foo cget -integer + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.12 {DoObjConfig - invalid integer} -constraints { + testobjconfig +} -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -integer bar +} -cleanup { + killTables +} -cleanup { + killTables +} -returnCodes error -result {expected integer but got "bar"} +test config-4.13 {DoObjConfig - integer internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -integer 421 .foo cget -integer -} {421} -test config-4.8 {DoObjConfig - double} testobjconfig { +} -cleanup { + killTables +} -result {421} + +test config-4.14 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -double 3.14} msg] $msg [catch {.foo cget -double} result] $result [catch {rename .foo {}}] -} {0 .foo 0 3.14 0} -test config-4.9 {DoObjConfig - invalid double} testobjconfig { +} -body { + testobjconfig alltypes .foo -double 3.14 +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.15 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -double bar} msg] $msg -} {1 {expected floating-point number but got "bar"}} -test config-4.10 {DoObjConfig - double internal value} testobjconfig { +} -body { + testobjconfig alltypes .foo -double 3.14 + .foo cget -double +} -cleanup { + killTables +} -returnCodes ok -result {3.14} +test config-4.16 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -double 3.14 + .foo cget -double + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.17 {DoObjConfig - invalid double} -constraints { + testobjconfig +} -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -double bar +} -cleanup { + killTables +} -returnCodes error -result {expected floating-point number but got "bar"} +test config-4.18 {DoObjConfig - double internal value} -constraints { + testobjconfig +} -setup { + catch {rename .foo {}} +} -body { testobjconfig internal .foo -double 62.75 .foo cget -double -} {62.75} -test config-4.11 {DoObjConfig - string} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -string test} msg] $msg [catch {.foo cget -string} result] $result [destroy .foo] -} {0 .foo 0 test {}} -test config-4.12 {DoObjConfig - null string} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -string {}} msg] $msg [catch {.foo cget -string} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.13 {DoObjConfig - string internal value} testobjconfig { +} -cleanup { + killTables +} -result {62.75} + +test config-4.19 {DoObjConfig - string} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -string test +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.20 {DoObjConfig - string} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -string test + .foo cget -string +} -cleanup { + killTables +} -returnCodes ok -result {test} +test config-4.21 {DoObjConfig - string} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -string test + .foo cget -string + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.22 {DoObjConfig - null string} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -string {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.23 {DoObjConfig - null string} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -string {} + .foo cget -string +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.24 {DoObjConfig - null string} -constraints testobjconfig -setup { catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -string {} + .foo cget -string + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok + +test config-4.25 {DoObjConfig - string internal value} -constraints { + testobjconfig +} -setup { + catch {rename .foo {}} +} -body { testobjconfig internal .foo -string "this is a test" .foo cget -string -} {this is a test} -test config-4.14 {DoObjConfig - string table} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -stringtable two} msg] $msg [catch {.foo cget -stringtable} result] $result [destroy .foo] -} {0 .foo 0 two {}} -test config-4.15 {DoObjConfig - invalid string table} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -stringtable foo} msg] $msg -} {1 {bad stringtable "foo": must be one, two, three, or four}} -test config-4.16 {DoObjConfig - new string table} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {this is a test} + +test config-4.26 {DoObjConfig - string table} -constraints testobjconfig -body { + testobjconfig alltypes .foo -stringtable two +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.27 {DoObjConfig - string table} -constraints testobjconfig -body { + testobjconfig alltypes .foo -stringtable two + .foo cget -stringtable +} -cleanup { + killTables +} -returnCodes ok -result {two} +test config-4.28 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two - list [catch {.foo configure -stringtable three} msg] $msg [catch {.foo cget -stringtable} result] $result [destroy .foo] -} {0 16 0 three {}} -test config-4.17 {DoObjConfig - stringtable internal value} testobjconfig { + .foo cget -stringtable + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.29 {DoObjConfig - invalid string table} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -stringtable foo +} -cleanup { + killTables +} -returnCodes error -result {bad stringtable "foo": must be one, two, three, or four} + +test config-4.30 {DoObjConfig - new string table} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -stringtable two + .foo configure -stringtable three +} -cleanup { + killTables +} -returnCodes ok -result {16} +test config-4.31 {DoObjConfig - new string table} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -stringtable two + .foo configure -stringtable three + .foo cget -stringtable +} -cleanup { + killTables +} -returnCodes ok -result {three} +test config-4.32 {DoObjConfig - new string table} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -stringtable two + .foo configure -stringtable three + .foo cget -stringtable + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.33 {DoObjConfig - stringtable internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -stringtable "four" .foo cget -stringtable -} {four} -test config-4.18 {DoObjConfig - color} testobjconfig { - catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -color blue} msg] $msg [catch {.foo cget -color} result] $result [destroy .foo] -} {0 .foo 0 blue {}} -test config-4.19 {DoObjConfig - invalid color} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -color xxx} msg] $msg -} {1 {unknown color name "xxx"}} -test config-4.20 {DoObjConfig - color internal value} testobjconfig { +} -cleanup { + killTables +} -result {four} + +test config-4.34 {DoObjConfig - color} -constraints testobjconfig -body { + testobjconfig alltypes .foo -color blue +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.35 {DoObjConfig - color} -constraints testobjconfig -body { + testobjconfig alltypes .foo -color blue + .foo cget -color +} -cleanup { + killTables +} -returnCodes ok -result {blue} +test config-4.36 {DoObjConfig - color} -constraints testobjconfig -body { + testobjconfig alltypes .foo -color blue + .foo cget -color + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.37 {DoObjConfig - invalid color} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -color xxx +} -cleanup { + killTables +} -returnCodes error -result {unknown color name "xxx"} +test config-4.38 {DoObjConfig - color internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -color purple .foo cget -color -} {purple} -test config-4.21 {DoObjConfig - null color} testobjconfig { - catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -color {}} msg] $msg [catch {.foo cget -color} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.22 {DoObjConfig - getting rid of old color} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {purple} + +test config-4.39 {DoObjConfig - null color} -constraints testobjconfig -body { + testobjconfig alltypes .foo -color {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.40 {DoObjConfig - null color} -constraints testobjconfig -body { + testobjconfig alltypes .foo -color {} + .foo cget -color +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.41 {DoObjConfig - null color} -constraints testobjconfig -body { + testobjconfig alltypes .foo -color {} + .foo cget -color + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok +test config-4.42 {DoObjConfig - getting rid of old color} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo -color #333333 - list [catch {.foo configure -color #444444} msg] $msg [catch {.foo cget -color} result] $result [destroy .foo] -} {0 32 0 #444444 {}} -test config-4.23 {DoObjConfig - font} testobjconfig { + .foo configure -color #444444 +} -cleanup { + killTables +} -returnCodes ok -result {32} +test config-4.43 {DoObjConfig - getting rid of old color} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -color #333333 + .foo configure -color #444444 + .foo cget -color +} -cleanup { + killTables +} -returnCodes ok -result {#444444} +test config-4.44 {DoObjConfig - getting rid of old color} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -color #333333 + .foo configure -color #444444 + .foo cget -color + rename .foo {} +} -cleanup { + killTables +} -returnCodes ok + +test config-4.45 {DoObjConfig - font} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -font {Helvetica 72} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.46 {DoObjConfig - font} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -font {Helvetica 72}} msg] $msg [catch {.foo cget -font} result] $result [destroy .foo] -} {0 .foo 0 {Helvetica 72} {}} -test config-4.24 {DoObjConfig - new font} testobjconfig { +} -body { + testobjconfig alltypes .foo -font {Helvetica 72} + .foo cget -font +} -cleanup { + killTables +} -returnCodes ok -result {Helvetica 72} +test config-4.47 {DoObjConfig - new font} -constraints testobjconfig -setup { catch {rename .foo {}} +} -body { testobjconfig alltypes .foo -font {Courier 12} - list [catch {.foo configure -font {Helvetica 72}} msg] $msg [catch {.foo cget -font} result] $result [destroy .foo] -} {0 64 0 {Helvetica 72} {}} -test config-4.25 {DoObjConfig - invalid font} testobjconfig { + .foo configure -font {Helvetica 72} +} -cleanup { + killTables +} -returnCodes ok -result {64} +test config-4.48 {DoObjConfig - new font} -constraints testobjconfig -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -font {Helvetica 12 foo}} msg] $msg -} {1 {unknown font style "foo"}} -test config-4.26 {DoObjConfig - null font} testobjconfig { +} -body { + testobjconfig alltypes .foo -font {Courier 12} + .foo configure -font {Helvetica 72} + .foo cget -font +} -cleanup { + killTables +} -returnCodes ok -result {Helvetica 72} +test config-4.49 {DoObjConfig - invalid font} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -font {}} msg] $msg [catch {.foo cget -font} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.27 {DoObjConfig - font internal value} testobjconfig { +} -body { + testobjconfig alltypes .foo -font {Helvetica 12 foo} +} -cleanup { + killTables +} -returnCodes error -result {unknown font style "foo"} +test config-4.50 {DoObjConfig - null font} -constraints testobjconfig -setup { catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -font {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.51 {DoObjConfig - null font} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -font {} + .foo cget -font +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.52 {DoObjConfig - font internal value} -constraints { + testobjconfig +} -setup { + catch {rename .foo {}} +} -body { testobjconfig internal .foo -font {Times 16} .foo cget -font -} {Times 16} -test config-4.28 {DoObjConfig - bitmap} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -bitmap gray75} msg] $msg [catch {.foo cget -bitmap} result] $result [destroy .foo] -} {0 .foo 0 gray75 {}} -test config-4.29 {DoObjConfig - new bitmap} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {Times 16} + +test config-4.53 {DoObjConfig - bitmap} -constraints testobjconfig -body { + testobjconfig alltypes .foo -bitmap gray75 +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.54 {DoObjConfig - bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 - list [catch {.foo configure -bitmap gray50} msg] $msg [catch {.foo cget -bitmap} result] $result [destroy .foo] -} {0 128 0 gray50 {}} -test config-4.30 {DoObjConfig - invalid bitmap} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -bitmap foo} msg] $msg -} {1 {bitmap "foo" not defined}} -test config-4.31 {DoObjConfig - null bitmap} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -bitmap {}} msg] $msg [catch {.foo cget -bitmap} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.32 {DoObjConfig - bitmap internal value} testobjconfig { + .foo cget -bitmap +} -cleanup { + killTables +} -returnCodes ok -result {gray75} +test config-4.55 {DoObjConfig - new bitmap} -constraints testobjconfig -body { + testobjconfig alltypes .foo -bitmap gray75 + .foo configure -bitmap gray50 +} -cleanup { + killTables +} -returnCodes ok -result {128} +test config-4.56 {DoObjConfig - new bitmap} -constraints testobjconfig -body { + testobjconfig alltypes .foo -bitmap gray75 + .foo configure -bitmap gray50 + .foo cget -bitmap +} -cleanup { + killTables +} -returnCodes ok -result {gray50} +test config-4.57 {DoObjConfig - invalid bitmap} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -bitmap foo +} -cleanup { + killTables +} -returnCodes error -result {bitmap "foo" not defined} +test config-4.58 {DoObjConfig - null bitmap} -constraints testobjconfig -body { + testobjconfig alltypes .foo -bitmap {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.59 {DoObjConfig - null bitmap} -constraints testobjconfig -body { + testobjconfig alltypes .foo -bitmap {} + .foo cget -bitmap +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.60 {DoObjConfig - bitmap internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -bitmap gray25 .foo cget -bitmap -} {gray25} -test config-4.33 {DoObjConfig - border} testobjconfig { - catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -border green} msg] $msg [catch {.foo cget -border} result] $result [destroy .foo] -} {0 .foo 0 green {}} -test config-4.34 {DoObjConfig - invalid border} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -border xxx} msg] $msg -} {1 {unknown color name "xxx"}} -test config-4.35 {DoObjConfig - null border} testobjconfig { - catch {rename .foo {}} - list [catch {testobjconfig alltypes .foo -border {}} msg] $msg [catch {.foo cget -border} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.36 {DoObjConfig - border internal value} testobjconfig { +} -cleanup { + killTables +} -result {gray25} + +test config-4.61 {DoObjConfig - border} -constraints testobjconfig -body { + testobjconfig alltypes .foo -border green +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.62 {DoObjConfig - border} -constraints testobjconfig -body { + testobjconfig alltypes .foo -border green + .foo cget -border +} -cleanup { + killTables +} -returnCodes ok -result {green} +test config-4.63 {DoObjConfig - invalid border} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -border xxx +} -cleanup { + killTables +} -returnCodes error -result {unknown color name "xxx"} +test config-4.64 {DoObjConfig - null border} -constraints testobjconfig -body { + testobjconfig alltypes .foo -border {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.65 {DoObjConfig - null border} -constraints testobjconfig -body { + testobjconfig alltypes .foo -border {} + .foo cget -border +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.66 {DoObjConfig - border internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -border #123456 .foo cget -border -} {#123456} -test config-4.37 {DoObjConfig - getting rid of old border} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {#123456} +test config-4.67 {DoObjConfig - getting rid of old border} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo -border #333333 - list [catch {.foo configure -border #444444} msg] $msg [catch {.foo cget -border} result] $result [destroy .foo] -} {0 256 0 #444444 {}} -test config-4.38 {DoObjConfig - relief} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -relief flat} msg] $msg [catch {.foo cget -relief} result] $result [destroy .foo] -} {0 .foo 0 flat {}} -test config-4.39 {DoObjConfig - invalid relief} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -relief foo} msg] $msg -} {1 {bad relief "foo": must be flat, groove, raised, ridge, solid, or sunken}} -test config-4.40 {DoObjConfig - new relief} testobjconfig { - catch {destroy .foo} - testobjconfig alltypes .foo -relief raised - list [catch {.foo configure -relief flat} msg] $msg [catch {.foo cget -relief} result] $result [destroy .foo] -} {0 512 0 flat {}} -test config-4.41 {DoObjConfig - relief internal value} testobjconfig { + .foo configure -border #444444 +} -cleanup { + killTables +} -returnCodes ok -result {256} +test config-4.68 {DoObjConfig - getting rid of old border} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -border #333333 + .foo configure -border #444444 + .foo cget -border +} -cleanup { + killTables +} -returnCodes ok -result {#444444} + +test config-4.69 {DoObjConfig - relief} -constraints testobjconfig -body { + testobjconfig alltypes .foo -relief flat +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.70 {DoObjConfig - relief} -constraints testobjconfig -body { + testobjconfig alltypes .foo -relief flat + .foo cget -relief +} -cleanup { + killTables +} -returnCodes ok -result {flat} +test config-4.71 {DoObjConfig - invalid relief} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -relief foo +} -cleanup { + killTables +} -returnCodes error -result {bad relief "foo": must be flat, groove, raised, ridge, solid, or sunken} +test config-4.72 {DoObjConfig - relief internal value} -constraints testobjconfig -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -relief ridge .foo cget -relief -} {ridge} -test config-4.42 {DoObjConfig - cursor} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -cursor arrow} msg] $msg [catch {.foo cget -cursor} result] $result [destroy .foo] -} {0 .foo 0 arrow {}} -test config-4.43 {DoObjConfig - invalid cursor} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -cursor foo} msg] $msg -} {1 {bad cursor spec "foo"}} -test config-4.44 {DoObjConfig - null cursor} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -cursor {}} msg] $msg [catch {.foo cget -cursor} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.45 {DoObjConfig - new cursor} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {ridge} +test config-4.73 {DoObjConfig - new relief} -constraints testobjconfig -body { + testobjconfig alltypes .foo -relief raised + .foo configure -relief flat +} -cleanup { + killTables +} -returnCodes ok -result {512} +test config-4.74 {DoObjConfig - new relief} -constraints testobjconfig -body { + testobjconfig alltypes .foo -relief raised + .foo configure -relief flat + .foo cget -relief +} -cleanup { + killTables +} -returnCodes ok -result {flat} + +test config-4.75 {DoObjConfig - cursor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -cursor arrow +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.76 {DoObjConfig - cursor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -cursor arrow + .foo cget -cursor +} -cleanup { + killTables +} -returnCodes ok -result {arrow} +test config-4.77 {DoObjConfig - invalid cursor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -cursor foo +} -cleanup { + killTables +} -returnCodes error -result {bad cursor spec "foo"} +test config-4.78 {DoObjConfig - null cursor} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -cursor {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.79 {DoObjConfig - null cursor} -constraints testobjconfig -setup { + catch {rename .foo {}} +} -body { + testobjconfig alltypes .foo -cursor {} + .foo cget -cursor +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.80 {DoObjConfig - new cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor xterm - list [catch {.foo configure -cursor arrow} msg] $msg [catch {.foo cget -cursor} result] $result [destroy .foo] -} {0 1024 0 arrow {}} -test config-4.46 {DoObjConfig - cursor internal value} testobjconfig { + .foo configure -cursor arrow +} -cleanup { + killTables +} -returnCodes ok -result {1024} +test config-4.81 {DoObjConfig - new cursor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -cursor xterm + .foo configure -cursor arrow + .foo cget -cursor +} -cleanup { + killTables +} -returnCodes ok -result {arrow} +test config-4.82 {DoObjConfig - cursor internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -cursor watch .foo cget -cursor -} {watch} -test config-4.47 {DoObjConfig - justify} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -justify center} msg] $msg [catch {.foo cget -justify} result] $result [destroy .foo] -} {0 .foo 0 center {}} -test config-4.48 {DoObjConfig - invalid justify} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -justify foo} msg] $msg -} {1 {bad justification "foo": must be left, right, or center}} -test config-4.49 {DoObjConfig - new justify} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {watch} + +test config-4.83 {DoObjConfig - justify} -constraints testobjconfig -body { + testobjconfig alltypes .foo -justify center +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.84 {DoObjConfig - justify} -constraints testobjconfig -body { + testobjconfig alltypes .foo -justify center + .foo cget -justify +} -cleanup { + killTables +} -returnCodes ok -result {center} +test config-4.85 {DoObjConfig - invalid justify} -constraints testobjconfig -body { + testobjconfig alltypes .foo -justify foo +} -cleanup { + killTables +} -returnCodes error -result {bad justification "foo": must be left, right, or center} +test config-4.86 {DoObjConfig - new justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify left - list [catch {.foo configure -justify right} msg] $msg [catch {.foo cget -justify} result] $result [destroy .foo] -} {0 2048 0 right {}} -test config-4.50 {DoObjConfig - justify internal value} testobjconfig { + .foo configure -justify right +} -cleanup { + killTables +} -returnCodes ok -result {2048} +test config-4.87 {DoObjConfig - new justify} -constraints testobjconfig -body { + testobjconfig alltypes .foo -justify left + .foo configure -justify right + .foo cget -justify +} -cleanup { + killTables +} -returnCodes ok -result {right} +test config-4.88 {DoObjConfig - justify internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -justify center .foo cget -justify -} {center} -test config-4.51 {DoObjConfig - anchor} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -anchor center} msg] $msg [catch {.foo cget -anchor} result] $result [destroy .foo] -} {0 .foo 0 center {}} -test config-4.52 {DoObjConfig - invalid anchor} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -anchor foo} msg] $msg -} {1 {bad anchor "foo": must be n, ne, e, se, s, sw, w, nw, or center}} -test config-4.53 {DoObjConfig - new anchor} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {center} + +test config-4.89 {DoObjConfig - anchor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -anchor center +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.90 {DoObjConfig - anchor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -anchor center + .foo cget -anchor +} -cleanup { + killTables +} -returnCodes ok -result {center} +test config-4.91 {DoObjConfig - invalid anchor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -anchor foo +} -cleanup { + killTables +} -returnCodes error -result {bad anchor "foo": must be n, ne, e, se, s, sw, w, nw, or center} +test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e - list [catch {.foo configure -anchor n} msg] $msg [catch {.foo cget -anchor} result] $result [destroy .foo] -} {0 4096 0 n {}} -test config-4.54 {DoObjConfig - anchor internal value} testobjconfig { + .foo configure -anchor n +} -cleanup { + killTables +} -returnCodes ok -result {4096} +test config-4.93 {DoObjConfig - new anchor} -constraints testobjconfig -body { + testobjconfig alltypes .foo -anchor e + .foo configure -anchor n + .foo cget -anchor +} -cleanup { + killTables +} -returnCodes ok -result {n} +test config-4.94 {DoObjConfig - anchor internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -anchor sw .foo cget -anchor -} {sw} -test config-4.55 {DoObjConfig - pixel} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -pixel 42} msg] $msg [catch {.foo cget -pixel} result] $result [destroy .foo] -} {0 .foo 0 42 {}} -test config-4.56 {DoObjConfig - invalid pixel} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -pixel foo} msg] $msg -} {1 {bad screen distance "foo"}} -test config-4.57 {DoObjConfig - new pixel} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {sw} +test config-4.95 {DoObjConfig - pixel} -constraints testobjconfig -body { + testobjconfig alltypes .foo -pixel 42 +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.96 {DoObjConfig - pixel} -constraints testobjconfig -body { + testobjconfig alltypes .foo -pixel 42 + .foo cget -pixel +} -cleanup { + killTables +} -returnCodes ok -result {42} +test config-4.97 {DoObjConfig - invalid pixel} -constraints testobjconfig -body { + testobjconfig alltypes .foo -pixel foo +} -cleanup { + killTables +} -returnCodes error -result {bad screen distance "foo"} +test config-4.98 {DoObjConfig - new pixel} -constraints testobjconfig -body { + testobjconfig alltypes .foo -pixel 42m + .foo configure -pixel 3c +} -cleanup { + killTables +} -returnCodes ok -result {8192} +test config-4.99 {DoObjConfig - new pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42m - list [catch {.foo configure -pixel 3c} msg] $msg [catch {.foo cget -pixel} result] $result [destroy .foo] -} {0 8192 0 3c {}} -test config-4.58 {DoObjConfig - pixel internal value} testobjconfig { + .foo configure -pixel 3c + .foo cget -pixel +} -cleanup { + killTables +} -returnCodes ok -result {3c} +test config-4.100 {DoObjConfig - pixel internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -pixel [winfo screenmmwidth .]m - .foo cget -pixel -} [winfo screenwidth .] -test config-4.59 {DoObjConfig - window} testobjconfig { - catch {destroy .foo} - catch {destroy .bar} + set screenW [winfo screenwidth .] + set result [.foo cget -pixel] + expr {$screenW eq $result} +} -cleanup { + killTables +} -result {1} + +test config-4.101 {DoObjConfig - window} -constraints testobjconfig -body { toplevel .bar - list [catch {testobjconfig twowindows .foo -window .bar} msg] $msg [catch {.foo cget -window} result] $result [destroy .foo] [destroy .bar] -} {0 .foo 0 .bar {} {}} -test config-4.60 {DoObjConfig - invalid window} testobjconfig { - catch {destroy .foo} + testobjconfig twowindows .foo -window .bar +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.102 {DoObjConfig - window} -constraints testobjconfig -body { toplevel .bar - list [catch {testobjconfig twowindows .foo -window foo} msg] $msg [destroy .bar] -} {1 {bad window path name "foo"} {}} -test config-4.61 {DoObjConfig - null window} testobjconfig { - catch {destroy .foo} - catch {destroy .bar} + testobjconfig twowindows .foo -window .bar + .foo cget -window +} -cleanup { + killTables +} -returnCodes ok -result {.bar} +test config-4.103 {DoObjConfig - invalid window} -constraints testobjconfig -body { toplevel .bar - list [catch {testobjconfig twowindows .foo -window {}} msg] $msg [catch {.foo cget -window} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.62 {DoObjConfig - new window} testobjconfig { - catch {destroy .foo} - catch {destroy .bar} - catch {destroy .blamph} + testobjconfig twowindows .foo -window foo +} -cleanup { + killTables +} -returnCodes error -result {bad window path name "foo"} +test config-4.104 {DoObjConfig - null window} -constraints testobjconfig -body { + toplevel .bar + testobjconfig twowindows .foo -window {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.105 {DoObjConfig - null window} -constraints testobjconfig -body { + toplevel .bar + testobjconfig twowindows .foo -window {} + .foo cget -window +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.106 {DoObjConfig - new window} -constraints testobjconfig -body { toplevel .bar toplevel .blamph testobjconfig twowindows .foo -window .bar - list [catch {.foo configure -window .blamph} msg] $msg [catch {.foo cget -window} result] $result [destroy .foo] [destroy .bar] [destroy .blamph] -} {0 0 0 .blamph {} {} {}} -test config-4.63 {DoObjConfig - window internal value} testobjconfig { + .foo configure -window .blamph +} -cleanup { + killTables +} -returnCodes ok -result {0} +test config-4.107 {DoObjConfig - new window} -constraints testobjconfig -body { + toplevel .bar + toplevel .blamph + testobjconfig twowindows .foo -window .bar + .foo configure -window .blamph + .foo cget -window +} -cleanup { + killTables +} -returnCodes ok -result {.blamph} +test config-4.108 {DoObjConfig - window internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -window . .foo cget -window -} {.} -test config-4.64 {DoObjConfig - releasing old values} testobjconfig { +} -cleanup { + killTables +} -result {.} + +test config-4.109 {DoObjConfig - releasing old values} -constraints { + testobjconfig +} -setup { + catch {rename .foo {}} +} -body { # This test doesn't generate a useful value to check; if an # error occurs, it will be detected only by memory checking software # such as Purify or Tcl's built-in checker. - catch {rename .foo {}} testobjconfig alltypes .foo -string {Test string} -color yellow \ -font {Courier 18} -bitmap questhead -border green -cursor cross \ -custom foobar @@ -453,13 +1056,18 @@ test config-4.64 {DoObjConfig - releasing old values} testobjconfig { -font {Times 8} -bitmap gray75 -border pink -cursor watch \ -custom barbaz concat {} -} {} -test config-4.65 {DoObjConfig - releasing old values} testobjconfig { +} -cleanup { + killTables +} -result {} +test config-4.110 {DoObjConfig - releasing old values} -constraints { + testobjconfig +} -setup { + catch {rename .foo {}} +} -body { # This test doesn't generate a useful value to check; if an # error occurs, it will be detected only by memory checking software # such as Purify or Tcl's built-in checker. - catch {rename .foo {}} testobjconfig internal .foo -string {Test string} -color yellow \ -font {Courier 18} -bitmap questhead -border green -cursor cross \ -custom foobar @@ -467,421 +1075,844 @@ test config-4.65 {DoObjConfig - releasing old values} testobjconfig { -font {Times 8} -bitmap gray75 -border pink -cursor watch \ -custom barbaz concat {} -} {} -test config-4.66 {DoObjConfig - custom} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -custom test} msg] $msg [catch {.foo cget -custom} result] $result [destroy .foo] -} {0 .foo 0 TEST {}} -test config-4.67 {DoObjConfig - null custom} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -custom {}} msg] $msg [catch {.foo cget -custom} result] $result [destroy .foo] -} {0 .foo 0 {} {}} -test config-4.68 {DoObjConfig - custom internal value} testobjconfig { +} -cleanup { + killTables +} -result {} + +test config-4.111 {DoObjConfig - custom} -constraints testobjconfig -body { + testobjconfig alltypes .foo -custom test +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.112 {DoObjConfig - custom} -constraints testobjconfig -body { + testobjconfig alltypes .foo -custom test + .foo cget -custom +} -cleanup { + killTables +} -returnCodes ok -result {TEST} +test config-4.113 {DoObjConfig - null custom} -constraints testobjconfig -body { + testobjconfig alltypes .foo -custom {} +} -cleanup { + killTables +} -returnCodes ok -result {.foo} +test config-4.114 {DoObjConfig - null custom} -constraints testobjconfig -body { + testobjconfig alltypes .foo -custom {} + .foo cget -custom +} -cleanup { + killTables +} -returnCodes ok -result {} +test config-4.115 {DoObjConfig - custom internal value} -constraints { + testobjconfig +} -setup { catch {rename .foo {}} +} -body { testobjconfig internal .foo -custom "this is a test" .foo cget -custom -} {THIS IS A TEST} +} -cleanup { + killTables +} -result {THIS IS A TEST} -test config-5.1 {ObjectIsEmpty - object is already string} testobjconfig { - catch {destroy .foo} + +test config-5.1 {ObjectIsEmpty - object is already string} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo -color [format ""] .foo cget -color -} {} -test config-5.2 {ObjectIsEmpty - object is already string} testobjconfig { - catch {destroy .foo} - list [catch {testobjconfig alltypes .foo -color [format " "]} msg] $msg -} {1 {unknown color name " "}} -test config-5.3 {ObjectIsEmpty - must convert back to string} testobjconfig { - catch {destroy .foo} +} -cleanup { + killTables +} -result {} +test config-5.2 {ObjectIsEmpty - object is already string} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -color [format " "] +} -cleanup { + killTables +} -returnCodes error -result {unknown color name " "} +test config-5.3 {ObjectIsEmpty - must convert back to string} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo -color [list] .foo cget -color -} {} +} -cleanup { + killTables +} -result {} -deleteWindows -if {[testConstraint testobjconfig]} { + +test config-6.1 {GetOptionFromObj - cached answer} -constraints { + testobjconfig +} -body { testobjconfig chain2 .a - testobjconfig alltypes .b -} -test config-6.1 {GetOptionFromObj - cached answer} testobjconfig { list [.a cget -three] [.a cget -three] -} {three three} -test config-6.2 {GetOptionFromObj - exact match} testobjconfig { +} -cleanup { + killTables +} -result {three three} +test config-6.2 {GetOptionFromObj - exact match} -constraints { + testobjconfig +} -body { + testobjconfig chain2 .a .a cget -one -} {one} -test config-6.3 {GetOptionFromObj - abbreviation} testobjconfig { +} -cleanup { + killTables +} -result {one} +test config-6.3 {GetOptionFromObj - abbreviation} -constraints { + testobjconfig +} -body { + testobjconfig chain2 .a .a cget -fo -} {four} -test config-6.4 {GetOptionFromObj - ambiguous abbreviation} testobjconfig { - list [catch {.a cget -on} msg] $msg -} {1 {unknown option "-on"}} -test config-6.5 {GetOptionFromObj - duplicate options in different tables} testobjconfig { +} -cleanup { + killTables +} -result {four} +test config-6.4 {GetOptionFromObj - ambiguous abbreviation} -constraints { + testobjconfig +} -body { + testobjconfig chain2 .a + .a cget -on +} -cleanup { + killTables +} -cleanup { + killTables +} -returnCodes error -result {unknown option "-on"} +test config-6.5 {GetOptionFromObj - duplicate options in different tables} -constraints { + testobjconfig +} -body { + testobjconfig chain2 .a .a cget -tw -} {two and a half} -test config-6.6 {GetOptionFromObj - synonym} testobjconfig { +} -cleanup { + killTables +} -result {two and a half} +test config-6.6 {GetOptionFromObj - synonym} -constraints testobjconfig -body { + testobjconfig alltypes .b .b cget -synonym -} {red} +} -cleanup { + killTables +} -result {red} + -deleteWindows if {[testConstraint testobjconfig]} { testobjconfig alltypes .a } -test config-7.1 {Tk_SetOptions - basics} testobjconfig { +test config-7.1 {Tk_SetOptions - basics} -constraints testobjconfig -body { .a configure -color green -rel sunken list [.a cget -color] [.a cget -relief] -} {green sunken} -test config-7.2 {Tk_SetOptions - bogus option name} testobjconfig { - list [catch {.a configure -bogus} msg] $msg -} {1 {unknown option "-bogus"}} -test config-7.3 {Tk_SetOptions - synonym} testobjconfig { +} -result {green sunken} +test config-7.2 {Tk_SetOptions - bogus option name} -constraints { + testobjconfig +} -body { + .a configure -bogus +} -returnCodes error -result {unknown option "-bogus"} +test config-7.3 {Tk_SetOptions - synonym} -constraints testobjconfig -body { .a configure -synonym blue .a cget -color -} {blue} -test config-7.4 {Tk_SetOptions - missing value} testobjconfig { - list [catch {.a configure -color green -relief} msg] $msg [.a cget -color] -} {1 {value for "-relief" missing} green} -test config-7.5 {Tk_SetOptions - saving old values} testobjconfig { +} -result {blue} +test config-7.4 {Tk_SetOptions - missing value} -constraints { + testobjconfig +} -body { + .a configure -color green -relief +} -returnCodes error -result {value for "-relief" missing} +test config-7.5 {Tk_SetOptions - missing value} -constraints { + testobjconfig +} -body { + catch {.a configure -color green -relief} + .a cget -color +} -result {green} +test config-7.6 {Tk_SetOptions - saving old values} -constraints { + testobjconfig +} -body { + .a configure -color red -int 7 -relief raised -double 3.14159 + .a csave -color green -int 432 -relief sunken -double 2.0 -color bogus +} -returnCodes error -result {unknown color name "bogus"} +test config-7.7 {Tk_SetOptions - saving old values} -constraints { + testobjconfig +} -body { .a configure -color red -int 7 -relief raised -double 3.14159 - list [catch {.a csave -color green -int 432 -relief sunken \ - -double 2.0 -color bogus} msg] $msg [.a cget -color] \ - [.a cget -int] [.a cget -relief] [.a cget -double] -} {1 {unknown color name "bogus"} red 7 raised 3.14159} -test config-7.6 {Tk_SetOptions - error in DoObjConfig call} testobjconfig { - list [catch {.a configure -color bogus} msg] $msg $errorInfo -} {1 {unknown color name "bogus"} {unknown color name "bogus" + catch {.a csave -color green -int 432 -relief sunken -double 2.0 -color bogus} + list [.a cget -color] [.a cget -int] [.a cget -relief] [.a cget -double] +} -result {red 7 raised 3.14159} + +test config-7.8 {Tk_SetOptions - error in DoObjConfig call} -constraints { + testobjconfig +} -body { + .a configure -color bogus +} -returnCodes error -result {unknown color name "bogus"} +test config-7.9 {Tk_SetOptions - error in DoObjConfig call} -constraints { + testobjconfig +} -body { + catch {.a configure -color bogus} + return $errorInfo +} -result {unknown color name "bogus" (processing "-color" option) invoked from within -".a configure -color bogus"}} -test config-7.7 {Tk_SetOptions - synonym name in error message} testobjconfig { - list [catch {.a configure -synonym bogus} msg] $msg $errorInfo -} {1 {unknown color name "bogus"} {unknown color name "bogus" +".a configure -color bogus"} + +test config-7.10 {Tk_SetOptions - synonym name in error message} -constraints { + testobjconfig +} -body { + .a configure -synonym bogus +} -returnCodes error -result {unknown color name "bogus"} +test config-7.11 {Tk_SetOptions - synonym name in error message} -constraints { + testobjconfig +} -body { + catch {.a configure -synonym bogus} + return $errorInfo +} -result {unknown color name "bogus" (processing "-synonym" option) invoked from within -".a configure -synonym bogus"}} -test config-7.8 {Tk_SetOptions - returning mask} testobjconfig { +".a configure -synonym bogus"} +test config-7.12 {Tk_SetOptions - returning mask} -constraints testobjconfig -body { format %x [.a configure -color red -int 7 -relief raised -double 3.14159] -} {226} -test config-7.9 {Tk_SetOptions - error in DoObjConfig with custom option} testobjconfig { - list [catch {.a configure -custom bad} msg] $msg $errorInfo -} {1 {expected good value, got "BAD"} {expected good value, got "BAD" +} -result {226} +test config-7.13 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints { + testobjconfig +} -body { + .a configure -custom bad +} -returnCodes error -result {expected good value, got "BAD"} +test config-7.14 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints { + testobjconfig +} -body { + catch {.a configure -custom bad} + return $errorInfo +} -result {expected good value, got "BAD" (processing "-custom" option) invoked from within -".a configure -custom bad"}} +".a configure -custom bad"} +if {[testConstraint testobjconfig]} { + killTables +} -test config-8.1 {Tk_RestoreSavedOptions - restore in proper order} testobjconfig { - deleteWindows + +test config-8.1 {Tk_RestoreSavedOptions - restore in proper order} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a - list [catch {.a csave -color green -color black -color blue \ - -color #ffff00 -color #ff00ff -color bogus} msg] $msg \ - [.a cget -color] -} {1 {unknown color name "bogus"} red} -test config-8.2 {Tk_RestoreSavedOptions - freeing object memory} testobjconfig { - deleteWindows + .a csave -color green -color black -color blue \ + -color #ffff00 -color #ff00ff -color bogus \ +} -cleanup { + killTables +} -returnCodes error -result {unknown color name "bogus"} +test config-8.2 {Tk_RestoreSavedOptions - restore in proper order} -constraints { + testobjconfig +} -body { testobjconfig alltypes .a - .a csave -color green -color black -color blue -color #ffff00 \ - -color #ff00ff -} {32} -test config-8.3 {Tk_RestoreSavedOptions - boolean internal form} testobjconfig { - deleteWindows + catch {.a csave -color green -color black -color blue \ + -color #ffff00 -color #ff00ff -color bogus} + .a cget -color +} -cleanup { + killTables +} -result {red} +test config-8.3 {Tk_RestoreSavedOptions - freeing object memory} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .a + .a csave -color green -color black -color blue -color #ffff00 -color #ff00ff +} -cleanup { + killTables +} -result {32} +test config-8.4 {Tk_RestoreSavedOptions - boolean internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -boolean 0 -color bogus}] [.a cget -boolean] -} {1 1} -test config-8.4 {Tk_RestoreSavedOptions - integer internal form} testobjconfig { - deleteWindows + .a csave -boolean 0 -color bogus +} -cleanup { + killTables +} -returnCodes error -match glob -result * +test config-8.5 {Tk_RestoreSavedOptions - boolean internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -integer 24 -color bogus}] [.a cget -integer] -} {1 148962237} -test config-8.5 {Tk_RestoreSavedOptions - double internal form} testobjconfig { - deleteWindows + catch {.a csave -boolean 0 -color bogus} + .a cget -boolean +} -cleanup { + killTables +} -result {1} +test config-8.6 {Tk_RestoreSavedOptions - integer internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -double 62.4 -color bogus}] [.a cget -double] -} {1 3.14159} -test config-8.6 {Tk_RestoreSavedOptions - string internal form} testobjconfig { - deleteWindows + .a csave -integer 24 -color bogus +} -cleanup { + killTables +} -returnCodes error -match glob -result * +test config-8.7 {Tk_RestoreSavedOptions - integer internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -string "A long string" -color bogus}] \ - [.a cget -string] -} {1 foo} -test config-8.7 {Tk_RestoreSavedOptions - string table internal form} testobjconfig { - deleteWindows + catch {.a csave -integer 24 -color bogus} + .a cget -integer +} -cleanup { + killTables +} -result {148962237} +test config-8.8 {Tk_RestoreSavedOptions - double internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -stringtable three -color bogus}] \ - [.a cget -stringtable] -} {1 one} -test config-8.8 {Tk_RestoreSavedOptions - color internal form} testobjconfig { - deleteWindows + catch {.a csave -double 62.4 -color bogus} + .a cget -double +} -cleanup { + killTables +} -result {3.14159} +test config-8.9 {Tk_RestoreSavedOptions - string internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -color green -color bogus}] [.a cget -color] -} {1 red} -test config-8.9 {Tk_RestoreSavedOptions - font internal form} {testobjconfig nonPortable} { - deleteWindows + catch {.a csave -string "A long string" -color bogus} + .a cget -string +} -cleanup { + killTables +} -result {foo} +test config-8.10 {Tk_RestoreSavedOptions - string table internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -font {Times 12} -color bogus}] [.a cget -font] -} {1 {Helvetica 12}} -test config-8.10 {Tk_RestoreSavedOptions - bitmap internal form} testobjconfig { - deleteWindows + catch {.a csave -stringtable three -color bogus} + .a cget -stringtable +} -cleanup { + killTables +} -result {one} +test config-8.11 {Tk_RestoreSavedOptions - color internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -bitmap questhead -color bogus}] [.a cget -bitmap] -} {1 gray50} -test config-8.11 {Tk_RestoreSavedOptions - border internal form} testobjconfig { - deleteWindows + catch {.a csave -color green -color bogus} + .a cget -color +} -cleanup { + killTables +} -result {red} +test config-8.12 {Tk_RestoreSavedOptions - font internal form} -constraints { + testobjconfig nonPortable +} -body { testobjconfig internal .a - list [catch {.a csave -border brown -color bogus}] [.a cget -border] -} {1 blue} -test config-8.12 {Tk_RestoreSavedOptions - relief internal form} testobjconfig { - deleteWindows + catch {.a csave -font {Times 12} -color bogus} + .a cget -font +} -cleanup { + killTables +} -result {Helvetica 12} +test config-8.13 {Tk_RestoreSavedOptions - bitmap internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -relief sunken -color bogus}] [.a cget -relief] -} {1 raised} -test config-8.13 {Tk_RestoreSavedOptions - cursor internal form} testobjconfig { - deleteWindows + catch {.a csave -bitmap questhead -color bogus} + .a cget -bitmap +} -cleanup { + killTables +} -result {gray50} +test config-8.14 {Tk_RestoreSavedOptions - border internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -cursor watch -color bogus}] [.a cget -cursor] -} {1 xterm} -test config-8.14 {Tk_RestoreSavedOptions - justify internal form} testobjconfig { - deleteWindows + catch {.a csave -border brown -color bogus} + .a cget -border +} -cleanup { + killTables +} -result {blue} +test config-8.15 {Tk_RestoreSavedOptions - relief internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -justify right -color bogus}] [.a cget -justify] -} {1 left} -test config-8.15 {Tk_RestoreSavedOptions - anchor internal form} testobjconfig { - deleteWindows + catch {.a csave -relief sunken -color bogus} + .a cget -relief +} -cleanup { + killTables +} -result {raised} +test config-8.16 {Tk_RestoreSavedOptions - cursor internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a - list [catch {.a csave -anchor center -color bogus}] [.a cget -anchor] -} {1 n} -test config-8.16 {Tk_RestoreSavedOptions - window internal form} testobjconfig { - deleteWindows + catch {.a csave -cursor watch -color bogus} + .a cget -cursor +} -cleanup { + killTables +} -result {xterm} +test config-8.17 {Tk_RestoreSavedOptions - justify internal form} -constraints { + testobjconfig +} -body { + testobjconfig internal .a + catch {.a csave -justify right -color bogus} + .a cget -justify +} -cleanup { + killTables +} -result {left} +test config-8.18 {Tk_RestoreSavedOptions - anchor internal form} -constraints { + testobjconfig +} -body { + testobjconfig internal .a + catch {.a csave -anchor center -color bogus} + .a cget -anchor +} -cleanup { + killTables +} -result {n} +test config-8.19 {Tk_RestoreSavedOptions - window internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a -window .a - list [catch {.a csave -window .a -color bogus}] [.a cget -window] -} {1 .a} -test config-8.17 {Tk_RestoreSavedOptions - custom internal form} testobjconfig { - deleteWindows + catch {.a csave -window .a -color bogus} + .a cget -window +} -cleanup { + killTables +} -result {.a} +test config-8.20 {Tk_RestoreSavedOptions - custom internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .a -custom "foobar" - list [catch {.a csave -custom "barbaz" -color bogus}] [.a cget -custom] -} {1 FOOBAR} + catch {.a csave -custom "barbaz" -color bogus} + .a cget -custom +} -cleanup { + killTables +} -result {FOOBAR} # Most of the tests below will cause memory leakage if there is a # problem. This may not be evident unless the tests are run in # conjunction with a memory usage analyzer such as Purify. -test config-9.1 {Tk_FreeConfigOptions/FreeResources - string internal form} testobjconfig { - catch {destroy .foo} +test config-9.1 {Tk_FreeConfigOptions/FreeResources - string internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .foo .foo configure -string "two words" destroy .foo -} {} -test config-9.2 {Tk_FreeConfigOptions/FreeResources - color internal form} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.2 {Tk_FreeConfigOptions/FreeResources - color internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .foo .foo configure -color yellow destroy .foo -} {} -test config-9.3 {Tk_FreeConfigOptions/FreeResources - color} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.3 {Tk_FreeConfigOptions/FreeResources - color} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo .foo configure -color [format blue] destroy .foo -} {} -test config-9.4 {Tk_FreeConfigOptions/FreeResources - font internal form} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.4 {Tk_FreeConfigOptions/FreeResources - font internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .foo .foo configure -font {Courier 20} destroy .foo -} {} -test config-9.5 {Tk_FreeConfigOptions/FreeResources - font} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.5 {Tk_FreeConfigOptions/FreeResources - font} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo .foo configure -font [format {Courier 24}] destroy .foo -} {} -test config-9.6 {Tk_FreeConfigOptions/FreeResources - bitmap internal form} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.6 {Tk_FreeConfigOptions/FreeResources - bitmap internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .foo .foo configure -bitmap gray75 destroy .foo -} {} -test config-9.7 {Tk_FreeConfigOptions/FreeResources - bitmap} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.7 {Tk_FreeConfigOptions/FreeResources - bitmap} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo .foo configure -bitmap [format gray75] destroy .foo -} {} -test config-9.8 {Tk_FreeConfigOptions/FreeResources - border internal form} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.8 {Tk_FreeConfigOptions/FreeResources - border internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .foo .foo configure -border orange destroy .foo -} {} -test config-9.9 {Tk_FreeConfigOptions/FreeResources - border} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.9 {Tk_FreeConfigOptions/FreeResources - border} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo .foo configure -border [format blue] destroy .foo -} {} -test config-9.10 {Tk_FreeConfigOptions/FreeResources - cursor internal form} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.10 {Tk_FreeConfigOptions/FreeResources - cursor internal form} -constraints { + testobjconfig +} -body { testobjconfig internal .foo .foo configure -cursor cross destroy .foo -} {} -test config-9.11 {Tk_FreeConfigOptions/FreeResources - cursor} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.11 {Tk_FreeConfigOptions/FreeResources - cursor} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo .foo configure -cursor [format watch] destroy .foo -} {} -test config-9.12 {Tk_FreeConfigOptions/FreeResources - not special} testobjconfig { - catch {destroy .foo} +} -result {} +test config-9.12 {Tk_FreeConfigOptions/FreeResources - not special} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo .foo configure -integer [format 27] destroy .foo -} {} -test config-9.13 {Tk_FreeConfigOptions/FreeResources - custom internal form} testobjconfig { +} -result {} +test config-9.13 {Tk_FreeConfigOptions/FreeResources - custom internal form} -constraints { + testobjconfig +} -body { catch {destroy .fpp} testobjconfig internal .foo .foo configure -custom "foobar" destroy .foo -} {} +} -result {} +if {[testConstraint testobjconfig]} { + killTables +} + -test config-10.1 {Tk_GetOptionInfo - one item} testobjconfig { - catch {destroy .foo} +test config-10.1 {Tk_GetOptionInfo - one item} -constraints testobjconfig -body { testobjconfig alltypes .foo .foo configure -relief groove .foo configure -relief -} {-relief relief Relief raised groove} -test config-10.2 {Tk_GetOptionInfo - one item, synonym} testobjconfig { - catch {destroy .foo} +} -cleanup { + destroy .foo +} -result {-relief relief Relief raised groove} +test config-10.2 {Tk_GetOptionInfo - one item, synonym} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo .foo configure -color black .foo configure -synonym -} {-color color Color red black} -test config-10.3 {Tk_GetOptionInfo - all items} testobjconfig { - catch {destroy .foo} +} -cleanup { + destroy .foo +} -result {-color color Color red black} +test config-10.3 {Tk_GetOptionInfo - all items} -constraints { + testobjconfig +} -body { testobjconfig alltypes .foo -font {Helvetica 18} -integer 13563 .foo configure -} {{-boolean boolean Boolean 1 1} {-integer integer Integer 7 13563} {-double double Double 3.14159 3.14159} {-string string String foo foo} {-stringtable StringTable stringTable one one} {-color color Color red red} {-font font Font {Helvetica 12} {Helvetica 18}} {-bitmap bitmap Bitmap gray50 gray50} {-border border Border blue blue} {-relief relief Relief raised raised} {-cursor cursor Cursor xterm xterm} {-justify {} {} left left} {-anchor anchor Anchor {} {}} {-pixel pixel Pixel 1 1} {-custom {} {} {} {}} {-synonym -color}} -test config-10.4 {Tk_GetOptionInfo - chaining through tables} testobjconfig { - catch {destroy .foo} +} -cleanup { + destroy .foo +} -result {{-boolean boolean Boolean 1 1} {-integer integer Integer 7 13563} {-double double Double 3.14159 3.14159} {-string string String foo foo} {-stringtable StringTable stringTable one one} {-color color Color red red} {-font font Font {Helvetica 12} {Helvetica 18}} {-bitmap bitmap Bitmap gray50 gray50} {-border border Border blue blue} {-relief relief Relief raised raised} {-cursor cursor Cursor xterm xterm} {-justify {} {} left left} {-anchor anchor Anchor {} {}} {-pixel pixel Pixel 1 1} {-custom {} {} {} {}} {-synonym -color}} +test config-10.4 {Tk_GetOptionInfo - chaining through tables} -constraints testobjconfig -body { testobjconfig chain2 .foo -one asdf -three xyzzy .foo configure -} {{-three three Three three xyzzy} {-four four Four four four} {-two two Two {two and a half} {two and a half}} {-oneAgain oneAgain OneAgain {one again} {one again}} {-one one One one asdf} {-two two Two two {two and a half}}} +} -cleanup { + destroy .foo +} -result {{-three three Three three xyzzy} {-four four Four four four} {-two two Two {two and a half} {two and a half}} {-oneAgain oneAgain OneAgain {one again} {one again}} {-one one One one asdf} {-two two Two two {two and a half}}} +if {[testConstraint testobjconfig]} { + killTables +} + -deleteWindows if {[testConstraint testobjconfig]} { testobjconfig alltypes .a } -test config-11.1 {GetConfigList - synonym} testobjconfig { +test config-11.1 {GetConfigList - synonym} -constraints testobjconfig -body { lindex [.a configure] end -} {-synonym -color} -test config-11.2 {GetConfigList - null database names} testobjconfig { +} -result {-synonym -color} +test config-11.2 {GetConfigList - null database names} -constraints { + testobjconfig +} -body { .a configure -justify -} {-justify {} {} left left} -test config-11.3 {GetConfigList - null default and current value} testobjconfig { +} -result {-justify {} {} left left} +test config-11.3 {GetConfigList - null default and current value} -constraints { + testobjconfig +} -body { .a configure -anchor -} {-anchor anchor Anchor {} {}} +} -result {-anchor anchor Anchor {} {}} +if {[testConstraint testobjconfig]} { + killTables +} + -deleteWindows if {[testConstraint testobjconfig]} { testobjconfig internal .a } -test config-12.1 {GetObjectForOption - boolean} testobjconfig { +test config-12.1 {GetObjectForOption - boolean} -constraints testobjconfig -body { .a configure -boolean 0 .a cget -boolean -} {0} -test config-12.2 {GetObjectForOption - integer} testobjconfig { +} -result {0} +test config-12.2 {GetObjectForOption - integer} -constraints testobjconfig -body { .a configure -integer 1247 .a cget -integer -} {1247} -test config-12.3 {GetObjectForOption - double} testobjconfig { +} -result {1247} +test config-12.3 {GetObjectForOption - double} -constraints testobjconfig -body { .a configure -double -88.82 .a cget -double -} {-88.82} -test config-12.4 {GetObjectForOption - string} testobjconfig { +} -result {-88.82} +test config-12.4 {GetObjectForOption - string} -constraints testobjconfig -body { .a configure -string "test value" .a cget -string -} {test value} -test config-12.5 {GetObjectForOption - stringTable} testobjconfig { +} -result {test value} +test config-12.5 {GetObjectForOption - stringTable} -constraints { + testobjconfig +} -body { .a configure -stringtable "two" .a cget -stringtable -} {two} -test config-12.6 {GetObjectForOption - color} testobjconfig { +} -result {two} +test config-12.6 {GetObjectForOption - color} -constraints testobjconfig -body { .a configure -color "green" .a cget -color -} {green} -test config-12.7 {GetObjectForOption - font} testobjconfig { +} -result {green} +test config-12.7 {GetObjectForOption - font} -constraints testobjconfig -body { .a configure -font {Times 36} .a cget -font -} {Times 36} -test config-12.8 {GetObjectForOption - bitmap} testobjconfig { +} -result {Times 36} +test config-12.8 {GetObjectForOption - bitmap} -constraints testobjconfig -body { .a configure -bitmap "questhead" .a cget -bitmap -} {questhead} -test config-12.9 {GetObjectForOption - border} testobjconfig { +} -result {questhead} +test config-12.9 {GetObjectForOption - border} -constraints testobjconfig -body { .a configure -border #33217c .a cget -border -} {#33217c} -test config-12.10 {GetObjectForOption - relief} testobjconfig { +} -result {#33217c} +test config-12.10 {GetObjectForOption - relief} -constraints { + testobjconfig +} -body { .a configure -relief groove .a cget -relief -} {groove} -test config-12.11 {GetObjectForOption - cursor} testobjconfig { +} -result {groove} +test config-12.11 {GetObjectForOption - cursor} -constraints { + testobjconfig +} -body { .a configure -cursor watch .a cget -cursor -} {watch} -test config-12.12 {GetObjectForOption - justify} testobjconfig { +} -result {watch} +test config-12.12 {GetObjectForOption - justify} -constraints { + testobjconfig +} -body { .a configure -justify right .a cget -justify -} {right} -test config-12.13 {GetObjectForOption - anchor} testobjconfig { +} -result {right} +test config-12.13 {GetObjectForOption - anchor} -constraints testobjconfig -body { .a configure -anchor e .a cget -anchor -} {e} -test config-12.14 {GetObjectForOption - pixels} testobjconfig { +} -result {e} +test config-12.14 {GetObjectForOption - pixels} -constraints testobjconfig -body { .a configure -pixel 193.2 .a cget -pixel -} {193} -test config-12.15 {GetObjectForOption - window} testobjconfig { +} -result {193} +test config-12.15 {GetObjectForOption - window} -constraints testobjconfig -body { .a configure -window .a .a cget -window -} {.a} -test config-12.16 {GetObjectForOption -custom} testobjconfig { +} -result {.a} +test config-12.16 {GetObjectForOption -custom} -constraints testobjconfig -body { .a configure -custom foobar .a cget -custom -} {FOOBAR} -test config-12.17 {GetObjectForOption - null values} testobjconfig { +} -result {FOOBAR} +test config-12.17 {GetObjectForOption - null values} -constraints { + testobjconfig +} -body { .a configure -string {} -color {} -font {} -bitmap {} -border {} \ -cursor {} -window {} -custom {} list [.a cget -string] [.a cget -color] [.a cget -font] \ [.a cget -bitmap] [.a cget -border] [.a cget -cursor] \ [.a cget -window] [.a cget -custom] -} {{} {} {} {} {} {} {} {}} - -test config-13.1 {proper cleanup of options with widget destroy} { - foreach type { - button canvas entry frame listbox menu menubutton message - scale scrollbar text radiobutton checkbutton - } { - destroy .w - $type .w -cursor crosshair - destroy .w - } -} {} +} -result {{} {} {} {} {} {} {} {}} +if {[testConstraint testobjconfig]} { + killTables +} -deleteWindows -test config-14.1 {Tk_CreateOptionTable - use with namespace import} { +test config-13.1 {proper cleanup of options with widget destroy} -body { + button .w -cursor crosshair + destroy .w +} -result {} +test config-13.2 {proper cleanup of options with widget destroy} -body { + canvas .w -cursor crosshair + destroy .w +} -result {} +test config-13.3 {proper cleanup of options with widget destroy} -body { + entry .w -cursor crosshair + destroy .w +} -result {} +test config-13.4 {proper cleanup of options with widget destroy} -body { + frame .w -cursor crosshair + destroy .w +} -result {} +test config-13.5 {proper cleanup of options with widget destroy} -body { + listbox .w -cursor crosshair + destroy .w +} -result {} +test config-13.6 {proper cleanup of options with widget destroy} -body { + menu .w -cursor crosshair + destroy .w +} -result {} +test config-13.7 {proper cleanup of options with widget destroy} -body { + menubutton .w -cursor crosshair + destroy .w +} -result {} +test config-13.8 {proper cleanup of options with widget destroy} -body { + message .w -cursor crosshair + destroy .w +} -result {} +test config-13.9 {proper cleanup of options with widget destroy} -body { + scale .w -cursor crosshair + destroy .w +} -result {} +test config-13.10 {proper cleanup of options with widget destroy} -body { + scrollbar .w -cursor crosshair + destroy .w +} -result {} +test config-13.11 {proper cleanup of options with widget destroy} -body { + text .w -cursor crosshair + destroy .w +} -result {} +test config-13.12 {proper cleanup of options with widget destroy} -body { + radiobutton .w -cursor crosshair + destroy .w +} -result {} +test config-13.13 {proper cleanup of options with widget destroy} -body { + checkbutton .w -cursor crosshair + destroy .w +} -result {} + +test config-14.1 {Tk_CreateOptionTable - use with namespace import} -setup { namespace export -clear * - foreach type { - button canvas entry frame listbox menu menubutton message - scale scrollbar spinbox text radiobutton checkbutton - } { - namespace eval ::foo [subst { - namespace import -force ::$type - ::foo::$type .a - ::foo::$type .b - } - ] - destroy .a .b - } -} {} +} -body { + namespace eval ::foo [subst { + namespace import -force ::button + ::foo::button .a + ::foo::button .b + } + ] + destroy .a .b +} -result {} +test config-14.2 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::canvas + ::foo::canvas .a + ::foo::canvas .b + } + ] + destroy .a .b +} -result {} +test config-14.3 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::entry + ::foo::entry .a + ::foo::entry .b + } + ] + destroy .a .b +} -result {} +test config-14.4 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::frame + ::foo::frame .a + ::foo::frame .b + } + ] + destroy .a .b +} -result {} +test config-14.5 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::listbox + ::foo::listbox .a + ::foo::listbox .b + } + ] + destroy .a .b +} -result {} +test config-14.6 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::menu + ::foo::menu .a + ::foo::menu .b + } + ] + destroy .a .b +} -result {} +test config-14.7 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::menubutton + ::foo::menubutton .a + ::foo::menubutton .b + } + ] + destroy .a .b +} -result {} +test config-14.8 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::message + ::foo::message .a + ::foo::message .b + } + ] + destroy .a .b +} -result {} +test config-14.9 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::scale + ::foo::scale .a + ::foo::scale .b + } + ] + destroy .a .b +} -result {} +test config-14.10 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::scrollbar + ::foo::scrollbar .a + ::foo::scrollbar .b + } + ] + destroy .a .b +} -result {} +test config-14.11 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::spinbox + ::foo::spinbox .a + ::foo::spinbox .b + } + ] + destroy .a .b +} -result {} +test config-14.12 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::text + ::foo::text .a + ::foo::text .b + } + ] + destroy .a .b +} -result {} +test config-14.13 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::radiobutton + ::foo::radiobutton .a + ::foo::radiobutton .b + } + ] + destroy .a .b +} -result {} +test config-14.14 {Tk_CreateOptionTable - use with namespace import} -setup { + namespace export -clear * +} -body { + namespace eval ::foo [subst { + namespace import -force ::checkbutton + ::foo::checkbutton .a + ::foo::checkbutton .b + } + ] + destroy .a .b +} -result {} + # cleanup deleteWindows @@ -890,3 +1921,11 @@ if {[testConstraint testobjconfig]} { } cleanupTests return + + + + + + + + |