Tk Source Code

Check-in [8a818458]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a missing file from René Zaumseil
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tip-510
Files: files | file ages | folders
SHA3-256: 8a818458e0cfafd348aea0ef170ee36b95d0fcc32233616dd35b7a9efa6d401c
User & Date: fvogel 2018-12-03 18:59:46
Original Comment: Add a missing file from rené Zaumseil
Context
2018-12-15
11:33
New files from René Zaumseil check-in: cc4a0d4c user: fvogel tags: tip-510
2018-12-03
18:59
Add a missing file from René Zaumseil check-in: 8a818458 user: fvogel tags: tip-510
2018-11-30
21:40
New files from René Zaumseil. Tkpath is now included in TIP #510. check-in: 4beac0b5 user: fvogel tags: tip-510
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tests/rbc/path.test.


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
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
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
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
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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
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
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
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
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
# path.test --
#
package require tcltest
namespace import tcltest::*

namespace eval ::TEST {

proc ::TEST::_setup {} {
    catch {destroy {*}[winfo children .]}
    pack [::path .c -width 60 -height 40 -bd 0 -highlightthickness 0]
    update
}

test canvWind-1.1 {DisplayWinItem, windows off-screen vertically} {
    catch {destroy .t}
    toplevel .t
    ::path .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
	    -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
	    -highlightthickness 1
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
    wm geometry .t +0+0
    set f .t.f
    frame $f -width 80 -height 50 -bg red
    .t.c create window 300 400 -window $f -anchor nw
    .t.c xview moveto .3
    .t.c yview moveto .50
    update
    set x [list [list [winfo ismapped $f] [winfo y $f]]]
    .t.c yview scroll 52 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
    .t.c yview scroll 1 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
    .t.c yview scroll -255 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
    .t.c yview scroll -1 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
} {{1 23} {1 -29} {0 -29} {1 225} {0 225}}

test canvWind-1.2 {DisplayWinItem, windows off-screen vertically} {
    catch {destroy .t}
    toplevel .t
    ::path .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
	    -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
	    -highlightthickness 1
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
    wm geometry .t +0+0
    set f .t.c.f
    frame $f -width 80 -height 50 -bg red
    .t.c create window 300 400 -window $f -anchor nw
    .t.c xview moveto .3
    .t.c yview moveto .50
    update
    set x [list [list [winfo ismapped $f] [winfo y $f]]]
    .t.c yview scroll 52 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
    .t.c yview scroll 1 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
    .t.c yview scroll -255 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
    .t.c yview scroll -1 units
    update
    lappend x [list [winfo ismapped $f] [winfo y $f]]
} {{1 3} {1 -49} {0 -49} {1 205} {0 205}}
test canvWind-1.3 {DisplayWinItem, windows off-screen horizontally} {
    catch {destroy .t}
    toplevel .t
    ::path .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
	    -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
	    -highlightthickness 1
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
    wm geometry .t +0+0
    set f .t.f
    frame $f -width 80 -height 50 -bg red
    .t.c create window 300 400 -window $f -anchor nw
    .t.c xview moveto .3
    .t.c yview moveto .50
    update
    set x [list [list [winfo ismapped $f] [winfo x $f]]]
    .t.c xview scroll 82 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
    .t.c xview scroll 1 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
    .t.c xview scroll -335 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
    .t.c xview scroll -1 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
} {{1 23} {1 -59} {0 -59} {1 275} {0 275}}

test canvWind-1.4 {DisplayWinItem, windows off-screen horizontally} {
    catch {destroy .t}
    toplevel .t
    ::path .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
	    -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
	    -highlightthickness 1
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
    wm geometry .t +0+0
    set f .t.c.f
    frame $f -width 80 -height 50 -bg red
    .t.c create window 300 400 -window $f -anchor nw
    .t.c xview moveto .3
    .t.c yview moveto .50
    update
    set x [list [list [winfo ismapped $f] [winfo x $f]]]
    .t.c xview scroll 82 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
    .t.c xview scroll 1 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
    .t.c xview scroll -335 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
    .t.c xview scroll -1 units
    update
    lappend x [list [winfo ismapped $f] [winfo x $f]]
} {{1 3} {1 -79} {0 -79} {1 255} {0 255}}
catch {destroy .t}

set i 1
foreach {testname testinfo} {
    path_canvas-1.1 {-background #ff0000 #ff0000
	non-existent {unknown color name "non-existent"}}
    path_canvas-1.2 {-bg #ff0000 #ff0000
	non-existent {unknown color name "non-existent"}}
    path_canvas-1.3 {-bd 4 4 badValue {bad screen distance "badValue"}}
    path_canvas-1.4 {-borderwidth 1.3 1.3 badValue {bad screen distance "badValue"}}
    path_canvas-1.5 {-closeenough 24 24.0
	bogus {expected floating-point number but got "bogus"}}
    path_canvas-1.6 {-confine true 1 silly {expected boolean value but got "silly"}}
    path_canvas-1.7 {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
    path_canvas-1.8 {-height 2.1 2 x42 {bad screen distance "x42"}}
    path_canvas-1.9 {-highlightbackground #112233 #112233
	ugly {unknown color name "ugly"}}
    path_canvas-1.10 {-highlightcolor #110022 #110022
	bogus {unknown color name "bogus"}}
    path_canvas-1.11 {-highlightthickness 18 18
	badValue {bad screen distance "badValue"}}
    path_canvas-1.12 {-insertbackground #110022 #110022
	bogus {unknown color name "bogus"}}
    path_canvas-1.13 {-insertborderwidth 1.3 1 2.6x {bad screen distance "2.6x"}}
    path_canvas-1.14 {-insertofftime 100 100 3.2 {expected integer but got "3.2"}}
    path_canvas-1.15 {-insertontime 100 100 3.2 {expected integer but got "3.2"}}
    path_canvas-1.16 {-insertwidth 1.3 1 6x {bad screen distance "6x"}}
    path_canvas-1.17 {-relief groove groove
	1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
    path_canvas-1.18 {-selectbackground #110022 #110022
	bogus {unknown color name "bogus"}}
    path_canvas-1.19 {-selectborderwidth 1.3 1
	badValue {bad screen distance "badValue"}}
    path_canvas-1.20 {-selectforeground #654321 #654321
	bogus {unknown color name "bogus"}}
    path_canvas-1.21 {-takefocus "any string" "any string" {} {}}
    path_canvas-1.22 {-width 402 402 xyz {bad screen distance "xyz"}}
    path_canvas-1.23 {-xscrollcommand {Some command} {Some command} {} {}}
    path_canvas-1.24 {-yscrollcommand {Another command} {Another command} {} {}}
} {
    lassign $testinfo name goodValue goodResult badValue badResult
    test $testname-good "configuration options: good value for $name" \
-setup ::TEST::_setup \
-result $goodResult \
-body {
	.c configure $name $goodValue
	lindex [.c configure $name] 4
}
    incr i
    if {$badValue ne ""} {
	test $testname-bad "configuration options: bad value for $name" \
-setup ::TEST::_setup \
-returnCodes error \
-result $badResult \
-body {
    .c configure $name $badValue
}
    }
    .c configure $name [lindex [.c configure $name] 3]
    incr i
}

test path_canvas-1.25 {configure throws error on bad option} \
-setup ::TEST::_setup \
-result [list 1 1] \
-body {
    set res [list [catch {.c configure -gorp foo}]]
    .c create rect 10 10 100 100
    lappend res [catch {.c configure -gorp foo}]
    set res
}

test path_canvas-2.1 {CanvasWidgetCmd, bind option} \
-setup ::TEST::_setup \
-result {0 {}} \
-body {
    set i [.c create rect 10 10 100 100]
    list [catch {.c bind $i <a>} msg] $msg
}

test path_canvas-2.2 {CanvasWidgetCmd, bind option} \
-setup ::TEST::_setup \
-result {1 {no event type or button # or keysym}} \
-body {
    set i [.c create rect 10 10 100 100]
    list [catch {.c bind $i <} msg] $msg
}

test path_canvas-2.3 {CanvasWidgetCmd, xview option} \
-setup ::TEST::_setup \
-result {{0.0 0.3} {0.4 0.7}} \
-body {
    .c configure -width 60 -height 40 -scrollregion {0 0 200 150} -bd 0 \
	-highlightthickness 0
    .c configure -xscrollincrement 40 -yscrollincrement 5
    .c xview moveto 0
    update
    set x [list [.c xview]]
    .c xview scroll 2 units
    update
    lappend x [.c xview]
}

test path_canvas-2.4 {CanvasWidgetCmd, xview option} \
-setup ::TEST::_setup \
-result {{0.6 0.9} {0.66 0.96}} \
-body {
    .c configure -width 60 -height 40 -scrollregion {0 0 200 150} -bd 0 \
	-highlightthickness 0
    # This test gives slightly different results on platforms such
    # as NetBSD.  I don't know why...
    .c configure -xscrollincrement 0 -yscrollincrement 5
    .c xview moveto 0.6
    update
    set x [list [.c xview]]
    .c xview scroll 2 units
    update
    lappend x [.c xview]
}

test path_canvas-3.1 {CanvasWidgetCmd, yview option} \
-setup ::TEST::_setup \
-result {{0.0 0.5} {0.1875 0.6875}} \
-body {
    .c configure -width 60 -height 40 -scrollregion {0 0 200 80} \
	-borderwidth 0 -highlightthickness 0
    .c configure -xscrollincrement 40 -yscrollincrement 5
    .c yview moveto 0
    update
    set x [list [.c yview]]
    .c yview scroll 3 units
    update
    lappend x [.c yview]
}

test path_canvas-3.2 {CanvasWidgetCmd, yview option} \
-setup ::TEST::_setup \
-result {{0.0 0.5} {0.1 0.6}} \
-body {
    .c configure -width 60 -height 40 -scrollregion {0 0 200 80} \
	-borderwidth 0 -highlightthickness 0
    .c configure -xscrollincrement 40 -yscrollincrement 0
    .c yview moveto 0
    update
    set x [list [.c yview]]
    .c yview scroll 2 units
    update
    lappend x [.c yview]
}

test path_canvas-4.1 {ButtonEventProc procedure} \
-setup ::TEST::_setup \
-result {.c #543210 {} {}} \
-body {
    .c configure -bg #543210
    rename .c .c2
    set x {}
    lappend x [winfo children .]
    lappend x [.c2 cget -bg]
    destroy .c
    lappend x [info command .c*] [winfo children .]
}

test path_canvas-5.1 {ButtonCmdDeletedProc procedure} \
-setup ::TEST::_setup \
-result {{} {}} \
-body {
    rename .c {}
    list [info command .c*] [winfo children .]
}

test path_canvas-6.1 {CanvasSetOrigin procedure} \
-setup ::TEST::_setup \
-result {-205.0 -105.0} \
-body {
    .c configure -width 100 -height 50 -scrollregion {-200 -100 305 102} \
	-borderwidth 2 -highlightthickness 3
    .c configure -xscrollincrement 0 -yscrollincrement 0 \
	-width 100 -height 50 -scrollregion {-200 -100 305 102} \
	-borderwidth 2 -highlightthickness 3
    update
    .c xview moveto 0
    .c yview moveto 0
    update
    list [.c canvasx 0] [.c canvasy 0]
}

test path_canvas-6.2 {CanvasSetOrigin procedure} \
-setup ::TEST::_setup \
-result {-165.0 -145.0 35.0 55.0} \
-body {
    .c configure -width 100 -height 50 -scrollregion {-200 -100 305 102} \
	-borderwidth 2 -highlightthickness 3
    .c configure -xscrollincrement 20 -yscrollincrement 10
    set x ""
    foreach i {.08 .10 .48 .50} {
	.c xview moveto $i
	update
	lappend x [.c canvasx 0]
    }
    set x
}

test path_canvas-6.3 {CanvasSetOrigin procedure} \
-setup ::TEST::_setup \
-result {-95.0 -85.0 35.0 45.0} \
-body {
    .c configure -width 100 -height 50 -scrollregion {-200 -100 305 102} \
	-borderwidth 2 -highlightthickness 3
    .c configure -xscrollincrement 20 -yscrollincrement 10
    set x ""
    foreach i {.06 .08 .70 .72} {
	.c yview moveto $i
	update
	lappend x [.c canvasy 0]
    }
    set x
}

test path_canvas-6.4 {CanvasSetOrigin procedure} \
-setup ::TEST::_setup \
-result {215.0} \
-body {
    .c configure -width 100 -height 50 -scrollregion {-200 -100 305 102} \
	-borderwidth 2 -highlightthickness 3
    .c configure -xscrollincrement 20 -yscrollincrement 10
    update
    .c xview moveto 1.0
    .c canvasx 0
}

test path_canvas-6.5 {CanvasSetOrigin procedure} \
-setup ::TEST::_setup \
-result {55.0} \
-body {
    .c configure -width 100 -height 50 -scrollregion {-200 -100 305 102} \
	-borderwidth 2 -highlightthickness 3
    .c configure -xscrollincrement 20 -yscrollincrement 10
    update
    .c yview moveto 1.0
    .c canvasy 0
}

test path_canvas-7.1 {canvas widget vs hidden commands} \
-setup ::TEST::_setup \
-result [list {} 0] \
-body {
    set l [lsort [interp hidden]]
    interp hide {} .c
    destroy .c
    list [winfo children .] [string compare [lsort [interp hidden]] $l]
}

test path_canvas-9.1 {canvas id creation and deletion} \
-setup ::TEST::_setup \
-result {} \
-body {
    # With Tk 8.0.4 the ids are now stored in a hash table.  You
    # can use this test as a performance test with older versions
    # by changing the value of size.
    set size 15
    for {set i 0} {$i < $size} {incr i} {
	set x [expr {-10 + 3*$i}]
	for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
	    .c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \
		    -stroke black -fill blue -tags rect
	    .c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \
		    -textanchor middle -tags text
	}
    }
    # The actual bench mark - this code also exercises all the hash
    # table changes.
    set time [lindex [time {
	foreach id [.c find withtag all] {
	    .c lower $id
	    .c raise $id
	    .c find withtag $id
	    .c bind <Return> $id {}
	    .c delete $id
	}
    }] 0]
    set x ""
}

test path_canvas-10.1 {find items using tag expressions} \
-setup ::TEST::_setup \
-result {{0 3 4 6 7} {1 3} {1 2 3 4 6} 5 {0 5 7} 1 {3 4 5 6} {3 4 5 6} {3 4 5 6} 2 7 7} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 60 -r 10 -fill yellow -tag [list b a]
    .c create circle 20 100 -r 10 -fill green -tag [list c b]
    .c create circle 20 140 -r 10 -fill blue -tag [list b]
    .c create circle 20 180 -r 10 -fill bisque -tag [list a d e]
    .c create circle 20 220 -r 10 -fill bisque -tag b
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    set res {}
    lappend res [.c find withtag {!a}]
    lappend res [.c find withtag {b&&c}]
    lappend res [.c find withtag {b||c}]
    lappend res [.c find withtag {a&&!b}]
    lappend res [.c find withtag {!b&&!c}]
    lappend res [.c find withtag {d&&a&&c&&b}]
    lappend res [.c find withtag {b^a}]
    lappend res [.c find withtag {(a&&!b)||(!a&&b)}]
    lappend res [.c find withtag { ( a && ! b ) || ( ! a && b ) }]
    lappend res [.c find withtag {a&&!(c||d)}]
    lappend res [.c find withtag {d&&"tag with spaces"}]
    lappend res [.c find withtag "tag with spaces"]
}

test path_canvas-10.2 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Unexpected operator in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {&&c}
}

test path_canvas-10.3 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Too many '!' in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {!!c}
}

test path_canvas-10.4 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Missing tag in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {b||}
}

test path_canvas-10.5 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Unexpected operator in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {b&&(c||)}
}

test path_canvas-10.6 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Null quoted tag string in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {d&&""}
}

test path_canvas-10.7 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Missing endquote in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag "d&&\"tag with spaces"
}

test path_canvas-10.8 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Invalid boolean operator in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {a&&"tag with spaces"z}
}

test path_canvas-10.9 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Singleton '&' in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {a&&b&c}
}

test path_canvas-10.10 {check errors from tag expressions} \
-setup ::TEST::_setup \
-returnCodes error \
-result {Singleton '|' in tag search expression} \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list a b c d]
    .c create circle 20 260 -r 10 -fill bisque -tag [list d "tag with spaces"]
    .c find withtag {a||b|c}
}

test path_canvas-10.11 {backward compatility, strange tags that are not expressions} \
-setup ::TEST::_setup \
-result 1 \
-body {
    .c create circle 20 20 -r 10 -fill red -tag [list { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }]
    .c find withtag { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }
}

test path_canvas-10.12 {multple events bound to same tag expr} \
-setup ::TEST::_setup \
-result {} \
-body {
    .c bind {a && b} <Enter> {puts Enter}
    .c bind {a && b} <Leave> {puts Leave}
}

test path_canvas-11.2 {canvas polygon overlap fill check, bug 226357} \
-setup ::TEST::_setup \
-result {1 1 {} 1 {} 1 {} {} 1 {} 1} \
-body {
    set result {}
    set id [.c create polygon 30 30 90 90 30 90 90 30 -fill black]
    lappend result [.c find over 40 40 45 45]; # rect region inc. edge
    lappend result [.c find over 60 40 60 40]; # top-center point
    lappend result [.c find over 0 0 0 0]; # not on poly
    lappend result [.c find over 60 60 60 60]; # center-point
    lappend result [.c find over 45 50 45 50]; # outside poly
    .c itemconfigure $id -fill "" -stroke black
    lappend result [.c find over 40 40 45 45]; # rect region inc. edge
    lappend result [.c find over 60 40 60 40]; # top-center point
    lappend result [.c find over 0 0 0 0]; # not on poly
    lappend result [.c find over 60 60 60 60]; # center-point
    lappend result [.c find over 45 50 45 50]; # outside poly
    .c itemconfigure $id -strokewidth 8
    lappend result [.c find over 45 50 45 50]; # outside poly
}

test path_canvas-12.1 {canvas mm obj, patch SF-403327, 102471} \
-setup ::TEST::_setup \
-result {2.0 3} \
-body {
    set qx [expr {1.+1.}] 
    # qx has type double and no string representation 
    .c scale all $qx 0 1. 1.
    # qx has now type MMRep and no string representation 
    list $qx [string length $qx]
}

test path_canvas-12.2 {canvas mm obj, patch SF-403327, 102471} \
-setup ::TEST::_setup \
-result 12 \
-body {
    set val 10
    incr val
    # qx has type double and no string representation 
    .c scale all $val 0 1 1
    # qx has now type MMRep and no string representation 
    incr val
}

test path_canvas-13.1 {canvas delete during event, SF bug-228024} \
-setup ::TEST::_setup \
-result okokokokokokokokokokokokokokokokokokokokokokokokokokokokokok \
-body {
proc ::TEST::_kill_canvas {w} {
    destroy $w
    pack [::path $w -height 200 -width 200] -fill both -expand yes
    update idle
    $w create rect 80 80 120 120 -fill blue -tags blue
    # bind a button press to re-build the canvas
    $w bind blue <ButtonRelease-1> [subst {
	[lindex [info level 0] 0] $w
	append ::x ok
    }
    ]
}
    ::TEST::_kill_canvas .c
    set ::x {}
    # do this many times to improve chances of triggering the crash
    for {set i 0} {$i < 30} {incr i} {
	event generate .c <1> -x 100 -y 100
	event generate .c <ButtonRelease-1> -x 100 -y 100
    }
rename ::TEST::_kill_canvas {}
    set ::x
}

test path_canvas-14.1 {canvas scan SF bug 581560} \
-setup ::TEST::_setup \
-returnCodes error \
-result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"} \
-body {
    .c scan
}

test path_canvas-14.2 {canvas scan} \
-setup ::TEST::_setup \
-returnCodes error \
-result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"} \
-body {
    .c scan bogus
}

test path_canvas-14.3 {canvas scan} \
-setup ::TEST::_setup \
-returnCodes error \
-result {wrong # args: should be ".c scan mark|dragto x y ?dragGain?"} \
-body {
    .c scan mark
}

test path_canvas-14.4 {canvas scan} \
-setup ::TEST::_setup \
-result {} \
-body {
    .c scan mark 10 10
}

test path_canvas-14.5 {canvas scan} \
-setup ::TEST::_setup \
-returnCodes error \
-result {wrong # args: should be ".c scan mark x y"} \
-body {
    .c scan mark 10 10 5
}

test path_canvas-14.6 {canvas scan} \
-setup ::TEST::_setup \
-result {} \
-body {
    .c scan dragto 10 10 5
}

set i 0
foreach type {image line circle ellipse polygon rect text window} {
    incr i
    test path_canvas-15.$i "basic types check: $type requires coords" \
-setup ::TEST::_setup \
-returnCodes error \
-result "wrong # args: should be \".c create $type coords ?arg arg ...?\"" \
-body {
    .c create $type
}
    incr i
    test path_canvas-15.$i "basic coords check: $type coords are paired" \
-setup ::TEST::_setup \
-match glob \
-returnCodes error \
-result "wrong # coordinates: expected*" \
-body {
    .c create $type 0
}
}

test gradientslave-1.1 {Destroy slave} \
-result {} \
-body {
    interp create slavei
    slavei eval {
        package require Tk
    }
    interp delete slavei
}

test gradientslave-1.2 {Shared gradients inside slave} \
-result 0 \
-body {
    set masterg [path::gradient create radial \
                -stops [list \
                           {0 white 0.9}  [list 1 red4 0.4]] \
                -radialtransition {
                    0.477551020408 0.540983606557
                    1.00918367347 0.898979591837
                    0.139344262295}]
    interp create slavei
    slavei eval {
        package require Tk
    }
    set myRet [string compare [path::gradient names] $masterg]
    interp delete slavei
    set myRet
}

# Testcase for image »move«.
# ----------------------------------------------------------------
# Author : Arndt Roger Schneider
# Date   : 09/22/2007
# License: Tcl-License (aka BSD)
#
# Copyright © 2007 Arndt Roger Schneider
# ----------------------------------------------------------------
image create photo _oval -data {
R0lGODlhIQAZAPcAMf//////////////9///9//39//39//39/f///f///f/
9/f/9/f3//f3//f39/f39/f37/f37/fv9/fv9/fv7/fv7/fv7/fv3vfv3vfv
3u/39+/39+/v9+/v9+/v7+/v7+/v5+/v5+/v3u/v3u/v3u/v1u/v1u/vzu/v
zu/n7+/n7+/n7+/n5+/n5+/nve/nve/eve/eve/Wre/Wrefv7+fv7+fv5+fv
5+fn7+fn7+fn5+fn5+fn5+fWxufWxufWxufWvefWvefWvefOpefOpefGlOfG
lOfGlOe9jOe9jOe9jN7v997v997v797v79bW1tbW1tala9ala9ala87n787n
787n587n587Ozs7Ozs7Ozs7Oxs7Oxs7Gxs7Gxs6tjM6tjM6lY86lY8bn98bn
98bOzsbOzsbOxsbOxsbGzsbGzsbGzsbGxsbGxsbGvcbGvcbGvcale8ale73n
973n973n773n773Gxr3Gxr29vb29vb29vb2le72le72le72MUr2MUr2MUrW1
tbW1tbW1rbW1rbWcjLWcjLWMY7WMY7WMY63e763e763e7621ta21ta1zKa1z
Ka1zKaW9zqW9zqW9zqWttaWttaWlpaWlpaWlpZzO55zO55ycnJycnJyUe5yU
e5yEa5yEa5yEa5T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\
-body {
    set id [.c create image 100 100 -image _oval]
    .c move $id 10 10
    .c coords $id
}\
-result {110.0 110.0}

test image-1.2 {coords 10 10}\
-setup ::TEST::_setup \
-body {
    set id [.c create image 100 100 -image _oval]
    .c coords $id 110.0 110.0
    .c coords $id
}\
-result {110.0 110.0}

test line-1.1 {line coords} \
-setup ::TEST::_setup \
-result {200 201 250 202} \
-body {
    lassign [.c coords [.c create line 200 201 250 202]] l t r b
    return [list \
               [expr { round($l) }] \
               [expr { round($t) }] \
               [expr { round($r) }] \
               [expr { round($b) }]]

} 

test line-1.2 {line {coords after move}} \
-setup ::TEST::_setup \
-result {220 221 270 222} \
-body {
    set line [.c create line 200 201 250 202]
    .c move $line 20 20
    lassign [.c coords $line] l t r b
    return [list \
               [expr { round($l) }] \
               [expr { round($t) }] \
               [expr { round($r) }] \
               [expr { round($b) }]]

}

test line-1.3 {line {Strokedash as .}} \
-setup ::TEST::_setup \
-result {} \
-body {
    set line [.c create line 200 201 250 202 \
                  -strokedash {0.1 0.2}]
    return {}
}

test polyline-1.1 {polyline coords} \
-setup ::TEST::_setup \
-result {12.0 20.0 34.0 5.0 90.0 56.0} \
-body { 
    .c coords [.c create polyline 12 20 34 5 90 56] 
}

test polygon-1.1 {polygon coords} \
-setup ::TEST::_setup \
-result {12.0 20.0 34.0 5.0 90.0 56.0} \
-body { 
    .c coords [.c create polygon 12 20 34 5 90 56 -fill red] 
}

# cleanup
::tcltest::cleanupTests
catch {destroy {*}[winfo children .]}
}
catch {namespace delete ::TEST}
# vim: set ts=4 sw=4 sts=4 ff=unix et :