diff options
author | fvogel <fvogelnew1@free.fr> | 2022-11-27 10:44:23 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2022-11-27 10:44:23 (GMT) |
commit | 93675a4f287cd68a5bf7e45a6f95bfc43ff9f0b3 (patch) | |
tree | 1ce1dc36579fcbbf61c4d308bfc028c790e2414f /tests | |
parent | 4966858b7c14dc0592252f6fada0cf68712c4e93 (diff) | |
download | tk-93675a4f287cd68a5bf7e45a6f95bfc43ff9f0b3.zip tk-93675a4f287cd68a5bf7e45a6f95bfc43ff9f0b3.tar.gz tk-93675a4f287cd68a5bf7e45a6f95bfc43ff9f0b3.tar.bz2 |
textDisp.test: Add havebigFontTwiceLargerThanTextFont constraint on tests depending on availability of a big font. This constraint evaluates to false at the CI runner on Linux with --disable-xft because only ONE single font is available in this configuration.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/textDisp.test | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/tests/textDisp.test b/tests/textDisp.test index 17c3e07..87ccb43 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -73,6 +73,15 @@ set bigFont {Helvetica -24} ; # note: not a fixed-width font! set bigHeight [font metrics $bigFont -linespace] set bigAscent [font metrics $bigFont -ascent] +# Although unexpected, this constraint happens to evaluate to false on at +# least one system: the Github CI runner on Linux with --disable-xft +# This is because this configuration only has ONE single font available, +# making all requested fonts become actually the same font. +# See constraints.tcl for more details. +testConstraint havebigFontTwiceLargerThanTextFont [expr { + [font actual $fixedFont -size] * 2 <= [font actual $bigFont -size] +}] + set ascentDiff [expr {$bigAscent - $fixedAscent}] set heightDiff [expr {$bigHeight - $fixedHeight}] @@ -643,7 +652,7 @@ test textDisp-2.30 {LayoutDLine, tabs, running out of space in dline} { .t bbox 1.4 } [list [xchar [expr {2*8}]] [yline 1] $fixedWidth $fixedHeight] -test textDisp-3.1 {different character sizes} { +test textDisp-3.1 {different character sizes} havebigFontTwiceLargerThanTextFont { .t configure -wrap word .t delete 1.0 end .t insert end "Some sample text, including both large\n" @@ -1317,7 +1326,7 @@ test textDisp-8.9 {TkTextChanged} { update list $tk_textRelayout $tk_textRedraw } {{2.0 8.0} {2.0 8.0}} -test textDisp-8.10 {TkTextChanged} { +test textDisp-8.10 {TkTextChanged} havebigFontTwiceLargerThanTextFont { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1377,7 +1386,9 @@ test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} { update idletasks } {} -test textDisp-9.1 {TkTextRedrawTag} -body { +test textDisp-9.1 {TkTextRedrawTag} -constraints { + havebigFontTwiceLargerThanTextFont +} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1388,7 +1399,9 @@ test textDisp-9.1 {TkTextRedrawTag} -body { # glob matching is to have some tolerance on actually used font size # while still testing what we want to test } -match glob -result {{2.0 2.1[78]} {2.0 2.1[78]}} -test textDisp-9.2 {TkTextRedrawTag} -body { +test textDisp-9.2 {TkTextRedrawTag} -constraints { + havebigFontTwiceLargerThanTextFont +} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1398,8 +1411,8 @@ test textDisp-9.2 {TkTextRedrawTag} -body { list $tk_textRelayout $tk_textRedraw # glob matching is to have some tolerance on actually used font size # while still testing what we want to test -} -match glob -result {{1.0 2.0 2.1[678]} {1.0 2.0 2.1[678]}} -test textDisp-9.3 {TkTextRedrawTag} { +} -match glob -result {{1.0 2.0 2.1[678]} {1.0 2.0 2.1[678]}} +test textDisp-9.3 {TkTextRedrawTag} havebigFontTwiceLargerThanTextFont { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1410,7 +1423,7 @@ test textDisp-9.3 {TkTextRedrawTag} { update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.4 {TkTextRedrawTag} { +test textDisp-9.4 {TkTextRedrawTag} havebigFontTwiceLargerThanTextFont { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1421,7 +1434,9 @@ test textDisp-9.4 {TkTextRedrawTag} { update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.5 {TkTextRedrawTag} -setup { +test textDisp-9.5 {TkTextRedrawTag} -constraints { + havebigFontTwiceLargerThanTextFont +} -setup { .t configure -wrap char -height [expr {[.t cget -height]+10}] } -body { .t delete 1.0 end @@ -1436,7 +1451,7 @@ test textDisp-9.5 {TkTextRedrawTag} -setup { .t configure -height [expr {[.t cget -height]-10}] update } -result {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.6 {TkTextRedrawTag} { +test textDisp-9.6 {TkTextRedrawTag} havebigFontTwiceLargerThanTextFont { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap" @@ -1447,7 +1462,7 @@ test textDisp-9.6 {TkTextRedrawTag} { update list $tk_textRelayout $tk_textRedraw } {{2.0 2.20 3.0 3.20} {2.0 2.20 3.0 3.20 eof}} -test textDisp-9.7 {TkTextRedrawTag} { +test textDisp-9.7 {TkTextRedrawTag} havebigFontTwiceLargerThanTextFont { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1457,7 +1472,9 @@ test textDisp-9.7 {TkTextRedrawTag} { update set tk_textRedraw } {2.0 2.20 eof} -test textDisp-9.8 {TkTextRedrawTag} -body { +test textDisp-9.8 {TkTextRedrawTag} -constraints { + havebigFontTwiceLargerThanTextFont +} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1469,7 +1486,9 @@ test textDisp-9.8 {TkTextRedrawTag} -body { # glob matching is to have some tolerance on actually used font size # while still testing what we want to test } -match glob -result {2.0 2.1[678]} -test textDisp-9.9 {TkTextRedrawTag} -body { +test textDisp-9.9 {TkTextRedrawTag} -constraints { + havebigFontTwiceLargerThanTextFont +} -body { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1481,7 +1500,7 @@ test textDisp-9.9 {TkTextRedrawTag} -body { # glob matching is to have some tolerance on actually used font size # while still testing what we want to test } -match glob -result {2.0 2.1[678]} -test textDisp-9.10 {TkTextRedrawTag} { +test textDisp-9.10 {TkTextRedrawTag} havebigFontTwiceLargerThanTextFont { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1492,7 +1511,7 @@ test textDisp-9.10 {TkTextRedrawTag} { update set tk_textRedraw } none -test textDisp-9.11 {TkTextRedrawTag} { +test textDisp-9.11 {TkTextRedrawTag} havebigFontTwiceLargerThanTextFont { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -2248,7 +2267,8 @@ test textDisp-16.9 {TkTextYviewCmd procedure, "moveto" option} { test textDisp-16.10 {TkTextYviewCmd procedure, "moveto" option} { list [catch {.t yview moveto gorp} msg] $msg } {1 {expected floating-point number but got "gorp"}} -test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} havebigFontTwiceLargerThanTextFont { +# constrained because text tagged with the big font plays a role .t yview moveto 0.5 .t index @0,0 } {103.0} @@ -2303,7 +2323,8 @@ test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} { } lequal [.t index @0,0] $expected } {1} -test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} havebigFontTwiceLargerThanTextFont { +# constrained because text tagged with the big font plays a role .t yview moveto .755 .t index @0,0 } {151.80} @@ -3352,7 +3373,7 @@ test textDisp-22.5 {TkTextCharBbox, cut-off char} { update .t bbox 15.6 } [list [xchar 6] [yline 6] $fixedWidth $fixedHeight] -test textDisp-22.6 {TkTextCharBbox, line visible but not char} { +test textDisp-22.6 {TkTextCharBbox, line visible but not char} havebigFontTwiceLargerThanTextFont { wm geometry . {} update scan [wm geom .] %dx%d oriWidth oriHeight @@ -3368,7 +3389,7 @@ test textDisp-22.6 {TkTextCharBbox, line visible but not char} { } {1} wm geom . {} update -test textDisp-22.7 {TkTextCharBbox, different character sizes} { +test textDisp-22.7 {TkTextCharBbox, different character sizes} havebigFontTwiceLargerThanTextFont { .t config -wrap char .t yview 10.0 .t tag add big 12.2 12.5 |