Tk Source Code

Check-in [4667619c]
Login

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

Overview
Comment:Fixed [2cf3d6942c] - Test button-5.24 fails
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA1: 4667619c71a95e3c456dc5e75fed053f9e52037d
User & Date: fvogel 2016-08-29 17:45:14
Context
2016-08-30
19:46
Made text widget's default undo false again. check-in: c8256e85 user: pspjuth tags: core-8-6-branch
13:46
merge core-8-6-branch check-in: ccbaeade user: jan.nijtmans tags: androwish
07:33
merge core-8-6-branch. Add patch from Christian Werner, and one step closer to working with TCL_UTF_MAX=3 check-in: 0c205a24 user: jan.nijtmans tags: rfe-6c0d7aec67
2016-08-29
17:57
Fixed [2cf3d6942c] - Test button-5.24 fails check-in: 7ee91ba3 user: fvogel tags: trunk
17:45
Fixed [2cf3d6942c] - Test button-5.24 fails check-in: 4667619c user: fvogel tags: core-8-6-branch
17:43
Constrained test menu-38.1 to Unix or Mac platforms since this test hangs on Windows and the corresponding bug was reported for Linux and Mac only check-in: 94e8db77 user: fvogel tags: core-8-6-branch
2016-08-23
18:27
Improved further test button-5.24: the test no longer depends on default values for -padx and -pady and it now computes the expected size of the button Closed-Leaf check-in: a6f3ed76 user: fvogel tags: bug-2cf3d6942c
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/button.test.

3431
3432
3433
3434
3435
3436
3437
3438


3439
3440









3441














3442







3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
    (processing -height option)
    invoked from within
".b configure -height 0.5x"}
#ex 6.18
test button-5.24 {ConfigureButton - computing geometry} -constraints {
    fonts
} -body {
    button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}


    .b configure -text "Sample text" -width 10 -height 2
    pack .b









    set result "[winfo reqwidth .b] [winfo reqheight .b]"














    .b configure -bitmap questhead







    lappend result [winfo reqwidth .b] [winfo reqheight .b]
} -cleanup {
    destroy .b
} -result {104 46 20 12}

test button-5.25 {ConfigureButton - computing geometry} -setup {
    button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
} -body {
    .b configure -text "Button 1"
    set old [winfo reqwidth .b]
    .b configure -text "Much longer text"







|
>
>
|

>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|


|







3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
    (processing -height option)
    invoked from within
".b configure -height 0.5x"}
#ex 6.18
test button-5.24 {ConfigureButton - computing geometry} -constraints {
    fonts
} -body {
    button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
                -padx 30 -pady 20
    # 1. button with text
    .b configure -text "Sample text"
    pack .b
    set textwidth [font measure [.b cget -font] -displayof .b [.b cget -text]]
    set expectedwidth [expr {$textwidth + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness] + 2*[.b cget -padx]}]
    incr expectedwidth 2   ; # added (hardcoded) in tkUnixButton.c
    set result [expr $expectedwidth == [winfo reqwidth .b]]
    set linespace [lindex [font metrics [.b cget -font] -displayof .b] 5]
    set expectedheight [expr {$linespace + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness] + 2*[.b cget -pady]}]
    incr expectedheight 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr $expectedheight == [winfo reqheight .b]]
    # 2. button with a bitmap image
    # there is no access to characteristics the predefined bitmaps,
    # so define one as an image (copied from questhead.xbm)
    set myquesthead [image create bitmap -data {
        #define myquesthead_width 20
        #define myquesthead_height 22
        static unsigned char myquesthead_bits[] = {
           0xf8, 0x1f, 0x00, 0xac, 0x2a, 0x00, 0x56, 0x55, 0x00, 0xeb, 0xaf, 0x00,
           0xf5, 0x5f, 0x01, 0xfb, 0xbf, 0x00, 0x75, 0x5d, 0x01, 0xfb, 0xbe, 0x02,
           0x75, 0x5d, 0x05, 0xab, 0xbe, 0x0a, 0x55, 0x5f, 0x07, 0xab, 0xaf, 0x00,
           0xd6, 0x57, 0x01, 0xac, 0xab, 0x00, 0xd8, 0x57, 0x00, 0xb0, 0xaa, 0x00,
           0x50, 0x55, 0x00, 0xb0, 0x0b, 0x00, 0xd0, 0x17, 0x00, 0xb0, 0x0b, 0x00,
           0x58, 0x15, 0x00, 0xa8, 0x2a, 0x00};
    }]
    .b configure -image $myquesthead
    set expectedwidth [expr {[image width $myquesthead] + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness]}]
    incr expectedwidth 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr $expectedwidth == [winfo reqwidth .b]]
    set expectedheight [expr {[image height $myquesthead] + 2*[.b cget -borderwidth] \
            + 2*[.b cget -highlightthickness]}]
    incr expectedheight 2   ; # added (hardcoded) in tkUnixButton.c
    lappend result [expr $expectedheight == [winfo reqheight .b]]
} -cleanup {
    destroy .b
} -result {1 1 1 1}

test button-5.25 {ConfigureButton - computing geometry} -setup {
    button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
} -body {
    .b configure -text "Button 1"
    set old [winfo reqwidth .b]
    .b configure -text "Much longer text"