summaryrefslogtreecommitdiffstats
path: root/tests/imgBmap.test
diff options
context:
space:
mode:
authoraniap <aniap>2008-08-17 19:40:33 (GMT)
committeraniap <aniap>2008-08-17 19:40:33 (GMT)
commit1cdabdfeb535511baa7e1d8f4f9eafec265b4eed (patch)
tree9825bdbd42abaec836fbd3853bebf74e62dc5f6d /tests/imgBmap.test
parent46857f9107524a73facc3eacc7a12c002c820635 (diff)
downloadtk-1cdabdfeb535511baa7e1d8f4f9eafec265b4eed.zip
tk-1cdabdfeb535511baa7e1d8f4f9eafec265b4eed.tar.gz
tk-1cdabdfeb535511baa7e1d8f4f9eafec265b4eed.tar.bz2
Update to tcltest2
Diffstat (limited to 'tests/imgBmap.test')
-rw-r--r--tests/imgBmap.test460
1 files changed, 268 insertions, 192 deletions
diff --git a/tests/imgBmap.test b/tests/imgBmap.test
index ffb8e29..87dc4ae 100644
--- a/tests/imgBmap.test
+++ b/tests/imgBmap.test
@@ -7,9 +7,10 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: imgBmap.test,v 1.7 2008/07/23 23:24:25 nijtmans Exp $
+# RCS: @(#) $Id: imgBmap.test,v 1.8 2008/08/17 19:40:33 aniap Exp $
-package require tcltest 2.1
+package require tcltest 2.2
+namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -34,122 +35,153 @@ makeFile $data1 foo.bm
makeFile $data2 foo2.bm
eval image delete [image names]
-canvas .c
-pack .c
-update
-image create bitmap i1
-.c create image 200 100 -image i1
+#canvas .c
+#pack .c
+#update
+#image create bitmap i1
+#.c create image 200 100 -image i1
update
proc bgerror msg {
global errMsg
set errMsg $msg
}
-test imageBmap-1.1 {options for bitmap images} {
+
+test imageBmap-1.1 {options for bitmap images} -body {
image create bitmap i1 -background #123456
lindex [i1 configure -background] 4
-} {#123456}
-test imageBmap-1.2 {options for bitmap images} {
+} -cleanup {
+ image delete i1
+} -result {#123456}
+test imageBmap-1.2 {options for bitmap images} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
set errMsg {}
image create bitmap i1 -background lousy
+ .c create image 200 100 -image i1
update
list $errMsg $errorInfo
-} {{unknown color name "lousy"} {unknown color name "lousy"
+} -cleanup {
+ image delete i1
+ destroy .c
+} -result {{unknown color name "lousy"} {unknown color name "lousy"
(while configuring image "i1")}}
-test imageBmap-1.3 {options for bitmap images} {
+test imageBmap-1.3 {options for bitmap images} -body {
image create bitmap i1 -data $data1
lindex [i1 configure -data] 4
-} $data1
-test imageBmap-1.4 {options for bitmap images} {
- list [catch {image create bitmap i1 -data bogus} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-1.5 {options for bitmap images} {
+} -result $data1
+test imageBmap-1.4 {options for bitmap images} -body {
+ image create bitmap i1 -data bogus
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-1.5 {options for bitmap images} -body {
image create bitmap i1 -file foo.bm
lindex [i1 configure -file] 4
-} foo.bm
-test imageBmap-1.6 {options for bitmap images} {
+} -result foo.bm
+test imageBmap-1.6 {options for bitmap images} -body {
list [catch {image create bitmap i1 -file bogus} msg] [string tolower $msg]
-} {1 {couldn't read bitmap file "bogus": no such file or directory}}
-test imageBmap-1.7 {options for bitmap images} {
+} -result {1 {couldn't read bitmap file "bogus": no such file or directory}}
+test imageBmap-1.7 {options for bitmap images} -body {
image create bitmap i1 -foreground #00ff00
lindex [i1 configure -foreground] 4
-} {#00ff00}
-test imageBmap-1.8 {options for bitmap images} {
+} -cleanup {
+ image delete i1
+} -result {#00ff00}
+test imageBmap-1.8 {options for bitmap images} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
set errMsg {}
image create bitmap i1 -foreground bad_color
+ .c create image 200 100 -image i1
update
list $errMsg $errorInfo
-} {{unknown color name "bad_color"} {unknown color name "bad_color"
+} -cleanup {
+ destroy .c
+ image delete i1
+} -result {{unknown color name "bad_color"} {unknown color name "bad_color"
(while configuring image "i1")}}
-test imageBmap-1.9 {options for bitmap images} {
+test imageBmap-1.9 {options for bitmap images} -body {
image create bitmap i1 -data $data1 -maskdata $data2
lindex [i1 configure -maskdata] 4
-} $data2
-test imageBmap-1.10 {options for bitmap images} {
- list [catch {image create bitmap i1 -data $data1 -maskdata bogus} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-1.11 {options for bitmap images} {
+} -result $data2
+test imageBmap-1.10 {options for bitmap images} -body {
+ image create bitmap i1 -data $data1 -maskdata bogus
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-1.11 {options for bitmap images} -body {
image create bitmap i1 -file foo.bm -maskfile foo2.bm
lindex [i1 configure -maskfile] 4
-} foo2.bm
-test imageBmap-1.12 {options for bitmap images} {
+} -result foo2.bm
+test imageBmap-1.12 {options for bitmap images} -body {
list [catch {image create bitmap i1 -data $data1 -maskfile bogus} msg] \
[string tolower $msg]
-} {1 {couldn't read bitmap file "bogus": no such file or directory}}
+} -result {1 {couldn't read bitmap file "bogus": no such file or directory}}
rename bgerror {}
-test imageBmap-2.1 {ImgBmapCreate procedure} {
+
+test imageBmap-2.1 {ImgBmapCreate procedure} -setup {
+ eval image delete [image names]
+} -body {
eval image delete [image names]
- .c delete all
list [catch {image create bitmap -gorp dum} msg] $msg [image names]
-} {1 {unknown option "-gorp"} {}}
-test imageBmap-2.2 {ImgBmapCreate procedure} {
+} -result {1 {unknown option "-gorp"} {}}
+test imageBmap-2.2 {ImgBmapCreate procedure} -setup {
eval image delete [image names]
- .c delete all
+} -body {
image create bitmap image1
list [info commands image1] [image names] \
[image width image1] [image height image1] \
[lindex [image1 configure -foreground] 4] \
[lindex [image1 configure -background] 4]
-} {image1 image1 0 0 #000000 {}}
+} -cleanup {
+ image delete image1
+} -result {image1 image1 0 0 #000000 {}}
-test imageBmap-3.1 {ImgBmapConfigureMaster procedure, memory de-allocation} {
+
+test imageBmap-3.1 {ImgBmapConfigureMaster procedure, memory de-allocation} -body {
image create bitmap i1 -data $data1
i1 configure -data $data1
-} {}
-test imageBmap-3.2 {ImgBmapConfigureMaster procedure} {
+} -cleanup {
+ image delete i1
+} -result {}
+test imageBmap-3.2 {ImgBmapConfigureMaster procedure} -body {
image create bitmap i1 -data $data1
list [catch {i1 configure -data bogus} msg] $msg [image width i1] \
[image height i1]
-} {1 {format error in bitmap data} 16 16}
-test imageBmap-3.3 {ImgBmapConfigureMaster procedure, memory de-allocation} {
+} -result {1 {format error in bitmap data} 16 16}
+test imageBmap-3.3 {ImgBmapConfigureMaster procedure, memory de-allocation} -body {
image create bitmap i1 -data $data1 -maskdata $data2
i1 configure -maskdata $data2
-} {}
-test imageBmap-3.4 {ImgBmapConfigureMaster procedure} {
+} -cleanup {
+ image delete i1
+} -result {}
+test imageBmap-3.4 {ImgBmapConfigureMaster procedure} -body {
image create bitmap i1
- list [catch {i1 configure -maskdata $data2} msg] $msg
-} {1 {can't have mask without bitmap}}
-test imageBmap-3.5 {ImgBmapConfigureMaster procedure} {
- list [catch {image create bitmap i1 -data $data1 -maskdata {
+ i1 configure -maskdata $data2
+} -returnCodes error -result {can't have mask without bitmap}
+test imageBmap-3.5 {ImgBmapConfigureMaster procedure} -body {
+ image create bitmap i1 -data $data1 -maskdata {
#define foo_width 8
#define foo_height 16
static char foo_bits[] = {
0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};
}
- } msg] $msg
-} {1 {bitmap and mask have different sizes}}
-test imageBmap-3.6 {ImgBmapConfigureMaster procedure} {
- list [catch {image create bitmap i1 -data $data1 -maskdata {
+} -returnCodes error -result {bitmap and mask have different sizes}
+test imageBmap-3.6 {ImgBmapConfigureMaster procedure} -body {
+ image create bitmap i1 -data $data1 -maskdata {
#define foo_width 16
#define foo_height 8
static char foo_bits[] = {
0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};
}
- } msg] $msg
-} {1 {bitmap and mask have different sizes}}
-test imageBmap-3.7 {ImgBmapConfigureMaster procedure} {
+} -returnCodes error -result {bitmap and mask have different sizes}
+test imageBmap-3.7 {ImgBmapConfigureMaster procedure} -setup {
+ destroy .c
+ pack [canvas .c]
+} -body {
image create bitmap i1 -data $data1
.c create image 100 100 -image i1 -tags i1.1 -anchor nw
.c create image 200 100 -image i1 -tags i1.2 -anchor nw
@@ -165,63 +197,71 @@ test imageBmap-3.7 {ImgBmapConfigureMaster procedure} {
}
update
list [image width i1] [image height i1] [.c bbox i1.1] [.c bbox i1.2]
-} {15 14 {100 100 115 114} {200 100 215 114}}
+} -cleanup {
+ image delete i1
+ destroy .c
+} -result {15 14 {100 100 115 114} {200 100 215 114}}
+
-test imageBmap-4.1 {ImgBmapConfigureInstance procedure: check error handling} {
+test imageBmap-4.1 {ImgBmapConfigureInstance procedure: check error handling} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
proc bgerror args {}
- .c delete all
image create bitmap i1 -file foo.bm
.c create image 100 100 -image i1
update
i1 configure -foreground bogus
update
-} {}
+} -cleanup {
+ image delete i1
+ destroy .c
+} -result {}
-test imageBmap-5.1 {GetBitmapData procedure} {
+
+test imageBmap-5.1 {GetBitmapData procedure} -body {
list [catch {image create bitmap -file ~bad_user/a/b} msg] \
[string tolower $msg]
-} {1 {user "bad_user" doesn't exist}}
-test imageBmap-5.2 {GetBitmapData procedure} {
+} -result {1 {user "bad_user" doesn't exist}}
+test imageBmap-5.2 {GetBitmapData procedure} -body {
list [catch {image create bitmap -file bad_name} msg] [string tolower $msg]
-} {1 {couldn't read bitmap file "bad_name": no such file or directory}}
-test imageBmap-5.3 {GetBitmapData procedure} {
+} -result {1 {couldn't read bitmap file "bad_name": no such file or directory}}
+test imageBmap-5.3 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap -data { }} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.4 {GetBitmapData procedure} {
+ image create bitmap -data { }
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.4 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap -data {#define foo2_width}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.5 {GetBitmapData procedure} {
+ image create bitmap -data {#define foo2_width}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.5 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap -data {#define foo2_width gorp}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.6 {GetBitmapData procedure} {
+ image create bitmap -data {#define foo2_width gorp}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.6 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap -data {#define foo2_width 1.4}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.7 {GetBitmapData procedure} {
+
+ image create bitmap -data {#define foo2_width 1.4}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.7 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap -data {#define foo2_height}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.8 {GetBitmapData procedure} {
+
+ image create bitmap -data {#define foo2_height}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.8 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap -data {#define foo2_height gorp}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.9 {GetBitmapData procedure} {
+
+ image create bitmap -data {#define foo2_height gorp}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.9 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap -data {#define foo2_height 1.4}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.10 {GetBitmapData procedure} {
+
+ image create bitmap -data {#define foo2_height 1.4}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.10 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
+
image create bitmap i1 -data {
#define foo2_height 14
#define foo2_width 15 xx _widtg 18 xwidth 18 _heighz 18 xheight 18
@@ -232,10 +272,12 @@ test imageBmap-5.10 {GetBitmapData procedure} {
0xff, 0xff};
}
list [image width i1] [image height i1]
-} {15 14}
-test imageBmap-5.11 {GetBitmapData procedure} {
+} -cleanup {
+ image delete i1
+} -result {15 14}
+test imageBmap-5.11 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
+
image create bitmap i1 -data {
_height 14 _width 15
char {
@@ -245,11 +287,13 @@ test imageBmap-5.11 {GetBitmapData procedure} {
0xff, 0xff}
}
list [image width i1] [image height i1]
-} {15 14}
-test imageBmap-5.12 {GetBitmapData procedure} {
+} -cleanup {
+ image delete i1
+} -result {15 14}
+test imageBmap-5.12 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap i1 -data {
+
+ image create bitmap i1 -data {
#define foo2_height 14
#define foo2_width 15
static short foo2_bits[] = {
@@ -257,12 +301,12 @@ test imageBmap-5.12 {GetBitmapData procedure} {
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
0xff, 0xff};
- }} msg] $msg
-} {1 {format error in bitmap data; looks like it's an obsolete X10 bitmap file}}
-test imageBmap-5.13 {GetBitmapData procedure} {
+ }
+} -returnCodes error -result {format error in bitmap data; looks like it's an obsolete X10 bitmap file}
+test imageBmap-5.13 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap i1 -data {
+
+ image create bitmap i1 -data {
#define foo2_height 16
#define foo2_width 16
static char foo2_bits[] =
@@ -270,28 +314,28 @@ test imageBmap-5.13 {GetBitmapData procedure} {
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
0xff, 0xff;
- }} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.14 {GetBitmapData procedure} {
+ }
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.14 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap i1 -data {
+
+ image create bitmap i1 -data {
#define foo2_width 16
static char foo2_bits[] = {
- 0xff, 0xff, 0xff, }}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.15 {GetBitmapData procedure} {
+ 0xff, 0xff, 0xff, }}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.15 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap i1 -data {
+
+ image create bitmap i1 -data {
#define foo2_height 16
static char foo2_bits[] = {
- 0xff, 0xff, 0xff, }}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.16 {GetBitmapData procedure} {
+ 0xff, 0xff, 0xff, }}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.16 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap i1 -data {
+
+ image create bitmap i1 -data {
#define foo2_height 16
#define foo2_width 16
static char foo2_bits[] = {
@@ -299,12 +343,12 @@ test imageBmap-5.16 {GetBitmapData procedure} {
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
0xff, foo};
- }} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-5.17 {GetBitmapData procedure} {
+ }
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-5.17 {GetBitmapData procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap i1 -data "
+
+ image create bitmap i1 -data "
#define foo2_height 16
#define foo2_width 16
static char foo2_bits[] = \{
@@ -312,67 +356,69 @@ test imageBmap-5.17 {GetBitmapData procedure} {
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
0xff
- "} msg] $msg
-} {1 {format error in bitmap data}}
+ "
+} -returnCodes error -result {format error in bitmap data}
-test imageBmap-6.1 {NextBitmapWord procedure} {
+
+test imageBmap-6.1 {NextBitmapWord procedure} -body {
eval image delete [image names]
- .c delete all
- list [catch {image create bitmap i1 -data {1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890}} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-6.2 {NextBitmapWord procedure} {
+ image create bitmap i1 -data {1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890}
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-6.2 {NextBitmapWord procedure} -body {
eval image delete [image names]
- .c delete all
makeFile {1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890} foo3.bm
- list [catch {image create bitmap i1 -file foo3.bm} msg] $msg
-} {1 {format error in bitmap data}}
-test imageBmap-6.3 {NextBitmapWord procedure} {
+ image create bitmap i1 -file foo3.bm
+} -returnCodes error -result {format error in bitmap data}
+test imageBmap-6.3 {NextBitmapWord procedure} -body {
eval image delete [image names]
- .c delete all
makeFile { } foo3.bm
- list [catch {image create bitmap i1 -file foo3.bm} msg] $msg
-} {1 {format error in bitmap data}}
+ image create bitmap i1 -file foo3.bm
+} -returnCodes error -result {format error in bitmap data}
removeFile foo3.bm
+
eval image delete [image names]
-.c delete all
+# Image used in 7.* tests
image create bitmap i1
-test imageBmap-7.1 {ImgBmapCmd procedure} {
- list [catch {i1} msg] $msg
-} {1 {wrong # args: should be "i1 option ?arg ...?"}}
-test imageBmap-7.2 {ImgBmapCmd procedure, "cget" option} {
- list [catch {i1 cget} msg] $msg
-} {1 {wrong # args: should be "i1 cget option"}}
-test imageBmap-7.3 {ImgBmapCmd procedure, "cget" option} {
- list [catch {i1 cget a b} msg] $msg
-} {1 {wrong # args: should be "i1 cget option"}}
-test imageBmap-7.4 {ImgBmapCmd procedure, "cget" option} {
+test imageBmap-7.1 {ImgBmapCmd procedure} -body {
+ i1
+} -returnCodes error -result {wrong # args: should be "i1 option ?arg ...?"}
+test imageBmap-7.2 {ImgBmapCmd procedure, "cget" option} -body {
+ i1 cget
+} -returnCodes error -result {wrong # args: should be "i1 cget option"}
+test imageBmap-7.3 {ImgBmapCmd procedure, "cget" option} -body {
+ i1 cget a b
+} -returnCodes error -result {wrong # args: should be "i1 cget option"}
+test imageBmap-7.4 {ImgBmapCmd procedure, "cget" option} -body {
i1 co -foreground #123456
i1 cget -foreground
-} {#123456}
-test imageBmap-7.5 {ImgBmapCmd procedure, "cget" option} {
- list [catch {i1 cget -stupid} msg] $msg
-} {1 {unknown option "-stupid"}}
-test imageBmap-7.6 {ImgBmapCmd procedure} {
+} -result {#123456}
+test imageBmap-7.5 {ImgBmapCmd procedure, "cget" option} -body {
+ i1 cget -stupid
+} -returnCodes error -result {unknown option "-stupid"}
+test imageBmap-7.6 {ImgBmapCmd procedure} -body {
llength [i1 configure]
-} {6}
-test imageBmap-7.7 {ImgBmapCmd procedure} {
+} -result {6}
+test imageBmap-7.7 {ImgBmapCmd procedure} -body {
i1 co -foreground #001122
i1 configure -foreground
-} {-foreground {} {} #000000 #001122}
-test imageBmap-7.8 {ImgBmapCmd procedure} {
- list [catch {i1 configure -gorp} msg] $msg
-} {1 {unknown option "-gorp"}}
-test imageBmap-7.9 {ImgBmapCmd procedure} {
- list [catch {i1 configure -foreground #221100 -background} msg] $msg
-} {1 {value for "-background" missing}}
-test imageBmap-7.10 {ImgBmapCmd procedure} {
- list [catch {i1 gorp} msg] $msg
-} {1 {bad option "gorp": must be cget or configure}}
-
-test imageBmap-8.1 {ImgBmapGet/Free procedures, shared instances} {
- eval image delete [image names]
- .c delete all
+} -result {-foreground {} {} #000000 #001122}
+test imageBmap-7.8 {ImgBmapCmd procedure} -body {
+ i1 configure -gorp
+} -returnCodes error -result {unknown option "-gorp"}
+test imageBmap-7.9 {ImgBmapCmd procedure} -body {
+ i1 configure -foreground #221100 -background
+} -returnCodes error -result {value for "-background" missing}
+test imageBmap-7.10 {ImgBmapCmd procedure} -body {
+ i1 gorp
+} -returnCodes error -result {bad option "gorp": must be cget or configure}
+
+
+test imageBmap-8.1 {ImgBmapGet/Free procedures, shared instances} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
image create bitmap i1 -data $data1
.c create image 50 100 -image i1 -tags i1.1
.c create image 150 100 -image i1 -tags i1.2
@@ -388,18 +434,31 @@ test imageBmap-8.1 {ImgBmapGet/Free procedures, shared instances} {
i1 configure -background black
update
image delete i1
-} {}
+} -cleanup {
+ destroy .c
+} -result {}
+
-test imageBmap-9.1 {ImgBmapDisplay procedure, nothing to display} {
+test imageBmap-9.1 {ImgBmapDisplay procedure, nothing to display} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
proc bgerror args {}
eval image delete [image names]
- .c delete all
image create bitmap i1 -data $data1
.c create image 50 100 -image i1 -tags i1.1
i1 configure -data {}
update
-} {}
-test imageBmap-9.2 {ImgBmapDisplay procedure, nothing to display} {
+} -cleanup {
+ image delete i1
+ destroy .c
+} -result {}
+test imageBmap-9.2 {ImgBmapDisplay procedure, nothing to display} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
proc bgerror args {}
eval image delete [image names]
.c delete all
@@ -407,24 +466,36 @@ test imageBmap-9.2 {ImgBmapDisplay procedure, nothing to display} {
.c create image 50 100 -image i1 -tags i1.1
i1 configure -foreground bogus
update
-} {}
+} -cleanup {
+ image delete i1
+ destroy .c
+} -result {}
if {[info exists bgerror]} {
rename bgerror {}
}
-test imageBmap-10.1 {ImgBmapFree procedure, resource freeing} {
+
+test imageBmap-10.1 {ImgBmapFree procedure, resource freeing} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
eval image delete [image names]
- .c delete all
image create bitmap i1 -data $data1 -maskdata $data2 -foreground #112233 \
-background #445566
.c create image 100 100 -image i1
update
.c delete all
image delete i1
-} {}
-test imageBmap-10.2 {ImgBmapFree procedures, unlinking} {
+} -cleanup {
+ destroy .c
+} -result {}
+test imageBmap-10.2 {ImgBmapFree procedures, unlinking} -setup {
+ destroy .c
+ pack [canvas .c]
+ update
+} -body {
eval image delete [image names]
- .c delete all
image create bitmap i1 -data $data1 -maskdata $data2 -foreground #112233 \
-background #445566
.c create image 100 100 -image i1
@@ -440,32 +511,37 @@ test imageBmap-10.2 {ImgBmapFree procedures, unlinking} {
destroy .b1
update
.c delete all
-} {}
+} -cleanup {
+ image delete i1
+ deleteWindows
+} -result {}
+
-test imageBmap-11.1 {ImgBmapDelete procedure} {
+test imageBmap-11.1 {ImgBmapDelete procedure} -body {
image create bitmap i2 -file foo.bm -maskfile foo2.bm
image delete i2
info command i2
-} {}
-test imageBmap-11.2 {ImgBmapDelete procedure} {
+} -result {}
+test imageBmap-11.2 {ImgBmapDelete procedure} -body {
image create bitmap i2 -file foo.bm -maskfile foo2.bm
rename i2 newi2
set x [list [info command i2] [info command new*] [newi2 cget -file]]
image delete i2
lappend x [info command new*]
-} {{} newi2 foo.bm {}}
+} -result {{} newi2 foo.bm {}}
-test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} {
+
+test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} -body {
image create bitmap i2 -file foo.bm -maskfile foo2.bm
rename i2 {}
list [lsearch -exact [image names] i2] [catch {i2 foo} msg] $msg
-} {-1 1 {invalid command name "i2"}}
+} -result {-1 1 {invalid command name "i2"}}
removeFile foo.bm
removeFile foo2.bm
-destroy .c
eval image delete [image names]
# cleanup
cleanupTests
return
+