diff options
author | dgp <dgp@users.sourceforge.net> | 2002-07-14 05:48:45 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2002-07-14 05:48:45 (GMT) |
commit | f79b432c7c47051e0c7e11bd52e82547ad7aacf2 (patch) | |
tree | 506cf7b5383406d4969854b8209566f9c0b690c6 /tests/canvImg.test | |
parent | 213541e4a3a5a49415c0f9f8d37a5cbce28f89f7 (diff) | |
download | tk-f79b432c7c47051e0c7e11bd52e82547ad7aacf2.zip tk-f79b432c7c47051e0c7e11bd52e82547ad7aacf2.tar.gz tk-f79b432c7c47051e0c7e11bd52e82547ad7aacf2.tar.bz2 |
* Completed conversion of Tk test suite to use tcltest.
Diffstat (limited to 'tests/canvImg.test')
-rw-r--r-- | tests/canvImg.test | 153 |
1 files changed, 74 insertions, 79 deletions
diff --git a/tests/canvImg.test b/tests/canvImg.test index 44d6546..94292d2 100644 --- a/tests/canvImg.test +++ b/tests/canvImg.test @@ -7,33 +7,24 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: canvImg.test,v 1.4 1999/12/14 06:53:12 hobbs Exp $ +# RCS: @(#) $Id: canvImg.test,v 1.5 2002/07/14 05:48:46 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - source [file join [pwd] [file dirname [info script]] defs.tcl] -} - -if {[lsearch [image types] test] < 0} { - puts "This application hasn't been compiled with the \"test\" image" - puts "type, so I can't run this test. Are you sure you're using" - puts "tktest instead of wish?" - ::tcltest::cleanupTests - return -} - -foreach i [winfo children .] { - destroy $i -} -wm geometry . {} -raise . +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] +tcltest::loadTestedCommands eval image delete [image names] canvas .c pack .c update -image create test foo -variable x -image create test foo2 -variable y -foo2 changed 0 0 0 0 80 60 +if {[testConstraint testImageType]} { + image create test foo -variable x + image create test foo2 -variable y + foo2 changed 0 0 0 0 80 60 +} test canvImg-1.1 {options for image items} { .c delete all .c create image 50 50 -anchor nw -tags i1 @@ -43,7 +34,7 @@ test canvImg-1.2 {options for image items} { .c delete all list [catch {.c create image 50 50 -anchor gorp -tags i1} msg] $msg } {1 {bad anchor position "gorp": must be n, ne, e, se, s, sw, w, nw, or center}} -test canvImg-1.3 {options for image items} { +test canvImg-1.3 {options for image items} testImageType { .c delete all .c create image 50 50 -image foo -tags i1 .c itemconfigure i1 -image @@ -52,7 +43,7 @@ test canvImg-1.4 {options for image items} { .c delete all list [catch {.c create image 50 50 -image unknown -tags i1} msg] $msg } {1 {image "unknown" doesn't exist}} -test canvImg-1.5 {options for image items} { +test canvImg-1.5 {options for image items} testImageType { .c delete all .c create image 50 50 -image foo -tags {i1 foo} .c itemconfigure i1 -tags @@ -77,37 +68,37 @@ test canvImg-2.4 {CreateImage procedure} { test canvImg-2.5 {CreateImage procedure} { list [catch {.c create image 50 qrs} msg] $msg } {1 {bad screen distance "qrs"}} -test canvImg-2.6 {CreateImage procedure} { +test canvImg-2.6 {CreateImage procedure} testImageType { list [catch {.c create image 50 50 -gorp foo} msg] $msg } {1 {unknown option "-gorp"}} -test canvImg-3.1 {ImageCoords procedure} { +test canvImg-3.1 {ImageCoords procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 .c coords i1 } {50.0 100.0} -test canvImg-3.2 {ImageCoords procedure} { +test canvImg-3.2 {ImageCoords procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 list [catch {.c coords i1 dumb 100} msg] $msg } {1 {bad screen distance "dumb"}} -test canvImg-3.3 {ImageCoords procedure} { +test canvImg-3.3 {ImageCoords procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 list [catch {.c coords i1 250 dumb0} msg] $msg } {1 {bad screen distance "dumb0"}} -test canvImg-3.4 {ImageCoords procedure} { +test canvImg-3.4 {ImageCoords procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 list [catch {.c coords i1 250} msg] $msg } {1 {wrong # coordinates: expected 2, got 1}} -test canvImg-3.5 {ImageCoords procedure} { +test canvImg-3.5 {ImageCoords procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 list [catch {.c coords i1 250 300 400} msg] $msg } {1 {wrong # coordinates: expected 0 or 2, got 3}} -test canvImg-4.1 {ConfiugreImage procedure} { +test canvImg-4.1 {ConfiugreImage procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 update @@ -116,7 +107,7 @@ test canvImg-4.1 {ConfiugreImage procedure} { update list $x [.c bbox i1] } {{{foo free}} {}} -test canvImg-4.2 {ConfiugreImage procedure} { +test canvImg-4.2 {ConfiugreImage procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 -anchor nw update @@ -126,7 +117,7 @@ test canvImg-4.2 {ConfiugreImage procedure} { update list $x $y [.c bbox i1] } {{{foo free}} {{foo2 get} {foo2 display 0 0 80 60 30 30}} {50 100 130 160}} -test canvImg-4.3 {ConfiugreImage procedure} { +test canvImg-4.3 {ConfiugreImage procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags i1 -anchor nw update @@ -135,7 +126,7 @@ test canvImg-4.3 {ConfiugreImage procedure} { list [catch {.c itemconfigure i1 -image lousy} msg] $msg } {1 {image "lousy" doesn't exist}} -test canvImg-5.1 {DeleteImage procedure} { +test canvImg-5.1 {DeleteImage procedure} testImageType { image create test xyzzy -variable z .c delete all .c create image 50 100 -image xyzzy -tags i1 @@ -155,12 +146,12 @@ test canvImg-5.2 {DeleteImage procedure (don't delete non-existent image)} { update } {} -test canvImg-6.1 {ComputeImageBbox procedure} { +test canvImg-6.1 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 15.51 17.51 -image foo -tags i1 -anchor nw .c bbox i1 } {16 18 46 33} -test canvImg-6.2 {ComputeImageBbox procedure} { +test canvImg-6.2 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 15.49 17.49 -image foo -tags i1 -anchor nw .c bbox i1 @@ -170,47 +161,47 @@ test canvImg-6.3 {ComputeImageBbox procedure} { .c create image 20 30 -tags i1 -anchor nw .c bbox i1 } {} -test canvImg-6.4 {ComputeImageBbox procedure} { +test canvImg-6.4 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor nw .c bbox i1 } {20 30 50 45} -test canvImg-6.5 {ComputeImageBbox procedure} { +test canvImg-6.5 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor n .c bbox i1 } {5 30 35 45} -test canvImg-6.6 {ComputeImageBbox procedure} { +test canvImg-6.6 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor ne .c bbox i1 } {-10 30 20 45} -test canvImg-6.7 {ComputeImageBbox procedure} { +test canvImg-6.7 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor e .c bbox i1 } {-10 23 20 38} -test canvImg-6.8 {ComputeImageBbox procedure} { +test canvImg-6.8 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor se .c bbox i1 } {-10 15 20 30} -test canvImg-6.9 {ComputeImageBbox procedure} { +test canvImg-6.9 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor s .c bbox i1 } {5 15 35 30} -test canvImg-6.10 {ComputeImageBbox procedure} { +test canvImg-6.10 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor sw .c bbox i1 } {20 15 50 30} -test canvImg-6.11 {ComputeImageBbox procedure} { +test canvImg-6.11 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor w .c bbox i1 } {20 23 50 38} -test canvImg-6.12 {ComputeImageBbox procedure} { +test canvImg-6.12 {ComputeImageBbox procedure} testImageType { .c delete all .c create image 20 30 -image foo -tags i1 -anchor center .c bbox i1 @@ -219,7 +210,7 @@ test canvImg-6.12 {ComputeImageBbox procedure} { # The following test is non-portable because of differences in # coordinate rounding on some machines (does 0.5 round up?). -test canvImg-7.1 {DisplayImage procedure} {nonPortable} { +test canvImg-7.1 {DisplayImage procedure} {nonPortable testImageType} { .c delete all .c create image 50 100 -image foo -tags i1 -anchor nw update @@ -238,7 +229,9 @@ test canvImg-7.2 {DisplayImage procedure, no image} { set i 1 .c delete all -.c create image 50 100 -image foo -tags image -anchor nw +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}} @@ -260,7 +253,7 @@ foreach check { {{60 70 69 109} {70 110} {image}} {{60 70 71 111} {70 110} {rect}} } { - test canvImg-8.$i {ImageToPoint procedure} { + 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] @@ -268,94 +261,96 @@ foreach check { } .c delete all -.c create image 50 100 -image foo -tags image -anchor nw -test canvImg-8.19 {ImageToArea procedure} { +if {[testConstraint testImageType]} { + .c create image 50 100 -image foo -tags image -anchor nw +} +test canvImg-8.19 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 60 0 70 99] } {} -test canvImg-8.20 {ImageToArea procedure} { +test canvImg-8.20 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 60 0 70 99.999] } {} -test canvImg-8.21 {ImageToArea procedure} { +test canvImg-8.21 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 60 0 70 101] } {image} -test canvImg-8.22 {ImageToArea procedure} { +test canvImg-8.22 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 81 105 120 115] } {} -test canvImg-8.23 {ImageToArea procedure} { +test canvImg-8.23 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 80.001 105 120 115] } {} -test canvImg-8.24 {ImageToArea procedure} { +test canvImg-8.24 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 79 105 120 115] } {image} -test canvImg-8.25 {ImageToArea procedure} { +test canvImg-8.25 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 60 116 70 150] } {} -test canvImg-8.26 {ImageToArea procedure} { +test canvImg-8.26 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 60 115.001 70 150] } {} -test canvImg-8.27 {ImageToArea procedure} { +test canvImg-8.27 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 60 114 70 150] } {image} -test canvImg-8.28 {ImageToArea procedure} { +test canvImg-8.28 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 0 105 49 115] } {} -test canvImg-8.29 {ImageToArea procedure} { +test canvImg-8.29 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 0 105 50 114.999] } {} -test canvImg-8.30 {ImageToArea procedure} { +test canvImg-8.30 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 0 105 51 115] } {image} -test canvImg-8.31 {ImageToArea procedure} { +test canvImg-8.31 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 0 0 49.999 99.999] } {} -test canvImg-8.32 {ImageToArea procedure} { +test canvImg-8.32 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 0 0 51 101] } {image} -test canvImg-8.33 {ImageToArea procedure} { +test canvImg-8.33 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 80 0 150 100] } {} -test canvImg-8.34 {ImageToArea procedure} { +test canvImg-8.34 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 79 0 150 101] } {image} -test canvImg-8.35 {ImageToArea procedure} { +test canvImg-8.35 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 80.001 115.001 150 180] } {} -test canvImg-8.36 {ImageToArea procedure} { +test canvImg-8.36 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 79 114 150 180] } {image} -test canvImg-8.37 {ImageToArea procedure} { +test canvImg-8.37 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 0 115 50 180] } {} -test canvImg-8.38 {ImageToArea procedure} { +test canvImg-8.38 {ImageToArea procedure} testImageType { .c gettags [.c find overlapping 0 114 51 180] } {image} -test canvImg-8.39 {ImageToArea procedure} { +test canvImg-8.39 {ImageToArea procedure} testImageType { .c gettags [.c find enclosed 0 0 200 200] } {image} -test canvImg-8.40 {ImageToArea procedure} { +test canvImg-8.40 {ImageToArea procedure} testImageType { .c gettags [.c find enclosed 49.999 99.999 80.001 115.001] } {image} -test canvImg-8.41 {ImageToArea procedure} { +test canvImg-8.41 {ImageToArea procedure} testImageType { .c gettags [.c find enclosed 51 100 80 115] } {} -test canvImg-8.42 {ImageToArea procedure} { +test canvImg-8.42 {ImageToArea procedure} testImageType { .c gettags [.c find enclosed 50 101 80 115] } {} -test canvImg-8.43 {ImageToArea procedure} { +test canvImg-8.43 {ImageToArea procedure} testImageType { .c gettags [.c find enclosed 50 100 79 115] } {} -test canvImg-8.44 {ImageToArea procedure} { +test canvImg-8.44 {ImageToArea procedure} testImageType { .c gettags [.c find enclosed 50 100 80 114] } {} -test canvImg-9.1 {DisplayImage procedure} { +test canvImg-9.1 {DisplayImage procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags image -anchor nw .c scale image 25 0 2.0 1.5 .c bbox image } {75 150 105 165} -test canvImg-10.1 {TranslateImage procedure} { +test canvImg-10.1 {TranslateImage procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags image -anchor nw update @@ -365,7 +360,7 @@ test canvImg-10.1 {TranslateImage procedure} { set x } {{foo display 2 4 6 8 30 30}} -test canvImg-11.1 {TranslateImage procedure} { +test canvImg-11.1 {TranslateImage procedure} testImageType { .c delete all .c create image 50 100 -image foo -tags image -anchor nw update @@ -374,7 +369,7 @@ test canvImg-11.1 {TranslateImage procedure} { update set x } {{foo display 0 0 40 50 30 30}} -test canvImg-11.2 {ImageChangedProc procedure} { +test canvImg-11.2 {ImageChangedProc procedure} testImageType { .c delete all image create test foo -variable x .c create image 50 100 -image foo -tags image -anchor center @@ -383,7 +378,7 @@ test canvImg-11.2 {ImageChangedProc procedure} { foo changed 0 0 0 0 40 50 .c bbox image } {30 75 70 125} -test canvImg-11.3 {ImageChangedProc procedure} { +test canvImg-11.3 {ImageChangedProc procedure} testImageType { .c delete all image create test foo -variable x foo changed 0 0 0 0 40 50 |