Tk Source Code

Check-in [074a68b5]
Login

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

Overview
Comment:Fixed [3ee76e41c2] - New textTag test failures
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 074a68b5a79c4c5affdc71f9483ca9b0a98a42fc
User & Date: fvogel 2016-12-02 21:05:42
References
2022-11-27
16:51
Manually backout [074a68b5]. I do believe that the newly introduced constraint havebigFontTwiceLargerThanTextFont is enough to fix [3ee76e41c2]. check-in: 73669913 user: fvogel tags: trunk, main
Context
2016-12-08
20:46
Micro-optimization in tkTextDisp.c check-in: fea56df2 user: fvogel tags: trunk
2016-12-06
15:08
Merge trunk. Fix [06c6d9422f]: novem-support branch doesn't build (Use of tclObjPtr is not possible in static builds) check-in: 6a477bee user: jan.nijtmans tags: novem-support
2016-12-02
21:05
Fixed [3ee76e41c2] - New textTag test failures check-in: 074a68b5 user: fvogel tags: trunk
20:58
Fix [ad98f10b3a] and [bd0017bf79] - bitmap-4.1 and cursor-4.1 tests failures. Also, apply again the same pattern to fix color-4.1 that was also failing (when the colorsFree constraint was met) despite there was no such report (yet). Thanks to dgp. check-in: ae13ed65 user: fvogel tags: trunk
06:35
Remove superfluous lines (the default font of the text widget is already saved in $curFont before the tests start). Closed-Leaf check-in: c70ff5ca user: fvogel tags: bug-3ee76e41c2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/textTag.test.

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
# This file is a Tcl script to test the code in the file tkTextTag.c.
# This file is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1996 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
















destroy .t
text .t -width 20 -height 10

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
# manager is mwm, to make mwm forget about a previous minimum size setting.

wm withdraw .
wm minsize . 1 1
wm positionfrom . user












>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









<







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
# This file is a Tcl script to test the code in the file tkTextTag.c.
# This file is organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1996 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

set textWidgetFont {Courier 12}
set bigFont        {Courier 24}

# what is needed is a font that is both fixed-width and featuring a
# specific size because in some tests (that will be constrained by
# haveFontSizes), a tag applying the $bigFont will be set to some
# characters, which action has the effect of changing what character
# is under the mouse pointer, which is the purpose of the tests
testConstraint haveFontSizes [expr {
    [font metrics $textWidgetFont -fixed] &&
    [font actual  $textWidgetFont -size] == 12 &&
    [font metrics $bigFont -fixed] &&
    [font actual  $bigFont -size] == 24 }
]

destroy .t
text .t -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.

wm withdraw .
wm minsize . 1 1
wm positionfrom . user
1192
1193
1194
1195
1196
1197
1198
1199

1200
1201
1202
1203
1204
1205
1206
1207
1208









1209
1210
1211
1212
1213
1214
1215
    }
    .t tag names 2.1
} -cleanup {
    .t tag delete {*}[.t tag names]
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}




set c [.t bbox 2.1]
set x1 [expr [lindex $c 0] + [lindex $c 2]/2]
set y1 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 3.2]
set x2 [expr [lindex $c 0] + [lindex $c 2]/2]
set y2 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 4.3]
set x3 [expr [lindex $c 0] + [lindex $c 2]/2]
set y3 [expr [lindex $c 1] + [lindex $c 3]/2]










test textTag-15.1 {TkTextBindProc} -setup {
    .t tag delete x y
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
} -body {
    bind .t <ButtonRelease> {lappend x up}
    .t tag bind x <ButtonRelease> {lappend x x-up}







|
>









>
>
>
>
>
>
>
>
>







1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
    }
    .t tag names 2.1
} -cleanup {
    .t tag delete {*}[.t tag names]
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}


set curFont [.t cget -font]
set curWrap [.t cget -wrap]
set c [.t bbox 2.1]
set x1 [expr [lindex $c 0] + [lindex $c 2]/2]
set y1 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 3.2]
set x2 [expr [lindex $c 0] + [lindex $c 2]/2]
set y2 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 4.3]
set x3 [expr [lindex $c 0] + [lindex $c 2]/2]
set y3 [expr [lindex $c 1] + [lindex $c 3]/2]
.t configure -font $textWidgetFont -wrap none
update
set c [.t bbox 2.1]
set x4 [expr [lindex $c 0] + [lindex $c 2]/2]
set y4 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 3.2]
set x5 [expr [lindex $c 0] + [lindex $c 2]/2]
set y5 [expr [lindex $c 1] + [lindex $c 3]/2]
.t configure -font $curFont -wrap $curWrap

test textTag-15.1 {TkTextBindProc} -setup {
    .t tag delete x y
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
} -body {
    bind .t <ButtonRelease> {lappend x up}
    .t tag bind x <ButtonRelease> {lappend x x-up}
1309
1310
1311
1312
1313
1314
1315
1316


1317
1318

1319
1320
1321
1322
1323
1324
1325
1326
1327
1328

1329
1330
1331
1332
1333
1334
1335
    lappend x [.t index current]
    event gen .t <ButtonRelease-3> -state 0x300 -x $x3 -y $y3
    lappend x [.t index current]
    event gen .t <ButtonRelease-1> -state 0x100 -x $x3 -y $y3
    lappend x [.t index current]
} -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3}

test textTag-16.2 {TkTextPickCurrent procedure} -setup {


    .t tag delete {*}[.t tag names]
    event generate {} <Motion> -warp 1 -x -1 -y -1; update

} -body {
    .t tag configure big -font $bigFont
    event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
    event gen .t <Motion> -x $x2 -y $y2
    set x [.t index current]
    .t tag add big 3.0
    update
    lappend x [.t index current]
} -cleanup {
    .t tag delete big

} -result {3.2 3.1}

test textTag-16.3 {TkTextPickCurrent procedure} -setup {
    foreach i {a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update







|
>
>


>


|
|






>







1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
    lappend x [.t index current]
    event gen .t <ButtonRelease-3> -state 0x300 -x $x3 -y $y3
    lappend x [.t index current]
    event gen .t <ButtonRelease-1> -state 0x100 -x $x3 -y $y3
    lappend x [.t index current]
} -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3}

test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
    haveFontSizes
} -setup {
    .t tag delete {*}[.t tag names]
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
    .t configure -font $textWidgetFont -wrap none
} -body {
    .t tag configure big -font $bigFont
    event gen .t <ButtonRelease-1> -state 0x100 -x $x4 -y $y4
    event gen .t <Motion> -x $x5 -y $y5
    set x [.t index current]
    .t tag add big 3.0
    update
    lappend x [.t index current]
} -cleanup {
    .t tag delete big
    .t configure -font $curFont -wrap $curWrap
} -result {3.2 3.1}

test textTag-16.3 {TkTextPickCurrent procedure} -setup {
    foreach i {a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
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
    .t tag lower c
    event gen .t <Motion> -x $x2 -y $y2
    return $x
} -cleanup {
    .t tag delete {*}[.t tag names]
} -result {enter-a enter-b enter-c | leave-c leave-b}

test textTag-16.5 {TkTextPickCurrent procedure} -setup {


    foreach i {big a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update

} -body {
    .t tag configure big -font $bigFont
    event gen .t <Motion> -x $x1 -y $y1
    .t tag bind a <Enter> {.t tag add big 3.0 3.2}
    .t tag add a 3.2
    event gen .t <Motion> -x $x2 -y $y2
    .t index current
} -cleanup {
    .t tag delete a big

} -result {3.2}

test textTag-16.6 {TkTextPickCurrent procedure} -setup {


    foreach i {big a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update

} -body {
    .t tag configure big -font $bigFont
    event gen .t <Motion> -x $x1 -y $y1
    .t tag bind a <Enter> {.t tag add big 3.0 3.2}
    .t tag add a 3.2
    event gen .t <Motion> -x $x2 -y $y2
    update
    .t index current
} -cleanup {
    .t tag delete a big

} -result {3.1}

test textTag-16.7 {TkTextPickCurrent procedure} -setup {


    foreach i {big a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update

} -body {
    .t tag configure big -font $bigFont
    .t tag bind a <Enter> {.t tag add big 3.0 3.2}
    .t tag add a 3.2

    event gen .t <Motion> -x $x1 -y $y1
    .t tag bind a <Leave> {.t tag add big 3.0 3.2}
    .t tag add a 2.1
    event gen .t <Motion> -x $x2 -y $y2
    update
    .t index current
} -cleanup {
    .t tag delete a big

} -result {3.1}


test textTag-17.1 {insert procedure inserts tags} -setup {
    .t delete 1.0 end
} -body {
    # Objectification of the text widget had a problem







|
>
>




>


|


|



>


|
>
>




>


|


|




>


|
>
>




>





|


|




>







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
1475
1476
1477
1478
1479
1480
1481
    .t tag lower c
    event gen .t <Motion> -x $x2 -y $y2
    return $x
} -cleanup {
    .t tag delete {*}[.t tag names]
} -result {enter-a enter-b enter-c | leave-c leave-b}

test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
    haveFontSizes
} -setup {
    foreach i {big a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
    .t configure -font $textWidgetFont -wrap none
} -body {
    .t tag configure big -font $bigFont
    event gen .t <Motion> -x $x4 -y $y4
    .t tag bind a <Enter> {.t tag add big 3.0 3.2}
    .t tag add a 3.2
    event gen .t <Motion> -x $x5 -y $y5
    .t index current
} -cleanup {
    .t tag delete a big
    .t configure -font $curFont -wrap $curWrap
} -result {3.2}

test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
    haveFontSizes
} -setup {
    foreach i {big a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
    .t configure -font $textWidgetFont -wrap none
} -body {
    .t tag configure big -font $bigFont
    event gen .t <Motion> -x $x4 -y $y4
    .t tag bind a <Enter> {.t tag add big 3.0 3.2}
    .t tag add a 3.2
    event gen .t <Motion> -x $x5 -y $y5
    update
    .t index current
} -cleanup {
    .t tag delete a big
    .t configure -font $curFont -wrap $curWrap
} -result {3.1}

test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
    haveFontSizes
} -setup {
    foreach i {big a b c d} {
        .t tag remove $i 1.0 end
    }
    event generate {} <Motion> -warp 1 -x -1 -y -1; update
    .t configure -font $textWidgetFont -wrap none
} -body {
    .t tag configure big -font $bigFont
    .t tag bind a <Enter> {.t tag add big 3.0 3.2}
    .t tag add a 3.2

    event gen .t <Motion> -x $x4 -y $y4
    .t tag bind a <Leave> {.t tag add big 3.0 3.2}
    .t tag add a 2.1
    event gen .t <Motion> -x $x5 -y $y5
    update
    .t index current
} -cleanup {
    .t tag delete a big
    .t configure -font $curFont -wrap $curWrap
} -result {3.1}


test textTag-17.1 {insert procedure inserts tags} -setup {
    .t delete 1.0 end
} -body {
    # Objectification of the text widget had a problem