Tk Source Code

View Ticket
Login
Ticket UUID: 3ee76e41c2b6284d05baf10840ed66a9eaaf0cee
Title: New textTag test failures
Type: Bug Version: trunk
Submitter: dgp Created on: 2016-11-08 15:38:41
Subsystem: 18. [text] Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2016-12-02 21:06:40
Resolution: Fixed Closed By: fvogel
    Closed on: 2016-12-02 21:06:40
Description:
These tests pass on core-8-6-branch, but fail on trunk:

==== textTag-16.2 TkTextPickCurrent procedure FAILED
==== Contents of test case:

    .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]

---- Result was:
3.2 3.0
---- Result should have been (exact matching):
3.2 3.1
==== textTag-16.2 FAILED



==== textTag-16.6 TkTextPickCurrent procedure FAILED
==== Contents of test case:

    .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

---- Result was:
3.0
---- Result should have been (exact matching):
3.1
==== textTag-16.6 FAILED



==== textTag-16.7 TkTextPickCurrent procedure FAILED
==== Contents of test case:

    .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

---- Result was:
3.0
---- Result should have been (exact matching):
3.1
==== textTag-16.7 FAILED
User Comments: fvogel added on 2016-12-02 21:06:40:
Great. Merged in trunk then. Closing now.

dgp added on 2016-12-02 12:49:43:
Branch now tests clean. Woohoo!

fvogel added on 2016-12-01 21:48:25:
Updated fix now available in same branch, please try once more...

dgp added on 2016-12-01 15:59:11:
Sorry, that branch fails in a new way:

==== textTag-16.2 TkTextPickCurrent procedure FAILED
==== Contents of test case:

    .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]

---- Result was:
2.1 2.1
---- Result should have been (exact matching):
3.2 3.1
==== textTag-16.2 FAILED



==== textTag-16.5 TkTextPickCurrent procedure FAILED
==== Contents of test case:

    .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

---- Result was:
2.1
---- Result should have been (exact matching):
3.2
==== textTag-16.5 FAILED



==== textTag-16.6 TkTextPickCurrent procedure FAILED
==== Contents of test case:

    .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

---- Result was:
2.1
---- Result should have been (exact matching):
3.1
==== textTag-16.6 FAILED



==== textTag-16.7 TkTextPickCurrent procedure FAILED
==== Contents of test case:

    .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

---- Result was:
2.1
---- Result should have been (exact matching):
3.1
==== textTag-16.7 FAILED

fvogel added on 2016-11-30 21:56:40:

Fix proposed: [4f976a03] in branch bug-3ee76e41c2

Works for me on CentOS 7 (the subject tests are skipped since fonts are not available) and on Win Vista (tests pass).

Could you please check at your end?


dgp added on 2016-11-29 16:39:31:
I'll run whatever scripts you like in my environment and
report results to you.  The differences I see are clearly
due to having different fonts in control when various
commands act on the text widget.  {Courier 12} != TkFixedFont

After a quick look, actually trying to assist with the
analysis will not be a good use of my time.  My knowledge
of this part of Tk is so poor I'll just be groping in the dark.

fvogel added on 2016-11-28 22:11:10:

From the chat:

dgp	Tests pass on 8.6. branch because of haveCourier12 constraint
dgp	On 8.6 branch, if I change to [testConstraint haveCourier12 1] the tests start to fail.
dgp	On trunk, when the constraint was removed, the side effect of defining it went away too.
dgp	and that causes the tests to fail.
fvogel	Ok so when you said these tests pass on 8.6 branch you meant they were in fact skipped?
dgp	no they pass

I think I understand now.

So for you on CentOS 7, with the vanilla core-8-6-branch the tests pass because:

a. haveCourier12 contraint evaluates to true (expr {[catch {.t configure -font {Courier 12}}] == 0} is true), which prevents the tests from being skipped, and
b. the side effect of assessing the value of the constraint is to configure the text widget with the font {Courier 12}

To make the tests fail you have to hardcode haveCourier12 contraint to 1 (true), the difference being that the side effect above in b. is NOT present.

What puzzles me is that for me, on the same CentOS 7, with the vanilla core-8-6-branch, I see these tests FAIL for me, and both a. and b. above are in force. Why is there this difference with what you are seeing?


fvogel added on 2016-11-28 15:20:26:
Reason for haveCourier12 removal:

http://core.tcl.tk/tk/tktview?name=438cf10142

So for you in core-8-6-branch haveCourier12 is defined, which makes the reported tests pass? On same CentOS 7 I have here these tests fail.

dgp added on 2016-11-28 14:09:43:
These tests on 8.6 branch are constrained by
"haveCourier12".  Defining this constraint has
the side effect of configuring the text widget
being tested with '-font {Courier 12}'.  With
that in place successfully, the tests pass for me.

On trunk, the constraint has been removed. Then
all the tests fail.

If I (effectively) remove the constraint on the
8.6 branch, the tests fail there too.

fvogel added on 2016-11-27 15:51:28:
A fix would be constraining the tests using this $bigFont to 'textfonts'.

This makes them pass for me on CentOS 7 with trunk.

What makes me wonder is that the OP, DGP, stated that these tests pass "as is" in core-8-6-branch. This is not the case for me, they fail identically on CentOS 7 in both core-8-6-branch and trunk.

DGP, could you please check again and confirm whether these tests pass or fail for you on the same CentOS 7 with core-8-6-branch? If they definitely fail for you then my analysis below is void.

fvogel added on 2016-11-27 10:41:12:
The problem seems to be that the 'big' tag is supposed to apply a large size font {Helvetica 24}. This font apparently does not exist on CentOS 7, and the default font picked by Tk still has size 10, as revealed by:

% font actual [.t tag cget big -font]    ; # Cent OS 7
-family fixed -size 10 -weight normal -slant roman -underline 0 -overstrike 0

On other systems where these tests pass, e.g. on Windows, I see a font with the size (24) expected by the test:

% font actual [.t tag cget big -font]    ; # Win Vista
-family Arial -size 24 -weight normal -slant roman -underline 0 -overstrike 0

fvogel added on 2016-11-26 14:28:25:
Had to install the same CentOS 7 as the OP to reproduce. Now I see the same three tests failing, with same results.
Will investigate, stay tuned.

fvogel added on 2016-11-09 22:22:03:
Does not fail for me on yet another Linux flavor (CentOS release 5.11 (Final), with KDE 3.5.4-30.el5.centos).

fvogel added on 2016-11-08 21:29:19:
Does not fail for me on another Linux flavor (Debian 8).

dgp added on 2016-11-08 18:08:23:
CentOS Linux release 7.2.1511

fvogel added on 2016-11-08 17:51:50:
What platform?
No failure for me on Win at [2b6479eab3].