︙ | | |
673
674
675
676
677
678
679
680
681
682
683
684
685
686
|
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
|
+
|
srcY = 0;
}
if (height > imageHeight) {
height = imageHeight;
}
if ((width > 0) && (height > 0)) {
unsigned char* pixelPtr;
Tk_PhotoImageBlock block;
/*
* Read the data and put it into the photo buffer for display by the
* general image machinery.
*/
|
︙ | | |
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
|
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
|
-
-
-
+
+
+
+
-
+
+
-
+
-
+
|
goto error;
}
block.pitch = block.pixelSize * imageWidth;
if (imageHeight > (int)(UINT_MAX/block.pitch)) {
goto error;
}
nBytes = block.pitch * imageHeight;
block.pixelPtr = ckalloc(nBytes);
if (block.pixelPtr) {
memset(block.pixelPtr, 0, nBytes);
pixelPtr = ckalloc(nBytes);
if (pixelPtr) {
memset(pixelPtr, 0, nBytes);
}
block.pixelPtr = pixelPtr;
if (ReadImage(gifConfPtr, interp, block.pixelPtr, chan, imageWidth,
imageHeight, colorMap, srcX, srcY, BitSet(buf[8], INTERLACE),
transparent) != TCL_OK) {
ckfree(block.pixelPtr);
ckfree(pixelPtr);
goto error;
}
block.pixelPtr += srcX * block.pixelSize + srcY * block.pitch;
if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
ckfree(block.pixelPtr);
ckfree(pixelPtr);
goto error;
}
ckfree(block.pixelPtr);
ckfree(pixelPtr);
}
/*
* We've successfully read the GIF frame (or there was nothing to read,
* which suits as well). We're done.
*/
|
︙ | | |
︙ | | |
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
-
+
+
|
static int CheckColor(Tcl_Interp *interp, PNGImage *pngPtr);
static inline int CheckCRC(Tcl_Interp *interp, PNGImage *pngPtr,
unsigned long calculated);
static void CleanupPNGImage(PNGImage *pngPtr);
static int DecodeLine(Tcl_Interp *interp, PNGImage *pngPtr);
static int DecodePNG(Tcl_Interp *interp, PNGImage *pngPtr,
Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle,
int destX, int destY);
int destX, int destY, int width, int height,
int srcX, int srcY);
static int EncodePNG(Tcl_Interp *interp,
Tk_PhotoImageBlock *blockPtr, PNGImage *pngPtr);
static int FileMatchPNG(Tcl_Channel chan, const char *fileName,
Tcl_Obj *fmtObj, int *widthPtr, int *heightPtr,
Tcl_Interp *interp);
static int FileReadPNG(Tcl_Interp *interp, Tcl_Channel chan,
const char *fileName, Tcl_Obj *fmtObj,
|
︙ | | |
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
|
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
|
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
|
* dimensions and contents may change.
*
*----------------------------------------------------------------------
*/
static int
DecodePNG(
Tcl_Interp *interp,
PNGImage *pngPtr,
Tcl_Obj *fmtObj,
Tk_PhotoHandle imageHandle,
int destX,
int destY)
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
PNGImage *pngPtr, /* PNG image information record. */
Tcl_Obj *fmtObj, /* User-specified format object, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
int width, int height, /* Dimensions of block of photo image to be
* written to. */
int srcX, int srcY) /* Coordinates of top-left pixel to be used in
* image being read. */
{
unsigned long chunkType;
int chunkSz;
int result, chunkSz;
unsigned long crc;
/*
* Parse the PNG signature and IHDR (header) chunk.
*/
if (ReadIHDR(interp, pngPtr) == TCL_ERROR) {
|
︙ | | |
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
|
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
|
-
-
+
+
|
/*
* Expand the photo size (if not set by the user) to provide enough space
* for the image being parsed. It does not matter if width or height wrap
* to negative here: Tk will not shrink the image.
*/
if (Tk_PhotoExpand(interp, imageHandle, destX + pngPtr->block.width,
destY + pngPtr->block.height) == TCL_ERROR) {
if (Tk_PhotoExpand(interp, imageHandle, destX + width,
destY + height) == TCL_ERROR) {
return TCL_ERROR;
}
/*
* A scan line consists of one byte for a filter type, plus the number of
* bits per color sample times the number of color samples per pixel.
*/
|
︙ | | |
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
|
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
|
+
-
+
-
-
-
-
+
+
+
-
-
+
|
ApplyAlpha(pngPtr);
/*
* Copy the decoded image block into the Tk photo image.
*/
pngPtr->block.pixelPtr += srcX * pngPtr->block.pixelSize + srcY * pngPtr->block.pitch;
if (Tk_PhotoPutBlock(interp, imageHandle, &pngPtr->block, destX, destY,
result = Tk_PhotoPutBlock(interp, imageHandle, &pngPtr->block, destX, destY,
pngPtr->block.width, pngPtr->block.height,
TK_PHOTO_COMPOSITE_SET) == TCL_ERROR) {
return TCL_ERROR;
}
width, height, TK_PHOTO_COMPOSITE_SET);
pngPtr->block.pixelPtr -= srcX * pngPtr->block.pixelSize + srcY * pngPtr->block.pitch;
return TCL_OK;
return result;
}
/*
*----------------------------------------------------------------------
*
* FileMatchPNG --
*
|
︙ | | |
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
|
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
|
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
|
* image given by imageHandle.
*
*----------------------------------------------------------------------
*/
static int
FileReadPNG(
Tcl_Interp *interp,
Tcl_Channel chan,
const char *fileName,
Tcl_Obj *fmtObj,
Tk_PhotoHandle imageHandle,
int destX,
int destY,
int width,
int height,
int srcX,
int srcY)
Tcl_Interp* interp, /* Interpreter to use for reporting errors. */
Tcl_Channel chan, /* The image file, open for reading. */
const char* fileName, /* The name of the image file. */
Tcl_Obj *fmtObj, /* User-specified format object, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
int width, int height, /* Dimensions of block of photo image to be
* written to. */
int srcX, int srcY) /* Coordinates of top-left pixel to be used in
* image being read. */
{
PNGImage png;
int result = TCL_ERROR;
result = InitPNGImage(interp, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE);
if (TCL_OK == result) {
result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY);
result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY, width, height, srcX, srcY);
}
CleanupPNGImage(&png);
return result;
}
/*
|
︙ | | |
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
|
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
|
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
|
* New data is added to the image given by imageHandle.
*
*----------------------------------------------------------------------
*/
static int
StringReadPNG(
Tcl_Interp *interp,
Tcl_Interp* interp, /* Interpreter to use for reporting errors. */
Tcl_Obj *pObjData,
Tcl_Obj *fmtObj,
Tk_PhotoHandle imageHandle,
int destX,
int destY,
int width,
int height,
int srcX,
int srcY)
Tcl_Obj *fmtObj, /* User-specified format object, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
int width, int height, /* Dimensions of block of photo image to be
* written to. */
int srcX, int srcY) /* Coordinates of top-left pixel to be used in
* image being read. */
{
PNGImage png;
int result = TCL_ERROR;
result = InitPNGImage(interp, &png, NULL, pObjData,
TCL_ZLIB_STREAM_INFLATE);
if (TCL_OK == result) {
result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY);
result = DecodePNG(interp, &png, fmtObj, imageHandle, destX, destY, width, height, srcX, srcY);
}
CleanupPNGImage(&png);
return result;
}
/*
|
︙ | | |
︙ | | |
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
-
-
-
+
-
+
-
+
|
}
imageInit
set README [makeFile {
README -- Tk test suite design document.
} README-imgPhoto]
# find the teapot.ppm file for use in these tests
set teapotPhotoFile [file join [file dirname [info script]] teapot.ppm]
testConstraint hasTeapotPhoto [file exists $teapotPhotoFile]
test imgPhoto-1.1 {options for photo images} -body {
image create photo photo1 -width 79 -height 83
list [photo1 cget -width] [photo1 cget -height] \
[image width photo1] [image height photo1]
} -cleanup {
image delete photo1
} -result {79 83 79 83}
test imgPhoto-1.2 {options for photo images} -body {
list [catch {image create photo photo1 -file no.such.file} err] \
[string tolower $err]
} -result {1 {couldn't open "no.such.file": no such file or directory}}
test imgPhoto-1.3 {options for photo images} -constraints hasTeapotPhoto -body {
test imgPhoto-1.3 {options for photo images} -body {
image create photo photo1 -file $teapotPhotoFile -format no.such.format
} -returnCodes error -result {image file format "no.such.format" is not supported}
test imgPhoto-1.4 {options for photo images} -constraints hasTeapotPhoto -body {
test imgPhoto-1.4 {options for photo images} -body {
image create photo photo1 -file $teapotPhotoFile
list [image width photo1] [image height photo1]
} -cleanup {
image delete photo1
} -result {256 256}
test imgPhoto-1.5 {options for photo images} -constraints hasTeapotPhoto -body {
test imgPhoto-1.5 {options for photo images} -body {
image create photo photo1 -file $teapotPhotoFile \
-format ppm -width 79 -height 83
list [image width photo1] [image height photo1] [photo1 cget -file] [photo1 cget -format]
} -cleanup {
image delete photo1
} -result [list 79 83 $teapotPhotoFile ppm]
test imgPhoto-1.6 {options for photo images} -body {
|
︙ | | |
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
-
+
-
-
-
+
-
-
-
+
-
-
|
# image create photo photo1
# image create photo photo2 -width 10 -height 10
# catch {image create photo photo2 -file bogus.img} msg
# photo1 copy photo2
# set msg
# } {couldn't open "bogus.img": no such file or directory}
test imgPhoto-3.1 {ImgPhotoConfigureModel procedure} -constraints {
test imgPhoto-3.1 {ImgPhotoConfigureModel procedure} -body {
hasTeapotPhoto
} -body {
image create photo photo1 -file $teapotPhotoFile
photo1 configure -file $teapotPhotoFile
} -cleanup {
image delete photo1
} -result {}
test imgPhoto-3.2 {ImgPhotoConfigureModel procedure} -constraints {
test imgPhoto-3.2 {ImgPhotoConfigureModel procedure} -body {
hasTeapotPhoto
} -body {
image create photo photo1 -file $teapotPhotoFile
list [catch {photo1 configure -file bogus} err] [string tolower $err] \
[image width photo1] [image height photo1]
} -cleanup {
image delete photo1
} -result {1 {couldn't open "bogus": no such file or directory} 256 256}
test imgPhoto-3.3 {ImgPhotoConfigureModel procedure} -constraints {
test imgPhoto-3.3 {ImgPhotoConfigureModel procedure} -setup {
hasTeapotPhoto
} -setup {
destroy .c
pack [canvas .c]
update
} -body {
image create photo photo1
.c create image 10 10 -image photo1 -tags photo1.1 -anchor nw
.c create image 300 10 -image photo1 -tags photo1.2 -anchor nw
|
︙ | | |
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
-
+
-
-
|
test imgPhoto-4.9 {ImgPhotoCmd procedure: configure option} -setup {
image create photo photo1
} -body {
photo1 configure -palette {} -gamma
} -cleanup {
image delete photo1
} -returnCodes error -result {value for "-gamma" missing}
test imgPhoto-4.10 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.10 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -width 25 -height 30
} -body {
image create photo photo2 -file $teapotPhotoFile
photo1 configure -width 0 -height 0 -palette {} -gamma 1
photo1 copy photo2
list [image width photo1] [image height photo1] [photo1 get 100 100]
|
︙ | | |
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
|
image create photo photo1
image create photo photo2
} -body {
photo1 copy photo2 -from -to
} -returnCodes error -cleanup {
image delete photo1 photo2
} -result {the "-from" option requires one to four integer values}
test imgPhoto-4.15 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.15 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -file $teapotPhotoFile
} -body {
photo1 copy photo2
photo1 copy photo2 -from 0 70 60 120 -shrink
list [image width photo1] [image height photo1] [photo1 get 20 10]
} -cleanup {
image delete photo1 photo2
} -result {60 50 {215 154 120}}
test imgPhoto-4.16 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.16 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -file $teapotPhotoFile
} -body {
photo1 copy photo2 -from 60 120 0 70 -to 20 50
list [image width photo1] [image height photo1] [photo1 get 40 80]
} -cleanup {
image delete photo1 photo2
} -result {80 100 {19 92 192}}
test imgPhoto-4.17 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.17 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -file $teapotPhotoFile
} -body {
photo1 copy photo2 -from 0 120 60 70 -to 0 0 100 100
list [image width photo1] [image height photo1] [photo1 get 80 60]
} -cleanup {
image delete photo1 photo2
} -result {100 100 {215 154 120}}
test imgPhoto-4.18 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.18 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -file $teapotPhotoFile
} -body {
photo1 copy photo2 -from 60 70 0 120 -zoom 2
list [image width photo1] [image height photo1] [photo1 get 100 50]
} -cleanup {
image delete photo1 photo2
} -result {120 100 {169 99 47}}
test imgPhoto-4.19 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.19 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -file $teapotPhotoFile
} -body {
photo1 copy photo2 -from 0 70 60 120 -zoom 2
list [image width photo1] [image height photo1] [photo1 get 100 50]
} -cleanup {
image delete photo1 photo2
} -result {120 100 {169 99 47}}
test imgPhoto-4.20 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.20 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -file $teapotPhotoFile
} -body {
photo1 copy photo2 -from 20 20 200 180 -subsample 2 -shrink
list [image width photo1] [image height photo1] [photo1 get 50 30]
} -cleanup {
image delete photo1 photo2
} -result {90 80 {207 146 112}}
test imgPhoto-4.21 {ImgPhotoCmd procedure: copy option} -constraints {
test imgPhoto-4.21 {ImgPhotoCmd procedure: copy option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
image create photo photo2 -file $teapotPhotoFile
} -body {
photo1 copy photo2
set result [list [image width photo1] [image height photo1]]
photo1 conf -width 49 -height 51
lappend result [image width photo1] [image height photo1]
photo1 copy photo2
lappend result [image width photo1] [image height photo1]
photo1 copy photo2 -from 0 0 10 10 -shrink
lappend result [image width photo1] [image height photo1]
photo1 conf -width 0
photo1 copy photo2 -from 0 0 10 10 -shrink
lappend result [image width photo1] [image height photo1]
photo1 conf -height 0
photo1 copy photo2 -from 0 0 10 10 -shrink
lappend result [image width photo1] [image height photo1]
} -cleanup {
image delete photo1 photo2
} -result {256 256 49 51 49 51 49 51 10 51 10 10}
test imgPhoto-4.22 {ImgPhotoCmd procedure: get option} -constraints {
test imgPhoto-4.22 {ImgPhotoCmd procedure: get option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
} -body {
photo1 read $teapotPhotoFile
list [photo1 get 100 100] [photo1 get 150 100] [photo1 get 100 150]
} -cleanup {
image delete photo1
} -result {{169 117 90} {172 115 84} {35 35 35}}
|
︙ | | |
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
|
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
|
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
|
test imgPhoto-4.30 {ImgPhotoCmd procedure: read option} -setup {
image create photo photo1
} -body {
photo1 read
} -returnCodes error -cleanup {
image delete photo1
} -result {wrong # args: should be "photo1 read fileName ?-option value ...?"}
test imgPhoto-4.31 {ImgPhotoCmd procedure: read option} -constraints {
test imgPhoto-4.31 {ImgPhotoCmd procedure: read option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
} -body {
photo1 read $teapotPhotoFile -zoom 2
} -returnCodes error -cleanup {
image delete photo1
} -result {unrecognized option "-zoom": must be -format, -from, -shrink, or -to}
test imgPhoto-4.32 {ImgPhotoCmd procedure: read option} -setup {
image create photo photo1
} -body {
list [catch {photo1 read bogus} err] [string tolower $err]
} -cleanup {
image delete photo1
} -result {1 {couldn't open "bogus": no such file or directory}}
test imgPhoto-4.33 {ImgPhotoCmd procedure: read option} -constraints {
test imgPhoto-4.33 {ImgPhotoCmd procedure: read option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
} -body {
photo1 read $teapotPhotoFile -format bogus
} -cleanup {
image delete photo1
} -returnCodes error -result {image file format "bogus" is not supported}
test imgPhoto-4.34 {ImgPhotoCmd procedure: read option} -setup {
image create photo photo1
} -body {
photo1 read $README
} -returnCodes error -cleanup {
image delete photo1
} -result [subst {couldn't recognize data in image file "$README"}]
test imgPhoto-4.35 {ImgPhotoCmd procedure: read option} -constraints {
test imgPhoto-4.35 {ImgPhotoCmd procedure: read option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
} -body {
photo1 read $teapotPhotoFile
list [image width photo1] [image height photo1] [photo1 get 120 120]
} -cleanup {
image delete photo1
} -result {256 256 {161 109 82}}
test imgPhoto-4.36 {ImgPhotoCmd procedure: read option} -constraints {
test imgPhoto-4.36 {ImgPhotoCmd procedure: read option} -setup {
hasTeapotPhoto
} -setup {
image create photo photo1
} -body {
photo1 read $teapotPhotoFile -from 0 70 60 120 -to 10 10 -shrink
list [image width photo1] [image height photo1] [photo1 get 29 19]
} -cleanup {
image delete photo1
} -result {70 60 {244 180 144}}
|
︙ | | |
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
|
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
|
-
+
-
-
-
+
-
-
-
+
-
-
|
test imgPhoto-4.74 {ImgPhotoCmd procedure: put option error handling} -setup {
image create photo photo1
} -body {
photo1 put {{white}} -to 10 10 20 20 {{white}}
} -cleanup {
image delete photo1
} -returnCodes 1 -result {wrong # args: should be "photo1 put data ?-option value ...?"}
test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -constraints {
test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -body {
hasTeapotPhoto
} -body {
file copy -force $teapotPhotoFile -teapotPhotoFile
image create photo photo1
photo1 read -teapotPhotoFile
} -cleanup {
image delete photo1
file delete ./-teapotPhotoFile
} -result {}
test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints {
test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -setup {
hasTeapotPhoto
} -setup {
imageCleanup
image create photo photo1 -file $teapotPhotoFile
} -body {
# non-regression test for bug [5239fd749b] - shall just not crash
photo1 copy photo1 -to 0 0 2000 1000
photo1 copy photo1 -subsample 2 2 -shrink
} -cleanup {
imageCleanup
} -result {}
test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints {
test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -setup {
hasTeapotPhoto
} -setup {
destroy .c
pack [canvas .c]
imageCleanup
} -body {
image create photo photo1 -file $teapotPhotoFile
.c create image 0 0 -image photo1 -tags photo1.1
.c create image 256 0 -image photo1 -tags photo1.2
|
︙ | | |
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
|
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
|
-
+
-
-
-
+
-
-
|
.c create image 10 10 -image photo1
update
} -cleanup {
destroy .c
image delete photo1
} -result {}
test imgPhoto-7.1 {ImgPhotoFree procedure, resource freeing} -constraints {
test imgPhoto-7.1 {ImgPhotoFree procedure, resource freeing} -setup {
hasTeapotPhoto
} -setup {
destroy .c
pack [canvas .c]
imageCleanup
} -body {
image create photo photo1 -file $teapotPhotoFile
.c create image 0 0 -image photo1 -anchor nw
update
.c delete all
image delete photo1
} -cleanup {
destroy .c
} -result {}
test imgPhoto-7.2 {ImgPhotoFree procedures, unlinking} -constraints {
test imgPhoto-7.2 {ImgPhotoFree procedures, unlinking} -setup {
hasTeapotPhoto
} -setup {
deleteWindows
imageCleanup
} -body {
image create photo photo1 -file $teapotPhotoFile
pack [canvas .c]
.c create image 10 10 -image photo1 -anchor nw
button .b1 -image photo1
|
︙ | | |
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
|
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
|
-
+
-
-
-
+
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
|
destroy .b1
update
.c delete all
} -cleanup {
destroy .c
image delete photo1
} -result {}
test imgPhoto-7.3 {ImgPhotoFree procedures, multiple visuals} -constraints {
test imgPhoto-7.3 {ImgPhotoFree procedures, multiple visuals} -setup {
hasTeapotPhoto
} -setup {
deleteWindows
imageCleanup
} -body {
image create photo photo1 -file $teapotPhotoFile
button .b1 -image photo1
frame .f -visual best
button .f.b2 -image photo1
pack .f.b2
pack .b1 .f
update
destroy .b1
update
.f.b2 configure -image {}
update
destroy .f
image delete photo1
} -result {}
test imgPhoto-8.1 {ImgPhotoDelete procedure} -constraints hasTeapotPhoto -body {
test imgPhoto-8.1 {ImgPhotoDelete procedure} -body {
image create photo photo2 -file $teapotPhotoFile
image delete photo2
} -result {}
test imgPhoto-8.2 {ImgPhotoDelete procedure} -constraints {
test imgPhoto-8.2 {ImgPhotoDelete procedure} -setup {
hasTeapotPhoto
} -setup {
set x {}
} -body {
image create photo photo2 -file $teapotPhotoFile
rename photo2 newphoto2
lappend x [info command photo2] [info command new*] [newphoto2 cget -file]
image delete photo2
lappend x [info command new*]
} -result [list {} newphoto2 $teapotPhotoFile {}]
test imgPhoto-8.3 {ImgPhotoDelete procedure, name cleanup} -body {
image create photo photo1
image create photo photo2 -width 10 -height 10
image delete photo2
photo1 copy photo2
} -returnCodes error -cleanup {
imageCleanup
} -result {image "photo2" doesn't exist or is not a photo image}
test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints {
test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -body {
hasTeapotPhoto
} -body {
image create photo photo2 -file $teapotPhotoFile
rename photo2 {}
list [expr {"photo2" in [imageNames]}] [catch {photo2 foo} msg] $msg
} -result {0 1 {invalid command name "photo2"}}
test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup {
imageCleanup
} -body {
image create photo photo1
photo1 put "{#ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000}" -to 0 0
photo1 put "{#00ff00 #00ff00}" -to 2 0
list [photo1 get 2 0] [photo1 get 3 0] [photo1 get 4 0]
} -result {{0 255 0} {0 255 0} {255 0 0}}
test imgPhoto-10.2 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints {
test imgPhoto-10.2 {Tk_ImgPhotoPutBlock, same source and dest img} -setup {
hasTeapotPhoto
} -setup {
imageCleanup
} -body {
# Test for bug e4336bef5d
image create photo photo1 -file $teapotPhotoFile
image create photo photo2 -file $teapotPhotoFile
photo2 copy photo1 -to 1 2
photo1 copy photo1 -to 1 2
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
} -result 1
test imgPhoto-10.3 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints {
test imgPhoto-10.3 {Tk_ImgPhotoPutBlock, same source and dest img} -setup {
hasTeapotPhoto
} -setup {
imageCleanup
} -body {
# Test for bug e4336bef5d
image create photo photo1 -file $teapotPhotoFile
image create photo photo2 -file $teapotPhotoFile
photo2 copy photo1 -from 2 1 -to 4 5 300 300
photo1 copy photo1 -from 2 1 -to 4 5 300 300
|
︙ | | |
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
|
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
|
-
+
-
+
-
-
|
image create bitmap i1
image create photo photo1
photo1 copy i1
} -cleanup {
imageCleanup
} -returnCodes error -result {image "i1" doesn't exist or is not a photo image}
test imgPhoto-12.1 {Tk_PhotoPutZoomedBlock} -constraints hasTeapotPhoto -body {
test imgPhoto-12.1 {Tk_PhotoPutZoomedBlock} -body {
image create photo p3 -file $teapotPhotoFile
set result [list [p3 get 50 50] [p3 get 100 100]]
p3 copy p3 -zoom 2
lappend result [image width p3] [image height p3] [p3 get 100 100]
} -cleanup {
image delete p3
} -result {{19 92 192} {169 117 90} 512 512 {19 92 192}}
test imgPhoto-12.2 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -constraints {
test imgPhoto-12.2 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -setup {
hasTeapotPhoto
} -setup {
imageCleanup
} -body {
# Test for bug e4336bef5d
image create photo photo1 -file $teapotPhotoFile
image create photo photo2 -file $teapotPhotoFile
photo2 copy photo1 -to 0 1 200 200 -zoom 2 3
photo1 copy photo1 -to 0 1 200 200 -zoom 2 3
|
︙ | | |
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
|
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
test imgPhoto-18.12 {Valid GIF (file)} -setup {
set fileName [file join [file dirname [info script]] red.gif]
} -body {
image create photo gif1 -file $fileName
} -cleanup {
catch {image delete gif1}
} -result gif1
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
test imgPhoto-19.1 {Read GIF file with -from option - Bug [1576528]} -body {
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo gif1
gif1 read $earthPhotoFile -from 152 62 185 97
list [lindex [lindex [gif1 data] 0] 0] [image width gif1] [image height gif1]
} -cleanup {
catch {image delete gif1}
} -result {{#d8c8b8} 33 35}
test imgPhoto-19.2 {Read GIF file, copy with -from option} -body {
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo gif1 -file $earthPhotoFile
image create photo gif2
gif2 copy gif1 -from 152 62 185 97
list [lindex [lindex [gif2 data] 0] 0] [image width gif2] [image height gif2]
} -cleanup {
catch {image delete gif1 ; image delete gif2}
} -result {{#d8c8b8} 33 35}
test imgPhoto-19.3 {Read GIF file with -to option} -body {
image create photo gif1
gif1 read $earthPhotoFile -to 100 200
list [lindex [lindex [gif1 data] 262] 252] [image width gif1] [image height gif1]
} -cleanup {
catch {image delete gif1}
} -result {{#d8c8b8} 420 400}
test imgPhoto-19.4 {Read GIF file with -from and -to options} -body {
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo gif1
gif1 read $earthPhotoFile -from 152 62 185 97 -to 100 200
list [lindex [lindex [gif1 data] 200] 100] [image width gif1] [image height gif1]
} -cleanup {
catch {image delete gif1}
} -result {{#d8c8b8} 133 235}
test imgPhoto-19.5 {Read GIF file with -from, -to and -shrink options} -body {
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo gif1 -file $teapotPhotoFile
gif1 read $earthPhotoFile -from 152 62 185 97 -to 80 120 -shrink
list [lindex [lindex [gif1 data] 120] 80] [image width gif1] [image height gif1]
} -cleanup {
catch {image delete gif1}
} -result {{#d8c8b8} 113 155}
test imgPhoto-19.6 {Read GIF file with -from option, read large region from small file} -body {
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo gif1
catch {gif1 read $earthPhotoFile -from 152 62 2000 1000} msg
list $msg [image width gif1] [image height gif1]
} -cleanup {
catch {image delete gif1}
} -result {{coordinates for -from option extend outside source image} 0 0}
unset earthPhotoFile
set ousterPhotoFile [file join [file dirname [info script]] ouster.png]
test imgPhoto-20.1 {Read PNG file with -from option - Bug [1576528]} -body {
image create photo png1
png1 read $ousterPhotoFile -from 102 62 135 97
list [lindex [lindex [png1 data] 0] 0] [image width png1] [image height png1]
} -cleanup {
catch {image delete png1}
} -result {{#c97962} 33 35}
test imgPhoto-20.2 {Read PNG file, copy with -from option} -body {
image create photo png1 -file $ousterPhotoFile
image create photo png2
png2 copy png1 -from 102 62 135 97
list [lindex [lindex [png2 data] 0] 0] [image width png2] [image height png2]
} -cleanup {
catch {image delete png1 ; image delete png2}
} -result {{#c97962} 33 35}
test imgPhoto-20.3 {Read PNG file with -to option} -body {
image create photo png1
png1 read $ousterPhotoFile -to 100 200
list [lindex [lindex [png1 data] 262] 202] [image width png1] [image height png1]
} -cleanup {
catch {image delete png1}
} -result {{#c97962} 242 381}
test imgPhoto-20.4 {Read PNG file with -from and -to options} -body {
image create photo png1
png1 read $ousterPhotoFile -from 102 62 135 97 -to 100 200
list [lindex [lindex [png1 data] 200] 100] [image width png1] [image height png1]
} -cleanup {
catch {image delete png1}
} -result {{#c97962} 133 235}
test imgPhoto-20.5 {Read PNG file with -from, -to and -shrink options} -body {
image create photo png1 -file $teapotPhotoFile
png1 read $ousterPhotoFile -from 102 62 135 97 -to 80 120 -shrink
list [lindex [lindex [png1 data] 120] 80] [image width png1] [image height png1]
} -cleanup {
catch {image delete png1}
} -result {{#c97962} 113 155}
test imgPhoto-20.6 {Read PNG file with -from option, read large region from small file} -body {
image create photo png1
catch {png1 read $ousterPhotoFile -from 102 62 2000 1000} msg
list $msg [image width png1] [image height png1]
} -cleanup {
catch {image delete png1}
} -result {{coordinates for -from option extend outside source image} 0 0}
unset ousterPhotoFile
catch {rename foreachPixel {}}
catch {rename checkImgTrans {}}
catch {rename checkImgTransLoop {}}
imageFinish
# cleanup
|
︙ | | |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-
-
-
|
# This file is a Tcl script to test menus in Tk. It is
# organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
imageInit
# find the earth.gif file for use in these tests (tests 2.*)
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
testConstraint hasEarthPhoto [file exists $earthPhotoFile]
testConstraint pressbutton [llength [info commands pressbutton]]
testConstraint movemouse [llength [info commands movemouse]]
test menu-1.1 {Tk_MenuCmd procedure} -body {
menu
} -returnCodes error -result {wrong # args: should be "menu pathName ?-option value ...?"}
test menu-1.2 {Tk_MenuCmd procedure} -body {
|
︙ | | |
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
-
-
+
+
-
|
menu .m2 -tearoff 1
.m2 add command -label "test"
.m1 add cascade -label "cascade" -menu .m2
.m1 add separator
.m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
.m1 add radiobutton -label "radiobutton" -variable radio
if {[testConstraint hasEarthPhoto]} {
image create photo image1 -file $earthPhotoFile
set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo image1 -file $earthPhotoFile
}
test menu-2.31 {entry configuration options 0 -activebackground #012345 tearoff} -body {
.m1 entryconfigure 0 -activebackground #012345
} -returnCodes error -result {unknown option "-activebackground"}
test menu-2.32 {entry configuration options 1 -activebackground #012345 command} -body {
.m1 entryconfigure 1 -activebackground #012345
|
︙ | | |
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
|
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
|
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
|
.m1 entryconfigure 4 -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.120 {entry configuration options 5 -foreground non-existent radiobutton} -body {
.m1 entryconfigure 5 -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.121 {entry configuration options 0 -image image1 tearoff} -constraints {
test menu-2.121 {entry configuration options 0 -image image1 tearoff} -body {
hasEarthPhoto
} -body {
.m1 entryconfigure 0 -image image1
} -returnCodes error -result {unknown option "-image"}
test menu-2.122 {entry configuration options 1 -image image1 command} -constraints {
test menu-2.122 {entry configuration options 1 -image image1 command} -setup {
hasEarthPhoto
} -setup {
.m1 entryconfigure 1 -image {}
} -body {
.m1 entryconfigure 1 -image image1
lindex [.m1 entryconfigure 1 -image] 4
} -cleanup {
.m1 entryconfigure 1 -image {}
} -result {image1}
test menu-2.123 {entry configuration options 2 -image image1 cascade} -constraints {
test menu-2.123 {entry configuration options 2 -image image1 cascade} -setup {
hasEarthPhoto
} -setup {
.m1 entryconfigure 2 -image {}
} -body {
.m1 entryconfigure 2 -image image1
lindex [.m1 entryconfigure 2 -image] 4
} -cleanup {
.m1 entryconfigure 2 -image {}
} -result {image1}
test menu-2.124 {entry configuration options 3 -image image1 separator} -constraints {
test menu-2.124 {entry configuration options 3 -image image1 separator} -body {
hasEarthPhoto
} -body {
.m1 entryconfigure 3 -image image1
} -returnCodes error -result {unknown option "-image"}
test menu-2.125 {entry configuration options 4 -image image1 checkbutton} -constraints {
test menu-2.125 {entry configuration options 4 -image image1 checkbutton} -setup {
hasEarthPhoto
} -setup {
.m1 entryconfigure 4 -image {}
} -body {
.m1 entryconfigure 4 -image image1
lindex [.m1 entryconfigure 4 -image] 4
} -cleanup {
.m1 entryconfigure 4 -image {}
} -result {image1}
test menu-2.126 {entry configuration options 5 -image image1 radiobutton} -constraints {
test menu-2.126 {entry configuration options 5 -image image1 radiobutton} -setup {
hasEarthPhoto
} -setup {
.m1 entryconfigure 5 -image {}
} -body {
.m1 entryconfigure 5 -image image1
lindex [.m1 entryconfigure 5 -image] 4
} -cleanup {
.m1 entryconfigure 5 -image {}
} -result {image1}
|
︙ | | |
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
|
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
|
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
-
+
-
-
|
.m1 entryconfigure 4 -selectcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.180 {entry configuration options 5 -selectcolor non-existent radiobutton} -body {
.m1 entryconfigure 5 -selectcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menu-2.181 {entry configuration options 0 -selectimage image1 tearoff} -constraints {
test menu-2.181 {entry configuration options 0 -selectimage image1 tearoff} -body {
hasEarthPhoto
} -body {
.m1 entryconfigure 0 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.182 {entry configuration options 1 -selectimage image1 command} -constraints {
test menu-2.182 {entry configuration options 1 -selectimage image1 command} -body {
hasEarthPhoto
} -body {
.m1 entryconfigure 1 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.183 {entry configuration options 2 -selectimage image1 cascade} -constraints {
test menu-2.183 {entry configuration options 2 -selectimage image1 cascade} -body {
hasEarthPhoto
} -body {
.m1 entryconfigure 2 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.184 {entry configuration options 3 -selectimage image1 separator} -constraints {
test menu-2.184 {entry configuration options 3 -selectimage image1 separator} -body {
hasEarthPhoto
} -body {
.m1 entryconfigure 3 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
test menu-2.185 {entry configuration options 4 -selectimage image1 checkbutton} -constraints {
test menu-2.185 {entry configuration options 4 -selectimage image1 checkbutton} -setup {
hasEarthPhoto
} -setup {
.m1 entryconfigure 4 -selectimage {}
} -body {
.m1 entryconfigure 4 -selectimage image1
lindex [.m1 entryconfigure 4 -selectimage] 4
} -cleanup {
.m1 entryconfigure 4 -selectimage {}
} -result {image1}
test menu-2.186 {entry configuration options 5 -selectimage image1 radiobutton} -constraints {
test menu-2.186 {entry configuration options 5 -selectimage image1 radiobutton} -setup {
hasEarthPhoto
} -setup {
.m1 entryconfigure 5 -selectimage {}
} -body {
.m1 entryconfigure 5 -selectimage image1
lindex [.m1 entryconfigure 5 -selectimage] 4
} -cleanup {
.m1 entryconfigure 5 -selectimage {}
} -result {image1}
|
︙ | | |
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
|
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
|
-
-
+
-
-
|
} -returnCodes error -result {expected integer but got "3p"}
test menu-2.228 {entry configuration options 5 -underline 3p radiobutton} -body {
.m1 entryconfigure 5 -underline 3p
} -returnCodes error -result {expected integer but got "3p"}
deleteWindows
if {[testConstraint hasEarthPhoto]} {
image delete image1
image delete image1
}
test menu-3.1 {MenuWidgetCmd procedure} -setup {
destroy .m1
} -body {
menu .m1
.m1
|
︙ | | |
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
|
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
|
-
+
|
deleteWindows
} -body {
menu .m1
menu .m2
.m1 add cascade -menu .m2
list [.m1 delete 1] [destroy .m1 .m2]
} -result {{} {}}
test menu-8.2 {DestroyMenuEntry} -constraints hasEarthPhoto -setup {
test menu-8.2 {DestroyMenuEntry} -setup {
deleteWindows
catch {image delete image1a}
} -body {
image create photo image1a -file $earthPhotoFile
menu .m1
.m1 add command -image image1a
list [.m1 delete 1] [destroy .m1] [image delete image1a]
|
︙ | | |
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
|
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
|
-
+
-
+
-
+
+
+
|
image create test image1
.m1 entryconfigure 1 -image image1
} -cleanup {
deleteWindows
imageCleanup
} -result {}
test menu-11.19 {ConfigureMenuEntry} -constraints {
testImageType hasEarthPhoto
testImageType
} -setup {
deleteWindows
imageCleanup
} -body {
image create test image1
image create photo image2 -file $earthPhotoFile
menu .m1
.m1 add command -image image1
.m1 entryconfigure 1 -image image2
} -cleanup {
deleteWindows
imageCleanup
} -result {}
test menu-11.20 {ConfigureMenuEntry} -constraints {
testImageType hasEarthPhoto
testImageType
} -setup {
deleteWindows
imageCleanup
} -body {
image create photo image1 -file $earthPhotoFile
image create test image2
menu .m1
.m1 add checkbutton -image image1
.m1 entryconfigure 1 -selectimage image2
} -cleanup {
deleteWindows
imageCleanup
} -result {}
test menu-11.21 {ConfigureMenuEntry} -constraints {
testImageType hasEarthPhoto
testImageType
} -setup {
deleteWindows
imageCleanup
} -body {
image create photo image1 -file $earthPhotoFile
image create test image2
image create test image3
menu .m1
.m1 add checkbutton -image image1 -selectimage image2
.m1 entryconfigure 1 -selectimage image3
} -cleanup {
deleteWindows
imageCleanup
} -result {}
unset earthPhotoFile
test menu-12.1 {ConfigureMenuCloneEntries} -setup {
deleteWindows
} -body {
menu .m1
.m1 clone .m2
|
︙ | | |