Tk Source Code

Changes On Branch spjuth-cleanpack
Login

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

Changes In Branch spjuth-cleanpack Excluding Merge-Ins

This is equivalent to a diff from 2a868d77ab to 9e988ea8e5

2015-03-02
08:56
Deleted Win95/98-specific documentation as those platforms have long been unsupported. check-in: e4a9133b19 user: ashok tags: trunk
2015-03-01
13:57
Merge from trunk Leaf check-in: 9e988ea8e5 user: pspjuth tags: spjuth-cleanpack
13:45
Merge from trunk Leaf check-in: 3798a95cb6 user: pspjuth tags: spjuth-gridscroll
13:43
Merge from trunk Leaf check-in: 9065bb83fd user: pspjuth tags: spjuth-gridpeer
2015-02-28
03:17
merge mark check-in: 2a868d77ab user: kevin_walzer tags: trunk
02:59
Fix for 5824a992df, images not displaying in Cocoa in label with sunken relief check-in: c4051e7ad3 user: kevin_walzer tags: core-8-5-branch
02:59
Fix for 5824a992df, images not displaying in Cocoa in label with sunken relief check-in: 2f9e63f890 user: kevin_walzer tags: trunk
2011-04-08
22:15
Merge from trunk check-in: 3b54c3f485 user: pspjuth tags: spjuth-cleanpack (unpublished)

Changes to tests/focusTcl.test.

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
    tk_focusNext .b
} -cleanup {
    cleanup1 .
} -result {.b.x}
test focusTcl-5.5 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    setup1 .
    .b.x configure -takefocus ""
    pack unpack .b.x
    update
    tk_focusNext .b
} -cleanup {
    cleanup1 .
} -result {.b.y}
test focusTcl-5.6 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    setup1 .
    foreach w {.b.x .b.y .b.z} {
        $w configure -takefocus ""
    }
    pack unpack .b
    update
    tk_focusNext .b
} -cleanup {
    cleanup1 .
} -result {.c}
test focusTcl-5.7 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    setup1 .
    .b.y configure -takefocus 1
    pack unpack .b.y
    update
    tk_focusNext .b.x
} -cleanup {
    cleanup1 .
} -result {.b.z}
test focusTcl-5.8 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    proc always args {return 1}
    setup1 .
    .b.y configure -takefocus always
    pack unpack .b.y
    update
    tk_focusNext .b.x
} -cleanup {
    cleanup1 .
} -result {.b.y}
test focusTcl-5.9 {tkFocusOK procedure, -takefocus "", window disabled} -body {
    setup1 .







|










|








|









|







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
    tk_focusNext .b
} -cleanup {
    cleanup1 .
} -result {.b.x}
test focusTcl-5.5 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    setup1 .
    .b.x configure -takefocus ""
    pack forget .b.x
    update
    tk_focusNext .b
} -cleanup {
    cleanup1 .
} -result {.b.y}
test focusTcl-5.6 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    setup1 .
    foreach w {.b.x .b.y .b.z} {
        $w configure -takefocus ""
    }
    pack forget .b
    update
    tk_focusNext .b
} -cleanup {
    cleanup1 .
} -result {.c}
test focusTcl-5.7 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    setup1 .
    .b.y configure -takefocus 1
    pack forget .b.y
    update
    tk_focusNext .b.x
} -cleanup {
    cleanup1 .
} -result {.b.z}
test focusTcl-5.8 {tkFocusOK procedure, -takefocus "", not mapped} -body {
    proc always args {return 1}
    setup1 .
    .b.y configure -takefocus always
    pack forget .b.y
    update
    tk_focusNext .b.x
} -cleanup {
    cleanup1 .
} -result {.b.y}
test focusTcl-5.9 {tkFocusOK procedure, -takefocus "", window disabled} -body {
    setup1 .

Changes to tests/pack.test.

1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
    pack .pack.f -side top
    frame .pack.f.f2
    lower .pack.f.f2
    pack .pack.f.f2 -side top
    pack .pack.b -in .pack.f.f2
    update
    set result [winfo geom .pack.b]
    pack unpack .pack.a
    update
    lappend result [winfo geom .pack.b]
} -cleanup {
    destroy .pack.f
} -result {50x30+0+40 50x30+0+0}
test pack-15.2 {managing geometry with -in option} -setup {
    pack forget .pack.a .pack.b .pack.c .pack.d







|







1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
    pack .pack.f -side top
    frame .pack.f.f2
    lower .pack.f.f2
    pack .pack.f.f2 -side top
    pack .pack.b -in .pack.f.f2
    update
    set result [winfo geom .pack.b]
    pack forget .pack.a
    update
    lappend result [winfo geom .pack.b]
} -cleanup {
    destroy .pack.f
} -result {50x30+0+40 50x30+0+0}
test pack-15.2 {managing geometry with -in option} -setup {
    pack forget .pack.a .pack.b .pack.c .pack.d
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
    pack .pack.f -side top
    frame .pack.f.f2
    lower .pack.f.f2
    pack .pack.f.f2 -side top
    pack .pack.b -in .pack.f.f2
    update
    set result [winfo ismapped .pack.b]
    pack unpack .pack.f
    update
    lappend result [winfo ismapped .pack.b]
} -cleanup {
    destroy .pack.f
} -result {1 0}
test pack-15.4 {managing geometry with -in option} -setup {
    pack forget .pack.a .pack.b .pack.c .pack.d







|







1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
    pack .pack.f -side top
    frame .pack.f.f2
    lower .pack.f.f2
    pack .pack.f.f2 -side top
    pack .pack.b -in .pack.f.f2
    update
    set result [winfo ismapped .pack.b]
    pack forget .pack.f
    update
    lappend result [winfo ismapped .pack.b]
} -cleanup {
    destroy .pack.f
} -result {1 0}
test pack-15.4 {managing geometry with -in option} -setup {
    pack forget .pack.a .pack.b .pack.c .pack.d

Changes to tests/text.test.

2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
    .t configure -wrap none
    .t count -displaylines 1.0 end
} -cleanup {
    destroy .t
} -result {3}
test text-10.38 {TextWidgetCmd procedure, "count" option} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack append . .t {top expand fill}
} -body {
    .t configure -width 20 -height 10
    update
    .t insert end [string repeat "abcde " 50]\n
    .t insert end [string repeat "fghij " 50]\n
    .t insert end [string repeat "klmno " 50]
    .t count -lines -chars -indices -displaylines 1.0 end







|







2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
    .t configure -wrap none
    .t count -displaylines 1.0 end
} -cleanup {
    destroy .t
} -result {3}
test text-10.38 {TextWidgetCmd procedure, "count" option} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack .t -side top -expand 1 -fill both
} -body {
    .t configure -width 20 -height 10
    update
    .t insert end [string repeat "abcde " 50]\n
    .t insert end [string repeat "fghij " 50]\n
    .t insert end [string repeat "klmno " 50]
    .t count -lines -chars -indices -displaylines 1.0 end
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
} -cleanup {
    destroy .t
} -result {1 1}


test text-11.1 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack append . .t {top expand fill}
} -body {
    .t insert end "hello"
    .t configure -wrap none
    list [.t count -displaychars 1.0 1.0] \
      [.t count -displaychars 1.0 1.1] \
      [.t count -displaychars 1.0 1.2] \
      [.t count -displaychars 1.0 1.3] \
      [.t count -displaychars 1.0 1.4] \
      [.t count -displaychars 1.0 1.5] \
      [.t count -displaychars 1.0 1.6] \
      [.t count -displaychars 1.0 2.6] \
} -cleanup {
    destroy .t
} -result {0 1 2 3 4 5 5 6}
test text-11.2 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack append . .t {top expand fill}
} -body {
    .t insert end "hello"
    .t tag configure elide1 -elide 0
    .t tag add elide1 1.2 1.4
    .t count -displaychars 1.0 1.5
} -cleanup {
    destroy .t







|
















|







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
} -cleanup {
    destroy .t
} -result {1 1}


test text-11.1 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack .t -side top -expand 1 -fill both
} -body {
    .t insert end "hello"
    .t configure -wrap none
    list [.t count -displaychars 1.0 1.0] \
      [.t count -displaychars 1.0 1.1] \
      [.t count -displaychars 1.0 1.2] \
      [.t count -displaychars 1.0 1.3] \
      [.t count -displaychars 1.0 1.4] \
      [.t count -displaychars 1.0 1.5] \
      [.t count -displaychars 1.0 1.6] \
      [.t count -displaychars 1.0 2.6] \
} -cleanup {
    destroy .t
} -result {0 1 2 3 4 5 5 6}
test text-11.2 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack .t -side top -expand 1 -fill both
} -body {
    .t insert end "hello"
    .t tag configure elide1 -elide 0
    .t tag add elide1 1.2 1.4
    .t count -displaychars 1.0 1.5
} -cleanup {
    destroy .t
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
    .t tag add elide3 1.2 1.4
    lappend res [.t count -displaychars 1.0 1.5]
} -cleanup {
    destroy .t
} -result {5 5}
test text-11.8 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack append . .t {top expand fill}
    set res {}
} -body {
    .t insert end "hello"
# Newer tags are higher priority
    .t tag configure elide1 -elide 0
    .t tag configure elide2 -elide 1
    .t tag add elide2 1.0 1.5







|







2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
    .t tag add elide3 1.2 1.4
    lappend res [.t count -displaychars 1.0 1.5]
} -cleanup {
    destroy .t
} -result {5 5}
test text-11.8 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack .t -side top -expand 1 -fill both
    set res {}
} -body {
    .t insert end "hello"
# Newer tags are higher priority
    .t tag configure elide1 -elide 0
    .t tag configure elide2 -elide 1
    .t tag add elide2 1.0 1.5
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
    lappend res [.t count -displaychars 1.2 1.5]
    lappend res [.t count -displaychars 1.3 1.5]
} -cleanup {
    destroy .t
} -result {0 0 0 0 3 2 1 1}
test text-11.9 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack append . .t {top expand fill}
    set res {}
} -body {
    .t tag configure WELCOME -elide 1
    .t tag configure SYSTEM -elide 0
    .t tag configure TRAFFIC -elide 1
    .t insert end "\n" {SYSTEM TRAFFIC}
    .t insert end "\n" WELCOME







|







2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
    lappend res [.t count -displaychars 1.2 1.5]
    lappend res [.t count -displaychars 1.3 1.5]
} -cleanup {
    destroy .t
} -result {0 0 0 0 3 2 1 1}
test text-11.9 {counting with tag priority eliding} -setup {
    text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
    pack .t -side top -expand 1 -fill both
    set res {}
} -body {
    .t tag configure WELCOME -elide 1
    .t tag configure SYSTEM -elide 0
    .t tag configure TRAFFIC -elide 1
    .t insert end "\n" {SYSTEM TRAFFIC}
    .t insert end "\n" WELCOME
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
    destroy .t .t2
} -result {1234}
test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
    toplevel .top
    text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
    .top.t configure -width 20 -height 10 
    pack append .top .top.t top
    update
    set geom [wm geometry .top]
    set x [string range $geom 0 [string first + $geom]]
} -cleanup {
    destroy .top
} -result {150x140+}
# This test was failing Windows because the title bar on .t was a certain
# minimum size and it was interfering with the size requested by the -setgrid.
# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
# to the appropriate size.
test text-14.19 {ConfigureText procedure} -setup {
    toplevel .top
    text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
    .top.t configure -width 20 -height 10 -setgrid 1
    wm overrideredirect .top 1
    pack append .top .top.t top
    wm geometry .top +0+0
    update
    wm geometry .top
} -cleanup {
    destroy .top
} -result {20x10+0+0}
# This test was failing on Windows because the title bar on .t was a certain
# minimum size and it was interfering with the size requested by the -setgrid.
# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
# to the appropriate size.
test text-14.20 {ConfigureText procedure} -setup {
    toplevel .top
    text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
    .top.t configure -width 20 -height 10 -setgrid 1
    wm overrideredirect .top 1
    pack append .top .top.t top
    wm geometry .top +0+0
    update
    set result [wm geometry .top]
    wm geometry .top 15x8
    update
    lappend result [wm geometry .top]
    .top.t configure -wrap word







|
















|
















|







3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
    destroy .t .t2
} -result {1234}
test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
    toplevel .top
    text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
    .top.t configure -width 20 -height 10 
    pack .top.t -side top
    update
    set geom [wm geometry .top]
    set x [string range $geom 0 [string first + $geom]]
} -cleanup {
    destroy .top
} -result {150x140+}
# This test was failing Windows because the title bar on .t was a certain
# minimum size and it was interfering with the size requested by the -setgrid.
# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
# to the appropriate size.
test text-14.19 {ConfigureText procedure} -setup {
    toplevel .top
    text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
    .top.t configure -width 20 -height 10 -setgrid 1
    wm overrideredirect .top 1
    pack .top.t -side top
    wm geometry .top +0+0
    update
    wm geometry .top
} -cleanup {
    destroy .top
} -result {20x10+0+0}
# This test was failing on Windows because the title bar on .t was a certain
# minimum size and it was interfering with the size requested by the -setgrid.
# The "overrideredirect" gets rid of the titlebar so the toplevel can shrink
# to the appropriate size.
test text-14.20 {ConfigureText procedure} -setup {
    toplevel .top
    text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
    .top.t configure -width 20 -height 10 -setgrid 1
    wm overrideredirect .top 1
    pack .top.t -side top
    wm geometry .top +0+0
    update
    set result [wm geometry .top]
    wm geometry .top 15x8
    update
    lappend result [wm geometry .top]
    .top.t configure -wrap word
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
abcde
12345
Line 4
}
test text-19.11 {DeleteChars procedure} -body {
    toplevel .top
    text .top.t -width 20 -height 5
    pack append .top .top.t top
    wm geometry .top +0+0
    .top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
    update
    .top.t delete 1.0 3.0
    list [.top.t index @0,0] [.top.t get @0,0]
} -cleanup {
    destroy .top
} -result {1.0 x}
test text-19.12 {DeleteChars procedure} -body {
    toplevel .top
    text .top.t -width 20 -height 5
    pack append .top .top.t top
    wm geometry .top +0+0
    .top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
    .top.t yview 3.0
    update
    .top.t delete 2.0 4.0
    list [.top.t index @0,0] [.top.t get @0,0]
} -cleanup {







|











|







3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
abcde
12345
Line 4
}
test text-19.11 {DeleteChars procedure} -body {
    toplevel .top
    text .top.t -width 20 -height 5
    pack .top.t -side top
    wm geometry .top +0+0
    .top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
    update
    .top.t delete 1.0 3.0
    list [.top.t index @0,0] [.top.t get @0,0]
} -cleanup {
    destroy .top
} -result {1.0 x}
test text-19.12 {DeleteChars procedure} -body {
    toplevel .top
    text .top.t -width 20 -height 5
    pack .top.t -side top
    wm geometry .top +0+0
    .top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
    .top.t yview 3.0
    update
    .top.t delete 2.0 4.0
    list [.top.t index @0,0] [.top.t get @0,0]
} -cleanup {
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
} -cleanup {
    destroy .top
} -result {2.3 2.0}


test text-20.1 {TextFetchSelection procedure} -setup {
    text .t -width 20 -height 10
    pack append . .t {top expand fill}
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag add sel 1.3 3.4
    selection get
} -cleanup {
    destroy .t
} -result {a.1a.2a.3a.4
b.0b.1b.2b.3b.4
c.0c}
test text-20.2 {TextFetchSelection procedure} -setup {
    text .t -width 20 -height 10
    pack append . .t {top expand fill}
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag add x 1.2
    .t tag add x 1.4
    .t tag add x 2.0
    .t tag add x 2.3
    .t tag remove sel 1.0 end
    .t tag add sel 1.0 3.4
    selection get
} -cleanup {
    destroy .t
} -result {a.0a.1a.2a.3a.4
b.0b.1b.2b.3b.4
c.0c}
test text-20.3 {TextFetchSelection procedure}  -setup {
    text .t -width 20 -height 10
    pack append . .t {top expand fill}
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag remove sel 1.0 end
    .t tag add sel 13.3
    selection get
} -cleanup {
    destroy .t
} -result {m}
test text-20.4 {TextFetchSelection procedure}  -setup {
    text .t -width 20 -height 10
    pack append . .t {top expand fill}
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag remove x 1.0 end
    .t tag add sel 1.0 3.4
    .t tag remove sel 1.0 end
    .t tag add sel 1.2 1.5
    .t tag add sel 2.4 3.1
    .t tag add sel 10.0 10.end
    .t tag add sel 13.3
    selection get
} -cleanup {
    destroy .t
} -result {0a..1b.2b.3b.4
cj.0j.1j.2j.3j.4m}
test text-20.5 {TextFetchSelection procedure, long selections} -setup {
    text .t -width 20 -height 10
    pack append . .t {top expand fill}
    update
    set x ""
} -body {
    for {set i 1} {$i < 200} {incr i} {
        append x "This is line $i, padded to just about 53 characters.\n"
    }
    .t insert end $x







|














|



















|













|



















|







3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
} -cleanup {
    destroy .top
} -result {2.3 2.0}


test text-20.1 {TextFetchSelection procedure} -setup {
    text .t -width 20 -height 10
    pack .t -side top -expand 1 -fill both
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag add sel 1.3 3.4
    selection get
} -cleanup {
    destroy .t
} -result {a.1a.2a.3a.4
b.0b.1b.2b.3b.4
c.0c}
test text-20.2 {TextFetchSelection procedure} -setup {
    text .t -width 20 -height 10
    pack .t -side top -expand 1 -fill both
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag add x 1.2
    .t tag add x 1.4
    .t tag add x 2.0
    .t tag add x 2.3
    .t tag remove sel 1.0 end
    .t tag add sel 1.0 3.4
    selection get
} -cleanup {
    destroy .t
} -result {a.0a.1a.2a.3a.4
b.0b.1b.2b.3b.4
c.0c}
test text-20.3 {TextFetchSelection procedure}  -setup {
    text .t -width 20 -height 10
    pack .t -side top -expand 1 -fill both
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag remove sel 1.0 end
    .t tag add sel 13.3
    selection get
} -cleanup {
    destroy .t
} -result {m}
test text-20.4 {TextFetchSelection procedure}  -setup {
    text .t -width 20 -height 10
    pack .t -side top -expand 1 -fill both
    update
} -body {
    foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
        .t insert end $i.0$i.1$i.2$i.3$i.4\n
    }
    .t tag remove x 1.0 end
    .t tag add sel 1.0 3.4
    .t tag remove sel 1.0 end
    .t tag add sel 1.2 1.5
    .t tag add sel 2.4 3.1
    .t tag add sel 10.0 10.end
    .t tag add sel 13.3
    selection get
} -cleanup {
    destroy .t
} -result {0a..1b.2b.3b.4
cj.0j.1j.2j.3j.4m}
test text-20.5 {TextFetchSelection procedure, long selections} -setup {
    text .t -width 20 -height 10
    pack .t -side top -expand 1 -fill both
    update
    set x ""
} -body {
    for {set i 1} {$i < 200} {incr i} {
        append x "This is line $i, padded to just about 53 characters.\n"
    }
    .t insert end $x

Changes to tests/textDisp.test.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# The frame .f is needed to make sure that the overall window is always
# fairly wide, even if the text window is very narrow.  This is needed
# because some window managers don't allow the overall width of a window
# to get very narrow.

catch {destroy .f .t}
frame .f -width 100 -height 20
pack append . .f left

set fixedFont {Courier -12}
# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics $fixedFont -linespace]
# 7 on all platforms
set fixedWidth [font measure $fixedFont m]
# 12 on XP







|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# The frame .f is needed to make sure that the overall window is always
# fairly wide, even if the text window is very narrow.  This is needed
# because some window managers don't allow the overall width of a window
# to get very narrow.

catch {destroy .f .t}
frame .f -width 100 -height 20
pack .f -side left

set fixedFont {Courier -12}
# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics $fixedFont -linespace]
# 7 on all platforms
set fixedWidth [font measure $fixedFont m]
# 12 on XP
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 27 on XP, 27 on Solaris 8
set bigHeight [font metrics $bigFont -linespace]
# 21 on XP
set bigAscent [font metrics $bigFont -ascent]
set ascentDiff [expr {$bigAscent - $fixedAscent}]

text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll
pack append . .t {top expand fill}
.t tag configure big -font $bigFont
.t debug on
wm geometry . {}

# The statements below reset the main window;  it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.








|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 27 on XP, 27 on Solaris 8
set bigHeight [font metrics $bigFont -linespace]
# 21 on XP
set bigAscent [font metrics $bigFont -ascent]
set ascentDiff [expr {$bigAscent - $fixedAscent}]

text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll
pack .t -side top -expand 1 -fill both
.t tag configure big -font $bigFont
.t debug on
wm geometry . {}

# The statements below reset the main window;  it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.

595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
    # the overrideredirect on "." confuses the window manager and
    # causes subsequent tests to fail.

    if {$tcl_platform(platform) == "windows"} {
	wm overrideredirect . 1
    }
    frame .f2 -width 20 -height 100
    pack before .f .f2 top
    wm geom . 103x103
    update
    .t configure -wrap none -borderwidth 2
    .t delete 1.0 end
    .t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
    update
    set x [list [.t bbox 1.0] [.t bbox 2.0] $tk_textRelayout]







|







595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
    # the overrideredirect on "." confuses the window manager and
    # causes subsequent tests to fail.

    if {$tcl_platform(platform) == "windows"} {
	wm overrideredirect . 1
    }
    frame .f2 -width 20 -height 100
    pack .f2 -before .f -side top
    wm geom . 103x103
    update
    .t configure -wrap none -borderwidth 2
    .t delete 1.0 end
    .t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
    update
    set x [list [.t bbox 1.0] [.t bbox 2.0] $tk_textRelayout]

Changes to tests/textIndex.test.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package require tcltest 2.1
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test

catch {destroy .t}
text .t -font {Courier -12} -width 20 -height 10
pack append . .t {top expand fill}
update
.t debug on
wm geometry . {}
  
# The statements below reset the main window;  it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.








|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package require tcltest 2.1
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test

catch {destroy .t}
text .t -font {Courier -12} -width 20 -height 10
pack .t -side top -expand 1 -fill both
update
.t debug on
wm geometry . {}
  
# The statements below reset the main window;  it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.

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
    .t2 mark set $pos 1.0
    lappend res [.t2 index $pos]
    catch {destroy .t2}
    set res
} {3.4 3.0 1.0}

frame .f -width 100 -height 20
pack append . .f left

set fixedFont {Courier -12}
set fixedHeight [font metrics $fixedFont -linespace]
set fixedWidth [font measure $fixedFont m]

set varFont {Times -14}
set bigFont {Helvetica -24}
destroy .t
text .t -font $fixedFont -width 20 -height 10 -wrap char
pack append . .t {top expand fill}
.t tag configure big -font $bigFont
.t debug on
wm geometry . {}

# The statements below reset the main window;  it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.








|









|







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
    .t2 mark set $pos 1.0
    lappend res [.t2 index $pos]
    catch {destroy .t2}
    set res
} {3.4 3.0 1.0}

frame .f -width 100 -height 20
pack .f -side left

set fixedFont {Courier -12}
set fixedHeight [font metrics $fixedFont -linespace]
set fixedWidth [font measure $fixedFont m]

set varFont {Times -14}
set bigFont {Helvetica -24}
destroy .t
text .t -font $fixedFont -width 20 -height 10 -wrap char
pack .t -side top -expand 1 -fill both
.t tag configure big -font $bigFont
.t debug on
wm geometry . {}

# The statements below reset the main window;  it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.

Changes to tests/textMark.test.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package require tcltest 2.2
namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands

destroy .t
text .t -width 20 -height 10
pack append . .t {top expand fill}
update
.t debug on
wm geometry . {}
entry .t.e
.t peer create .pt

.t insert 1.0 "Line 1







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package require tcltest 2.2
namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands

destroy .t
text .t -width 20 -height 10
pack .t -side top -expand 1 -fill both
update
.t debug on
wm geometry . {}
entry .t.e
.t peer create .pt

.t insert 1.0 "Line 1

Changes to tests/textTag.test.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

destroy .t
text .t -width 20 -height 10
testConstraint haveCourier12 [expr {[catch {
    .t configure -font {Courier 12}
}] == 0}]

pack append . .t {top expand fill}
update
.t debug on

wm geometry . {}
set bigFont {Helvetica 24}
  
# The statements below reset the main window;  it's needed if the window







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

destroy .t
text .t -width 20 -height 10
testConstraint haveCourier12 [expr {[catch {
    .t configure -font {Courier 12}
}] == 0}]

pack .t -side top -expand 1 -fill both
update
.t debug on

wm geometry . {}
set bigFont {Helvetica 24}
  
# The statements below reset the main window;  it's needed if the window

Changes to tests/textWind.test.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
option add *Text.highlightThickness 2
option add *Text.font {Courier -12}


deleteWindows
# Widget used in tests 1.* - 16.*
text .t -width 30 -height 6 -bd 2 -highlightthickness 2
pack append . .t {top expand fill}
update
.t debug on

# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics {Courier -12} -linespace]
set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP
set color [expr {[winfo depth .t] > 1 ? "green" : "black"}]







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
option add *Text.highlightThickness 2
option add *Text.font {Courier -12}


deleteWindows
# Widget used in tests 1.* - 16.*
text .t -width 30 -height 6 -bd 2 -highlightthickness 2
pack .t -side top -expand 1 -fill both
update
.t debug on

# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics {Courier -12} -linespace]
set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP
set color [expr {[winfo depth .t] > 1 ? "green" : "black"}]