diff options
Diffstat (limited to 'tests/canvImg.test')
-rw-r--r-- | tests/canvImg.test | 74 |
1 files changed, 29 insertions, 45 deletions
diff --git a/tests/canvImg.test b/tests/canvImg.test index 083c5c0..1dffc5e 100644 --- a/tests/canvImg.test +++ b/tests/canvImg.test @@ -8,10 +8,7 @@ # All rights reserved. package require tcltest 2.1 -namespace import -force tcltest::configure -namespace import -force tcltest::testsDirectory -configure -testdir [file join [pwd] [file dirname [info script]]] -configure -loadfile [file join [testsDirectory] constraints.tcl] +eval tcltest::configure $argv tcltest::loadTestedCommands eval image delete [image names] @@ -129,13 +126,14 @@ test canvImg-5.1 {DeleteImage procedure} testImageType { .c delete all .c create image 50 100 -image xyzzy -tags i1 update + set names [lsort [image names]] image delete xyzzy set z {} - set names [lsort [image names]] + set names2 [lsort [image names]] .c delete i1 update - list $names $z [lsort [image names]] -} {{foo foo2 xyzzy} {} {foo foo2}} + list $names $names2 $z [lsort [image names]] +} {{foo foo2 xyzzy} {foo foo2} {} {foo foo2}} test canvImg-5.2 {DeleteImage procedure (don't delete non-existent image)} { .c delete all .c create image 50 100 -tags i1 @@ -225,37 +223,36 @@ test canvImg-7.2 {DisplayImage procedure, no image} { update } {} -set i 1 .c delete all if {[testConstraint testImageType]} { .c create image 50 100 -image foo -tags image -anchor nw } .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} foreach check { - {{50 70 80 81} {70 90} {rect}} - {{50 70 80 79} {70 90} {image}} - {{99 70 110 81} {90 90} {rect}} - {{101 70 110 79} {90 90} {image}} - {{99 100 110 115} {90 110} {rect}} - {{101 100 110 115} {90 110} {image}} - {{99 134 110 145} {90 125} {rect}} - {{101 136 110 145} {90 125} {image}} - {{50 134 80 145} {70 125} {rect}} - {{50 136 80 145} {70 125} {image}} - {{20 134 31 145} {40 125} {rect}} - {{20 136 29 145} {40 125} {image}} - {{20 100 31 115} {40 110} {rect}} - {{20 100 29 115} {40 110} {image}} - {{20 70 31 80} {40 90} {rect}} - {{20 70 29 79} {40 90} {image}} - {{60 70 69 109} {70 110} {image}} - {{60 70 71 111} {70 110} {rect}} + {canvImg-8.1 {50 70 80 81} {70 90} rect} + {canvImg-8.2 {50 70 80 79} {70 90} image} + {canvImg-8.3 {99 70 110 81} {90 90} rect} + {canvImg-8.4 {101 70 110 79} {90 90} image} + {canvImg-8.5 {99 100 110 115} {90 110} rect} + {canvImg-8.6 {101 100 110 115} {90 110} image} + {canvImg-8.7 {99 134 110 145} {90 125} rect} + {canvImg-8.8 {101 136 110 145} {90 125} image} + {canvImg-8.9 {50 134 80 145} {70 125} rect} + {canvImg-8.10 {50 136 80 145} {70 125} image} + {canvImg-8.11 {20 134 31 145} {40 125} rect} + {canvImg-8.12 {20 136 29 145} {40 125} image} + {canvImg-8.13 {20 100 31 115} {40 110} rect} + {canvImg-8.14 {20 100 29 115} {40 110} image} + {canvImg-8.15 {20 70 31 80} {40 90} rect} + {canvImg-8.16 {20 70 29 79} {40 90} image} + {canvImg-8.17 {60 70 69 109} {70 110} image} + {canvImg-8.18 {60 70 71 111} {70 110} rect} } { - test canvImg-8.$i {ImageToPoint procedure} testImageType { - eval .c coords rect [lindex $check 0] - .c gettags [eval .c find closest [lindex $check 1]] - } [lindex $check 2] - incr i + lassign $check name rectCoords testPoint result + test $name {ImageToPoint procedure} testImageType { + .c coords rect {*}$rectCoords + .c gettags [.c find closest {*}$testPoint] + } $result } .c delete all @@ -390,18 +387,5 @@ test canvImg-11.3 {ImageChangedProc procedure} testImageType { } {{foo2 display 0 0 20 40 50 40}} # cleanup -::tcltest::cleanupTests +cleanupTests return - - - - - - - - - - - - - |