Attachment "textDisp.test.diff" to
ticket [72e9ddba]
added by
bll
2017-06-26 02:58:34.
--- tests/textDisp.test
+++ tests/textDisp.test
@@ -48,10 +48,15 @@
set fixedWidth [font measure $fixedFont m]
# 12 on XP
set fixedAscent [font metrics $fixedFont -ascent]
set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP
+set bigFixedFont {"Courier New" -24}
+set bigFixedWidth [font measure $bigFixedFont m]
+set bigFixedHeight [font metrics $bigFixedFont -linespace]
+set bigFixedAscent [font metrics $bigFixedFont -ascent]
+
set varFont {Times -14}
# 16 on XP, 15 on Solaris 8
set varHeight [font metrics $varFont -linespace]
# 13 on XP
set varAscent [font metrics $varFont -ascent]
@@ -65,12 +70,21 @@
set ascentDiff [expr {$bigAscent - $fixedAscent}]
text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll
pack .t -expand 1 -fill both
.t tag configure big -font $bigFont
+.t tag configure bigfix -font $bigFixedFont
.t debug on
wm geometry . {}
+
+set padx [lindex [.t configure -padx] 4]
+incr padx [lindex [.t configure -highlightthickness] 4]
+set borderwidth [lindex [.t configure -borderwidth] 4]
+incr padx $borderwidth
+set pady [lindex [.t configure -pady] 4]
+incr pady [lindex [.t configure -highlightthickness] 4]
+incr pady $borderwidth
# 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 .
@@ -519,20 +533,33 @@
.t delete 1.0 end
.t insert 1.0 "a\tx\tabc"
.t bbox 1.4
} [list 117 5 7 $fixedHeight]
-test textDisp-3.1 {different character sizes} {textfonts} {
+test textDisp-3.1 {different character sizes} {
.t configure -wrap word
.t delete 1.0 end
.t insert end "Some sample text, including both large\n"
.t insert end "characters and\nsmall\n"
.t insert end "abc\nd\ne\nfghij"
- .t tag add big 1.5 1.10
- .t tag add big 2.11 2.14
+ .t tag add bigfix 1.5 1.10
+ .t tag add bigfix 2.11 2.14
+ # Mac OS X fails [.t bbox 1.6] as it returns 14 for the bbox width,
+ # but the font character width is 15.
list [.t bbox 1.1] [.t bbox 1.6] [.t dlineinfo 1.0] [.t dlineinfo 3.0]
-} [list [list 12 [expr {5+$ascentDiff}] 7 $fixedHeight] [list 52 5 13 27] [list 5 5 114 27 [font metrics $bigFont -ascent]] [list 5 [expr {2* $fixedDiff + 85}] 35 $fixedHeight [expr {$fixedDiff + 10}]]]
+} [list \
+ [list [expr {$padx+$fixedWidth}] \
+ [expr {$pady+$bigFixedAscent-$fixedAscent}] \
+ $fixedWidth $fixedHeight] \
+ [list [expr {$padx+5*$fixedWidth+$bigFixedWidth}] $pady \
+ [expr {$bigFixedWidth)}] $bigFixedHeight] \
+ [list $padx $pady \
+ [expr {7*$fixedWidth+5*$bigFixedWidth}] \
+ $bigFixedHeight $bigFixedAscent] \
+ [list $padx [expr {$pady+2*$fixedHeight+2*$bigFixedHeight}] \
+ [expr {5*$fixedWidth}] $fixedHeight $fixedAscent] \
+ ]
.t configure -wrap char
test textDisp-4.1 {UpdateDisplayInfo, basic} {textfonts} {
.t delete 1.0 end
.t insert end "Line 1\nLine 2\nLine 3\n"