1 |
578 |
markom |
# This file is a Tcl script to test out images of type "bitmap" (i.e.,
|
2 |
|
|
# the procedures in the file tkImgBmap.c). It is organized in the
|
3 |
|
|
# standard fashion for Tcl tests.
|
4 |
|
|
#
|
5 |
|
|
# Copyright (c) 1994 The Regents of the University of California.
|
6 |
|
|
# Copyright (c) 1994-1995 Sun Microsystems, Inc.
|
7 |
|
|
#
|
8 |
|
|
# See the file "license.terms" for information on usage and redistribution
|
9 |
|
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
10 |
|
|
#
|
11 |
|
|
# RCS: @(#) $Id: imgBmap.test,v 1.1.1.1 2002-01-16 10:25:58 markom Exp $
|
12 |
|
|
|
13 |
|
|
if {[info procs test] != "test"} {
|
14 |
|
|
source defs
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
foreach i [winfo children .] {
|
18 |
|
|
destroy $i
|
19 |
|
|
}
|
20 |
|
|
wm geometry . {}
|
21 |
|
|
raise .
|
22 |
|
|
|
23 |
|
|
set data1 {#define foo_width 16
|
24 |
|
|
#define foo_height 16
|
25 |
|
|
#define foo_x_hot 3
|
26 |
|
|
#define foo_y_hot 3
|
27 |
|
|
static unsigned char foo_bits[] = {
|
28 |
|
|
0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
|
29 |
|
|
0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
|
30 |
|
|
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff};
|
31 |
|
|
}
|
32 |
|
|
set data2 {
|
33 |
|
|
#define foo2_width 16
|
34 |
|
|
#define foo2_height 16
|
35 |
|
|
static char foo2_bits[] = {
|
36 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
37 |
|
|
0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
38 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0xff};
|
39 |
|
|
}
|
40 |
|
|
makeFile $data1 foo.bm
|
41 |
|
|
makeFile $data2 foo2.bm
|
42 |
|
|
|
43 |
|
|
eval image delete [image names]
|
44 |
|
|
canvas .c
|
45 |
|
|
pack .c
|
46 |
|
|
update
|
47 |
|
|
image create bitmap i1
|
48 |
|
|
.c create image 200 100 -image i1
|
49 |
|
|
update
|
50 |
|
|
proc bgerror msg {
|
51 |
|
|
global errMsg
|
52 |
|
|
set errMsg $msg
|
53 |
|
|
}
|
54 |
|
|
test imageBmap-1.1 {options for bitmap images} {
|
55 |
|
|
image create bitmap i1 -background #123456
|
56 |
|
|
lindex [i1 configure -background] 4
|
57 |
|
|
} {#123456}
|
58 |
|
|
test imageBmap-1.2 {options for bitmap images} {
|
59 |
|
|
set errMsg {}
|
60 |
|
|
image create bitmap i1 -background lousy
|
61 |
|
|
update
|
62 |
|
|
list $errMsg $errorInfo
|
63 |
|
|
} {{unknown color name "lousy"} {unknown color name "lousy"
|
64 |
|
|
(while configuring image "i1")}}
|
65 |
|
|
test imageBmap-1.3 {options for bitmap images} {
|
66 |
|
|
image create bitmap i1 -data $data1
|
67 |
|
|
lindex [i1 configure -data] 4
|
68 |
|
|
} $data1
|
69 |
|
|
test imageBmap-1.4 {options for bitmap images} {
|
70 |
|
|
list [catch {image create bitmap i1 -data bogus} msg] $msg
|
71 |
|
|
} {1 {format error in bitmap data}}
|
72 |
|
|
test imageBmap-1.5 {options for bitmap images} {
|
73 |
|
|
image create bitmap i1 -file foo.bm
|
74 |
|
|
lindex [i1 configure -file] 4
|
75 |
|
|
} foo.bm
|
76 |
|
|
test imageBmap-1.6 {options for bitmap images} {
|
77 |
|
|
list [catch {image create bitmap i1 -file bogus} msg] [string tolower $msg]
|
78 |
|
|
} {1 {couldn't read bitmap file "bogus": no such file or directory}}
|
79 |
|
|
test imageBmap-1.7 {options for bitmap images} {
|
80 |
|
|
image create bitmap i1 -foreground #00ff00
|
81 |
|
|
lindex [i1 configure -foreground] 4
|
82 |
|
|
} {#00ff00}
|
83 |
|
|
test imageBmap-1.8 {options for bitmap images} {
|
84 |
|
|
set errMsg {}
|
85 |
|
|
image create bitmap i1 -foreground bad_color
|
86 |
|
|
update
|
87 |
|
|
list $errMsg $errorInfo
|
88 |
|
|
} {{unknown color name "bad_color"} {unknown color name "bad_color"
|
89 |
|
|
(while configuring image "i1")}}
|
90 |
|
|
test imageBmap-1.9 {options for bitmap images} {
|
91 |
|
|
image create bitmap i1 -data $data1 -maskdata $data2
|
92 |
|
|
lindex [i1 configure -maskdata] 4
|
93 |
|
|
} $data2
|
94 |
|
|
test imageBmap-1.10 {options for bitmap images} {
|
95 |
|
|
list [catch {image create bitmap i1 -data $data1 -maskdata bogus} msg] $msg
|
96 |
|
|
} {1 {format error in bitmap data}}
|
97 |
|
|
test imageBmap-1.11 {options for bitmap images} {
|
98 |
|
|
image create bitmap i1 -file foo.bm -maskfile foo2.bm
|
99 |
|
|
lindex [i1 configure -maskfile] 4
|
100 |
|
|
} foo2.bm
|
101 |
|
|
test imageBmap-1.12 {options for bitmap images} {
|
102 |
|
|
list [catch {image create bitmap i1 -data $data1 -maskfile bogus} msg] \
|
103 |
|
|
[string tolower $msg]
|
104 |
|
|
} {1 {couldn't read bitmap file "bogus": no such file or directory}}
|
105 |
|
|
rename bgerror {}
|
106 |
|
|
|
107 |
|
|
test imageBmap-2.1 {ImgBmapCreate procedure} {
|
108 |
|
|
eval image delete [image names]
|
109 |
|
|
.c delete all
|
110 |
|
|
list [catch {image create bitmap -gorp dum} msg] $msg [image names]
|
111 |
|
|
} {1 {unknown option "-gorp"} {}}
|
112 |
|
|
test imageBmap-2.2 {ImgBmapCreate procedure} {
|
113 |
|
|
eval image delete [image names]
|
114 |
|
|
.c delete all
|
115 |
|
|
image create bitmap image1
|
116 |
|
|
list [info commands image1] [image names] \
|
117 |
|
|
[image width image1] [image height image1] \
|
118 |
|
|
[lindex [image1 configure -foreground] 4] \
|
119 |
|
|
[lindex [image1 configure -background] 4]
|
120 |
|
|
} {image1 image1 0 0 #000000 {}}
|
121 |
|
|
|
122 |
|
|
test imageBmap-3.1 {ImgBmapConfigureMaster procedure, memory de-allocation} {
|
123 |
|
|
image create bitmap i1 -data $data1
|
124 |
|
|
i1 configure -data $data1
|
125 |
|
|
} {}
|
126 |
|
|
test imageBmap-3.2 {ImgBmapConfigureMaster procedure} {
|
127 |
|
|
image create bitmap i1 -data $data1
|
128 |
|
|
list [catch {i1 configure -data bogus} msg] $msg [image width i1] \
|
129 |
|
|
[image height i1]
|
130 |
|
|
} {1 {format error in bitmap data} 16 16}
|
131 |
|
|
test imageBmap-3.3 {ImgBmapConfigureMaster procedure, memory de-allocation} {
|
132 |
|
|
image create bitmap i1 -data $data1 -maskdata $data2
|
133 |
|
|
i1 configure -maskdata $data2
|
134 |
|
|
} {}
|
135 |
|
|
test imageBmap-3.4 {ImgBmapConfigureMaster procedure} {
|
136 |
|
|
image create bitmap i1
|
137 |
|
|
list [catch {i1 configure -maskdata $data2} msg] $msg
|
138 |
|
|
} {1 {can't have mask without bitmap}}
|
139 |
|
|
test imageBmap-3.5 {ImgBmapConfigureMaster procedure} {
|
140 |
|
|
list [catch {image create bitmap i1 -data $data1 -maskdata {
|
141 |
|
|
#define foo_width 8
|
142 |
|
|
#define foo_height 16
|
143 |
|
|
static char foo_bits[] = {
|
144 |
|
|
0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
|
145 |
|
|
0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};
|
146 |
|
|
}
|
147 |
|
|
} msg] $msg
|
148 |
|
|
} {1 {bitmap and mask have different sizes}}
|
149 |
|
|
test imageBmap-3.6 {ImgBmapConfigureMaster procedure} {
|
150 |
|
|
list [catch {image create bitmap i1 -data $data1 -maskdata {
|
151 |
|
|
#define foo_width 16
|
152 |
|
|
#define foo_height 8
|
153 |
|
|
static char foo_bits[] = {
|
154 |
|
|
0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
|
155 |
|
|
0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};
|
156 |
|
|
}
|
157 |
|
|
} msg] $msg
|
158 |
|
|
} {1 {bitmap and mask have different sizes}}
|
159 |
|
|
test imageBmap-3.7 {ImgBmapConfigureMaster procedure} {
|
160 |
|
|
image create bitmap i1 -data $data1
|
161 |
|
|
.c create image 100 100 -image i1 -tags i1.1 -anchor nw
|
162 |
|
|
.c create image 200 100 -image i1 -tags i1.2 -anchor nw
|
163 |
|
|
update
|
164 |
|
|
i1 configure -data {
|
165 |
|
|
#define foo2_height 14
|
166 |
|
|
#define foo2_width 15
|
167 |
|
|
static char foo2_bits[] = {
|
168 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
169 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
|
170 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
171 |
|
|
0xff, 0xff};
|
172 |
|
|
}
|
173 |
|
|
update
|
174 |
|
|
list [image width i1] [image height i1] [.c bbox i1.1] [.c bbox i1.2]
|
175 |
|
|
} {15 14 {100 100 115 114} {200 100 215 114}}
|
176 |
|
|
|
177 |
|
|
test imageBmap-4.1 {ImgBmapConfigureInstance procedure: check error handling} {
|
178 |
|
|
proc bgerror args {}
|
179 |
|
|
.c delete all
|
180 |
|
|
image create bitmap i1 -file foo.bm
|
181 |
|
|
.c create image 100 100 -image i1
|
182 |
|
|
update
|
183 |
|
|
i1 configure -foreground bogus
|
184 |
|
|
update
|
185 |
|
|
} {}
|
186 |
|
|
|
187 |
|
|
test imageBmap-5.1 {GetBitmapData procedure} {
|
188 |
|
|
list [catch {image create bitmap -file ~bad_user/a/b} msg] \
|
189 |
|
|
[string tolower $msg]
|
190 |
|
|
} {1 {user "bad_user" doesn't exist}}
|
191 |
|
|
test imageBmap-5.2 {GetBitmapData procedure} {
|
192 |
|
|
list [catch {image create bitmap -file bad_name} msg] [string tolower $msg]
|
193 |
|
|
} {1 {couldn't read bitmap file "bad_name": no such file or directory}}
|
194 |
|
|
test imageBmap-5.3 {GetBitmapData procedure} {
|
195 |
|
|
eval image delete [image names]
|
196 |
|
|
.c delete all
|
197 |
|
|
list [catch {image create bitmap -data { }} msg] $msg
|
198 |
|
|
} {1 {format error in bitmap data}}
|
199 |
|
|
test imageBmap-5.4 {GetBitmapData procedure} {
|
200 |
|
|
eval image delete [image names]
|
201 |
|
|
.c delete all
|
202 |
|
|
list [catch {image create bitmap -data {#define foo2_width}} msg] $msg
|
203 |
|
|
} {1 {format error in bitmap data}}
|
204 |
|
|
test imageBmap-5.5 {GetBitmapData procedure} {
|
205 |
|
|
eval image delete [image names]
|
206 |
|
|
.c delete all
|
207 |
|
|
list [catch {image create bitmap -data {#define foo2_width gorp}} msg] $msg
|
208 |
|
|
} {1 {format error in bitmap data}}
|
209 |
|
|
test imageBmap-5.6 {GetBitmapData procedure} {
|
210 |
|
|
eval image delete [image names]
|
211 |
|
|
.c delete all
|
212 |
|
|
list [catch {image create bitmap -data {#define foo2_width 1.4}} msg] $msg
|
213 |
|
|
} {1 {format error in bitmap data}}
|
214 |
|
|
test imageBmap-5.7 {GetBitmapData procedure} {
|
215 |
|
|
eval image delete [image names]
|
216 |
|
|
.c delete all
|
217 |
|
|
list [catch {image create bitmap -data {#define foo2_height}} msg] $msg
|
218 |
|
|
} {1 {format error in bitmap data}}
|
219 |
|
|
test imageBmap-5.8 {GetBitmapData procedure} {
|
220 |
|
|
eval image delete [image names]
|
221 |
|
|
.c delete all
|
222 |
|
|
list [catch {image create bitmap -data {#define foo2_height gorp}} msg] $msg
|
223 |
|
|
} {1 {format error in bitmap data}}
|
224 |
|
|
test imageBmap-5.9 {GetBitmapData procedure} {
|
225 |
|
|
eval image delete [image names]
|
226 |
|
|
.c delete all
|
227 |
|
|
list [catch {image create bitmap -data {#define foo2_height 1.4}} msg] $msg
|
228 |
|
|
} {1 {format error in bitmap data}}
|
229 |
|
|
test imageBmap-5.10 {GetBitmapData procedure} {
|
230 |
|
|
eval image delete [image names]
|
231 |
|
|
.c delete all
|
232 |
|
|
image create bitmap i1 -data {
|
233 |
|
|
#define foo2_height 14
|
234 |
|
|
#define foo2_width 15 xx _widtg 18 xwidth 18 _heighz 18 xheight 18
|
235 |
|
|
static char foo2_bits[] = {
|
236 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
237 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
|
238 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
239 |
|
|
0xff, 0xff};
|
240 |
|
|
}
|
241 |
|
|
list [image width i1] [image height i1]
|
242 |
|
|
} {15 14}
|
243 |
|
|
test imageBmap-5.11 {GetBitmapData procedure} {
|
244 |
|
|
eval image delete [image names]
|
245 |
|
|
.c delete all
|
246 |
|
|
image create bitmap i1 -data {
|
247 |
|
|
_height 14 _width 15
|
248 |
|
|
char {
|
249 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
250 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
|
251 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
252 |
|
|
0xff, 0xff}
|
253 |
|
|
}
|
254 |
|
|
list [image width i1] [image height i1]
|
255 |
|
|
} {15 14}
|
256 |
|
|
test imageBmap-5.12 {GetBitmapData procedure} {
|
257 |
|
|
eval image delete [image names]
|
258 |
|
|
.c delete all
|
259 |
|
|
list [catch {image create bitmap i1 -data {
|
260 |
|
|
#define foo2_height 14
|
261 |
|
|
#define foo2_width 15
|
262 |
|
|
static short foo2_bits[] = {
|
263 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
264 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
|
265 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
266 |
|
|
0xff, 0xff};
|
267 |
|
|
}} msg] $msg
|
268 |
|
|
} {1 {format error in bitmap data; looks like it's an obsolete X10 bitmap file}}
|
269 |
|
|
test imageBmap-5.13 {GetBitmapData procedure} {
|
270 |
|
|
eval image delete [image names]
|
271 |
|
|
.c delete all
|
272 |
|
|
list [catch {image create bitmap i1 -data {
|
273 |
|
|
#define foo2_height 16
|
274 |
|
|
#define foo2_width 16
|
275 |
|
|
static char foo2_bits[] =
|
276 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
277 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
|
278 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
279 |
|
|
0xff, 0xff;
|
280 |
|
|
}} msg] $msg
|
281 |
|
|
} {1 {format error in bitmap data}}
|
282 |
|
|
test imageBmap-5.14 {GetBitmapData procedure} {
|
283 |
|
|
eval image delete [image names]
|
284 |
|
|
.c delete all
|
285 |
|
|
list [catch {image create bitmap i1 -data {
|
286 |
|
|
#define foo2_width 16
|
287 |
|
|
static char foo2_bits[] = {
|
288 |
|
|
0xff, 0xff, 0xff, }}} msg] $msg
|
289 |
|
|
} {1 {format error in bitmap data}}
|
290 |
|
|
test imageBmap-5.15 {GetBitmapData procedure} {
|
291 |
|
|
eval image delete [image names]
|
292 |
|
|
.c delete all
|
293 |
|
|
list [catch {image create bitmap i1 -data {
|
294 |
|
|
#define foo2_height 16
|
295 |
|
|
static char foo2_bits[] = {
|
296 |
|
|
0xff, 0xff, 0xff, }}} msg] $msg
|
297 |
|
|
} {1 {format error in bitmap data}}
|
298 |
|
|
test imageBmap-5.16 {GetBitmapData procedure} {
|
299 |
|
|
eval image delete [image names]
|
300 |
|
|
.c delete all
|
301 |
|
|
list [catch {image create bitmap i1 -data {
|
302 |
|
|
#define foo2_height 16
|
303 |
|
|
#define foo2_width 16
|
304 |
|
|
static char foo2_bits[] = {
|
305 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
306 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
|
307 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
308 |
|
|
0xff, foo};
|
309 |
|
|
}} msg] $msg
|
310 |
|
|
} {1 {format error in bitmap data}}
|
311 |
|
|
test imageBmap-5.17 {GetBitmapData procedure} {
|
312 |
|
|
eval image delete [image names]
|
313 |
|
|
.c delete all
|
314 |
|
|
list [catch {image create bitmap i1 -data "
|
315 |
|
|
#define foo2_height 16
|
316 |
|
|
#define foo2_width 16
|
317 |
|
|
static char foo2_bits[] = \{
|
318 |
|
|
0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
319 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,
|
320 |
|
|
0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,
|
321 |
|
|
0xff
|
322 |
|
|
"} msg] $msg
|
323 |
|
|
} {1 {format error in bitmap data}}
|
324 |
|
|
|
325 |
|
|
test imageBmap-6.1 {NextBitmapWord procedure} {
|
326 |
|
|
eval image delete [image names]
|
327 |
|
|
.c delete all
|
328 |
|
|
list [catch {image create bitmap i1 -data {1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890}} msg] $msg
|
329 |
|
|
} {1 {format error in bitmap data}}
|
330 |
|
|
test imageBmap-6.2 {NextBitmapWord procedure} {
|
331 |
|
|
eval image delete [image names]
|
332 |
|
|
.c delete all
|
333 |
|
|
makeFile {1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890} foo3.bm
|
334 |
|
|
list [catch {image create bitmap i1 -file foo3.bm} msg] $msg
|
335 |
|
|
} {1 {format error in bitmap data}}
|
336 |
|
|
test imageBmap-6.3 {NextBitmapWord procedure} {
|
337 |
|
|
eval image delete [image names]
|
338 |
|
|
.c delete all
|
339 |
|
|
makeFile { } foo3.bm
|
340 |
|
|
list [catch {image create bitmap i1 -file foo3.bm} msg] $msg
|
341 |
|
|
} {1 {format error in bitmap data}}
|
342 |
|
|
removeFile foo3.bm
|
343 |
|
|
|
344 |
|
|
eval image delete [image names]
|
345 |
|
|
.c delete all
|
346 |
|
|
image create bitmap i1
|
347 |
|
|
test imageBmap-7.1 {ImgBmapCmd procedure} {
|
348 |
|
|
list [catch {i1} msg] $msg
|
349 |
|
|
} {1 {wrong # args: should be "i1 option ?arg arg ...?"}}
|
350 |
|
|
test imageBmap-7.2 {ImgBmapCmd procedure, "cget" option} {
|
351 |
|
|
list [catch {i1 cget} msg] $msg
|
352 |
|
|
} {1 {wrong # args: should be "i1 cget option"}}
|
353 |
|
|
test imageBmap-7.3 {ImgBmapCmd procedure, "cget" option} {
|
354 |
|
|
list [catch {i1 cget a b} msg] $msg
|
355 |
|
|
} {1 {wrong # args: should be "i1 cget option"}}
|
356 |
|
|
test imageBmap-7.4 {ImgBmapCmd procedure, "cget" option} {
|
357 |
|
|
i1 co -foreground #123456
|
358 |
|
|
i1 cget -foreground
|
359 |
|
|
} {#123456}
|
360 |
|
|
test imageBmap-7.5 {ImgBmapCmd procedure, "cget" option} {
|
361 |
|
|
list [catch {i1 cget -stupid} msg] $msg
|
362 |
|
|
} {1 {unknown option "-stupid"}}
|
363 |
|
|
test imageBmap-7.6 {ImgBmapCmd procedure} {
|
364 |
|
|
llength [i1 configure]
|
365 |
|
|
} {6}
|
366 |
|
|
test imageBmap-7.7 {ImgBmapCmd procedure} {
|
367 |
|
|
i1 co -foreground #001122
|
368 |
|
|
i1 configure -foreground
|
369 |
|
|
} {-foreground {} {} #000000 #001122}
|
370 |
|
|
test imageBmap-7.8 {ImgBmapCmd procedure} {
|
371 |
|
|
list [catch {i1 configure -gorp} msg] $msg
|
372 |
|
|
} {1 {unknown option "-gorp"}}
|
373 |
|
|
test imageBmap-7.9 {ImgBmapCmd procedure} {
|
374 |
|
|
list [catch {i1 configure -foreground #221100 -background} msg] $msg
|
375 |
|
|
} {1 {value for "-background" missing}}
|
376 |
|
|
test imageBmap-7.10 {ImgBmapCmd procedure} {
|
377 |
|
|
list [catch {i1 gorp} msg] $msg
|
378 |
|
|
} {1 {bad option "gorp": must be cget or configure}}
|
379 |
|
|
|
380 |
|
|
test imageBmap-8.1 {ImgBmapGet/Free procedures, shared instances} {
|
381 |
|
|
eval image delete [image names]
|
382 |
|
|
.c delete all
|
383 |
|
|
image create bitmap i1 -data $data1
|
384 |
|
|
.c create image 50 100 -image i1 -tags i1.1
|
385 |
|
|
.c create image 150 100 -image i1 -tags i1.2
|
386 |
|
|
.c create image 250 100 -image i1 -tags i1.3
|
387 |
|
|
update
|
388 |
|
|
.c delete i1.1
|
389 |
|
|
i1 configure -background black
|
390 |
|
|
update
|
391 |
|
|
.c delete i1.2
|
392 |
|
|
i1 configure -background white
|
393 |
|
|
update
|
394 |
|
|
.c delete i1.3
|
395 |
|
|
i1 configure -background black
|
396 |
|
|
update
|
397 |
|
|
image delete i1
|
398 |
|
|
} {}
|
399 |
|
|
|
400 |
|
|
test imageBmap-9.1 {ImgBmapDisplay procedure, nothing to display} {
|
401 |
|
|
proc bgerror args {}
|
402 |
|
|
eval image delete [image names]
|
403 |
|
|
.c delete all
|
404 |
|
|
image create bitmap i1 -data $data1
|
405 |
|
|
.c create image 50 100 -image i1 -tags i1.1
|
406 |
|
|
i1 configure -data {}
|
407 |
|
|
update
|
408 |
|
|
} {}
|
409 |
|
|
test imageBmap-9.2 {ImgBmapDisplay procedure, nothing to display} {
|
410 |
|
|
proc bgerror args {}
|
411 |
|
|
eval image delete [image names]
|
412 |
|
|
.c delete all
|
413 |
|
|
image create bitmap i1 -data $data1
|
414 |
|
|
.c create image 50 100 -image i1 -tags i1.1
|
415 |
|
|
i1 configure -foreground bogus
|
416 |
|
|
update
|
417 |
|
|
} {}
|
418 |
|
|
if {[info exists bgerror]} {
|
419 |
|
|
rename bgerror {}
|
420 |
|
|
}
|
421 |
|
|
|
422 |
|
|
test imageBmap-10.1 {ImgBmapFree procedure, resource freeing} {
|
423 |
|
|
eval image delete [image names]
|
424 |
|
|
.c delete all
|
425 |
|
|
image create bitmap i1 -data $data1 -maskdata $data2 -foreground #112233 \
|
426 |
|
|
-background #445566
|
427 |
|
|
.c create image 100 100 -image i1
|
428 |
|
|
update
|
429 |
|
|
.c delete all
|
430 |
|
|
image delete i1
|
431 |
|
|
} {}
|
432 |
|
|
test imageBmap-10.2 {ImgBmapFree procedures, unlinking} {
|
433 |
|
|
eval image delete [image names]
|
434 |
|
|
.c delete all
|
435 |
|
|
image create bitmap i1 -data $data1 -maskdata $data2 -foreground #112233 \
|
436 |
|
|
-background #445566
|
437 |
|
|
.c create image 100 100 -image i1
|
438 |
|
|
button .b1 -image i1
|
439 |
|
|
button .b2 -image i1
|
440 |
|
|
button .b3 -image i1
|
441 |
|
|
pack .b1 .b2 .b3
|
442 |
|
|
update
|
443 |
|
|
destroy .b2
|
444 |
|
|
update
|
445 |
|
|
destroy .b3
|
446 |
|
|
update
|
447 |
|
|
destroy .b1
|
448 |
|
|
update
|
449 |
|
|
.c delete all
|
450 |
|
|
} {}
|
451 |
|
|
|
452 |
|
|
test imageBmap-11.1 {ImgBmapDelete procedure} {
|
453 |
|
|
image create bitmap i2 -file foo.bm -maskfile foo2.bm
|
454 |
|
|
image delete i2
|
455 |
|
|
info command i2
|
456 |
|
|
} {}
|
457 |
|
|
test imageBmap-11.2 {ImgBmapDelete procedure} {
|
458 |
|
|
image create bitmap i2 -file foo.bm -maskfile foo2.bm
|
459 |
|
|
rename i2 newi2
|
460 |
|
|
set x [list [info command i2] [info command new*] [newi2 cget -file]]
|
461 |
|
|
image delete i2
|
462 |
|
|
lappend x [info command new*]
|
463 |
|
|
} {{} newi2 foo.bm {}}
|
464 |
|
|
|
465 |
|
|
test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} {
|
466 |
|
|
image create bitmap i2 -file foo.bm -maskfile foo2.bm
|
467 |
|
|
rename i2 {}
|
468 |
|
|
list [lsearch -exact [image names] i2] [catch {i2 foo} msg] $msg
|
469 |
|
|
} {-1 1 {invalid command name "i2"}}
|
470 |
|
|
|
471 |
|
|
removeFile foo.bm
|
472 |
|
|
removeFile foo2.bm
|
473 |
|
|
destroy .c
|
474 |
|
|
eval image delete [image names]
|