(?i) constraints.tcl - testConstraint fonts
ania.pawelczyk on Jul 02, 2008 @ 01:43PM UTC
Problems:
Often failing testConstraint fonts
Different font metrics.
Suggestion:
adding -highlightthickness configuration of entry
Question:
Try to make the constraints in a way that they’d be more likely to pass?
Explenation:
I’ve encountered strange behavior of wm geometry x and x coordination in Ubuntu (8.04 Gnome)
TestConstraint fonts is often used in tktests. Should I try to make the constraints in a way that they’d be more likely to pass (and then, according to that, also update tests)?
- line 184
entry .e -width 0 -font {Helvetica -12} -bd 1
.e insert end a.bcd
winfo reqwidth .e
if {([winfo reqwidth .e] != 37) || ([winfo reqheight .e] != 20)} {
testConstraint fonts 0
}
-> XP – 34
-> Slackware – 36
-> Ubuntu -37 (correct according to the constraint)
I’ve noticed, that there should be the -highlightthickness 1 option in entry .e as Windows’ default value is 0 in contrary to Slack’s and Ubuntu’s. This changed the value reqwidth to 36, which still doesn’t meet the expectiations…
The problem of reqwidth lies in the font measure;
% font measure {Helvetica -12} -displayof .e "a.bcd"
>> winXP: 30
>> Ubuntu: 31
(they differ in the c letter)
I was wondering if not conduct tests on a popular font with fixed-width font, where each normal character is the same width as all the other characters, p.e. Courier, Verdana (% font metrics Courier -fixed ). This, I suppose, would substatntially influence on similar reqwidth values. However, there’s still the same value of reqheight needed for font constraint passing. This requires the same font metrics values which I couldn’t achieve in my environments.
To sum up – I wonder whether try to make the constraints in a way that they’d be more likely to pass.
Replies
-
Anonymous on Jul 10, 2008 @ 09:48PM UTC
[sent also to tcl-core]
Yes, this is a case of something that needs to be examined, and you have done a good job of it. Identifying that Tk’s nature (with -highlightthickness) is in part involved, and the rest is due to platform specifics. There are 2 further options to reconcile any failing tests, in that you have to decide whether the font size specifics are key to the test, or they are just incidental in the test case. It is sometimes hard to determine if the test lacks comments or other context.
The Tk tests have been somewhat sloppy in their development over time. As they are added to fix particular bugs, that is usually noted. However many of the core tests that are years old just "are", in that they test some functionality not clearly explained without knowing the full purpose. This purpose is often derived from looking at the preceding or following tests and other aspects of the particular file.