diff options
author | fvogel <fvogelnew1@free.fr> | 2022-12-04 14:32:08 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2022-12-04 14:32:08 (GMT) |
commit | 8ebd5984ac2b766a6e4df0cb7efa262959ae7349 (patch) | |
tree | eeba561002a9c63f2b19c8d10ac7739687a41204 | |
parent | fb6fb36eced4a4f01cf372bfbf537d0d39a19cba (diff) | |
download | tk-8ebd5984ac2b766a6e4df0cb7efa262959ae7349.zip tk-8ebd5984ac2b766a6e4df0cb7efa262959ae7349.tar.gz tk-8ebd5984ac2b766a6e4df0cb7efa262959ae7349.tar.bz2 |
Factorize definition of constraint haveBigFontTwiceLargerThanTextFont.
-rw-r--r-- | tests/constraints.tcl | 6 | ||||
-rw-r--r-- | tests/textDisp.test | 9 | ||||
-rw-r--r-- | tests/textTag.test | 13 |
3 files changed, 8 insertions, 20 deletions
diff --git a/tests/constraints.tcl b/tests/constraints.tcl index a506001..27bbd33 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -345,6 +345,12 @@ testConstraint haveTimes12BoldItalicUnderlineOverstrikeFont [expr { ([font actual {times 12 bold italic overstrike underline} -underline] eq "1") && ([font actual {times 12 bold italic overstrike underline} -overstrike] eq "1") }] +set fixedFont {Courier 12} ; # warning: must be consistent with the files using the constraint below! +set bigFont {Helvetica 24} ; # ditto +testConstraint haveBigFontTwiceLargerThanTextFont [expr { + [font actual $fixedFont -size] * 2 <= [font actual $bigFont -size] +}] +unset fixedFont bigFont # constraints for the visuals available testConstraint pseudocolor8 [expr { diff --git a/tests/textDisp.test b/tests/textDisp.test index 1749977..6edb47d 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -73,15 +73,6 @@ 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}] diff --git a/tests/textTag.test b/tests/textTag.test index 186cf21..230bf18 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -11,17 +11,8 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands -set fixedFont {Courier 12} -set bigFont {Helvetica 24} - -# 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 fixedFont {Courier 12} +set bigFont {Helvetica 24} # Warn the user if the actual font is too different from what was requested. if {[font metrics [font actual $fixedFont] -fixed] != 1} { |