| Ticket UUID: | 857686bb3dca4f3ada486fbaf7d9deaf9bf0cebb | |||
| Title: | textDisp-29.2.x tests fail | |||
| Type: | Bug | Version: | trunk | |
| Submitter: | fvogel | Created on: | 2014-10-21 22:05:29 | |
| Subsystem: | 18. [text] | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2014-10-28 00:13:04 | |
| Resolution: | Fixed | Closed By: | fvogel | |
| Closed on: | 2014-10-28 00:13:04 | |||
| Description: |
Tests textDisp-29.2.x fail (identically) in core-8-5-branch and in trunk:
==== textDisp-29.2 miscellaneous: lines wrap but are still too long FAILED
==== Contents of test case:
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
text .t2.t -width 20 -height 10 -font $fixedFont -wrap char -xscrollcommand ".t2.s set"
pack .t2.t -side top
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
pack .t2.s -side bottom -fill x
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
.t2.t xview scroll 1 unit
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
---- Result was:
{0.02 0.4866666666666667} 300x50+-1+20 {6 70 7 15}
---- Result should have been (exact matching):
{0.023333333333333334 0.49} 300x50+-2+20 {5 70 7 15}
==== textDisp-29.2 FAILED
==== textDisp-29.2.1 miscellaneous: lines wrap but are still too long FAILED
==== Contents of test case:
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
text .t2.t -width 20 -height 10 -font $fixedFont -wrap none -xscrollcommand ".t2.s set"
pack .t2.t -side top
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
pack .t2.s -side bottom -fill x
.t2.t insert end 1\n
.t2.t insert end [string repeat "abc" 30]
.t2.t xview scroll 5 unit
update
.t2.t xview
---- Result was:
0.009523809523809525 0.23174603174603176
---- Result should have been (exact matching):
0.05555555555555555 0.2777777777777778
==== textDisp-29.2.1 FAILED
==== textDisp-29.2.2 miscellaneous: lines wrap but are still too long FAILED
==== Contents of test case:
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
text .t2.t -width 20 -height 10 -font $fixedFont -wrap char -xscrollcommand ".t2.s set"
pack .t2.t -side top
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
pack .t2.s -side bottom -fill x
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
.t2.t xview scroll 2 unit
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
---- Result was:
{0.02 0.4866666666666667} 300x50+-1+20 {6 70 7 15}
---- Result should have been (exact matching):
{0.04666666666666667 0.5133333333333333} 300x50+-9+20 {}
==== textDisp-29.2.2 FAILED
==== textDisp-29.2.3 miscellaneous: lines wrap but are still too long FAILED
==== Contents of test case:
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
text .t2.t -width 20 -height 10 -font $fixedFont -wrap char -xscrollcommand ".t2.s set"
pack .t2.t -side top
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
pack .t2.s -side bottom -fill x
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
.t2.t xview scroll 7 pixels
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
---- Result was:
{0.02 0.4866666666666667} 300x50+-1+20 {6 70 7 15}
---- Result should have been (exact matching):
{0.023333333333333334 0.49} 300x50+-2+20 {5 70 7 15}
==== textDisp-29.2.3 FAILED
==== textDisp-29.2.4 miscellaneous: lines wrap but are still too long FAILED
==== Contents of test case:
catch {destroy .t2}
toplevel .t2
wm geometry .t2 +0+0
text .t2.t -width 20 -height 10 -font $fixedFont -wrap char -xscrollcommand ".t2.s set"
pack .t2.t -side top
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
pack .t2.s -side bottom -fill x
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
.t2.t xview scroll 17 pixels
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
---- Result was:
{0.02 0.4866666666666667} 300x50+-1+20 {6 70 7 15}
---- Result should have been (exact matching):
{0.056666666666666664 0.5233333333333333} 300x50+-12+20 {}
==== textDisp-29.2.4 FAILED
| |||
| User Comments: |
fvogel added on 2014-10-28 00:13:04:
What is your platform, exactly? I have just tried on a Linux box (Debian 6.0 Squeeze), and the tests mentioned in the present ticket (i.e. 29.2, 29.2.1, 29.2.3, 29.2.4) are failing for me, which means they must be exercised by the test suite. Then, in branch bug-857686bb3d these test do not fail anymore, meaning they are now succeeding after my changes in both Windows and Linux Debian patforms. Looks correct to me to merge and close this ticket, which I have just done. dgp added on 2014-10-23 13:40:38: You're right, I misread the constraint expression. My point was that on my platform the tests in question are skipped because the local fonts in use fail the pre-screen. So I cannot really review the changes. I have no way to probe the history to see whether they were ever correct, and when their correctness might have been compromised. If these changes make the test suite better for you, I don't have a reason not to adopt them. fvogel added on 2014-10-22 20:47:02: Good point. I had overlooked the test constraint.
Actually these tests are constrained to run:
. on Windows
or
. when a pre-screen in constraints.tcl indicates the fonts in a [text] have sizes that are expected (i.e. when [testConstraint fonts] == 1 )
In any of these cases, one gets [testConstraint textfonts] == 1
Then, in textDisp.test, there are 135 tests (in core_8-5-branch) that are constrained by "textfont" as defined above. Almost all, if not all of them, contain hardcoded values in their test results. These values result from computations based on the metrics of the specific font used by the tests.
Reviewing hundreds of code lines to check if all these 135 constraints really apply or not is a way too huge work for me.
The changes I have made in branch bug-857686bb3d to fix the present ticket make 5 of these 135 tests more robust to font size and borderWidth/highlightThickness changes. For instance these five tests still produce the expected results with:
set fixedFont {Courier -20} ; # instead of 12 in test suite
option add *Text.borderWidth 27 ; # instead of 2 in test suite
option add *Text.highlightThickness 21 ; # instead of 2 in test suite
In the process of understanding what the correct result should be for the tests this ticket is about, I had to write down the details of the calculations. Then, why not including these detailed calculations in the test results, so that if at some point in the future these tests fail again it will be easier to figure out why?
That was my reasoning. Instead I could have just fixed the hardcoded numbers in the expected test results.
So in short:
1. removal of the "textfont" constraint is very likely not possible without propagating the "detailed calculation" method of giving the expected results to ~130 tests in testDisp.test
~ Note: this assertion should be checkable: on a linux box, force [testConstraint textfonts] to be 1 and run the testDisp test suite.
~ It's even slightly worse than 135 test: this constraint is also used in textWind.test
~ Anyway, having a really robust checking in testDisp.test would suppose making changes in how [testConstraint textfonts] is evaluated. Currently:
a. Only the size of {Helvetica -12} and {Times -14} are checked in [testConstraint textfonts] whereas other fonts such as {Courier -12} are used in some of the "textfont"-constrained tests
b. No checks of font actual size are made on Windows
2. given 1. above, should I revert to hardcoded values in the 5 test results I fixed? I believed not, but you tell me what is best and I will do it if requested.
dgp added on 2014-10-22 14:13:51: These tests are constrained to run only on Windows, and only when a pre-screen in constraints.tcl indicates the fonts in a [text] have sizes that are expected. Can you look into whether that pre-testing is still useful? Or whether it has a history of ever being useful? fvogel added on 2014-10-21 22:33:37: Done in branch bug-857686bb3d fvogel added on 2014-10-21 22:22:55: There is a remaining issue with textDisp-29.2.4 Looking at this now. fvogel added on 2014-10-21 22:15:22: IMO the expected results for these tests are simply wrong. Numerical hardcoded values in the expected results for these tests do not seem to be correct. The fix consists in replacing these numerical values by computed values based on the metrics of the font used, and the borderwidth and highlightthickness of the text widget. Fix proposed in branch bug-857686bb3d | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki