diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2009-01-13 01:46:05 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2009-01-13 01:46:05 (GMT) |
commit | 4a96ce86821a373b23644857f6b01261d1fd6c1c (patch) | |
tree | 2bb2e17fa91b47afa565195e5553ba50edf99aa9 /tests/constraints.tcl | |
parent | 19458a73a3f2e0d6dc63f4127d47ca3f48af0e5d (diff) | |
download | tk-4a96ce86821a373b23644857f6b01261d1fd6c1c.zip tk-4a96ce86821a373b23644857f6b01261d1fd6c1c.tar.gz tk-4a96ce86821a373b23644857f6b01261d1fd6c1c.tar.bz2 |
Tk tests that create images need to be independent of the interpreter environment.
Diffstat (limited to 'tests/constraints.tcl')
-rw-r--r-- | tests/constraints.tcl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/constraints.tcl b/tests/constraints.tcl index 0750d7a..ac32852 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -138,6 +138,42 @@ namespace eval tk { focus -force .focus.e destroy .focus } + + + namespace export imageInit imageFinish imageCleanup imageNames + variable ImageNames + proc imageInit {} { + variable ImageNames + if {![info exists ImageNames]} { + set ImageNames [lsort [image names]] + } + imageCleanup + if {[lsort [image names]] ne $ImageNames} { + return -code error "IMAGE NAMES mismatch: [image names] != $ImageNames" + } + } + proc imageFinish {} { + variable ImageNames + if {[lsort [image names]] ne $ImageNames} { + return -code error "images remaining: [image names] != $ImageNames" + } + imageCleanup + } + proc imageCleanup {} { + variable ImageNames + foreach img [image names] { + if {$img ni $ImageNames} {image delete $img} + } + } + proc imageNames {} { + variable ImageNames + set r {} + foreach img [image names] { + if {$img ni $ImageNames} {lappend r $img} + } + return $r + } + } } |