diff options
-rw-r--r-- | tests/constraints.tcl | 17 | ||||
-rw-r--r-- | tests/font.test | 5 | ||||
-rw-r--r-- | tests/fontchooser.test | 2 | ||||
-rw-r--r-- | tests/unixFont.test | 3 |
4 files changed, 20 insertions, 7 deletions
diff --git a/tests/constraints.tcl b/tests/constraints.tcl index 0d9aa64..1a6e647 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -314,10 +314,25 @@ destroy .t if {![string match {{22 3 6 15} {31 18 [34] 15}} $x]} { testConstraint fonts 0 } -testConstraint haveTimes14Bold [expr { +# Although unexpected, some systems may have a very limited set of fonts available. +# The following constraints happen to evaluate to false at least on one system: the +# Github CI runner for Linux with --disable-xft +testConstraint haveTimes12Font [expr { + ([font actual {times 12} -size] == 12) +}] +testConstraint haveCourier37Font [expr { + ([font actual {-family courier -size 37}] == 37) +}] +testConstraint haveTimes14BoldFont [expr { ([font actual {times 14 bold} -size] == 14) && ([font actual {times 14 bold} -weight] eq "bold") }] +testConstraint haveTimes12BoldItalicUnderlineOverstrikeFont [expr { + ([font actual {times 12 bold italic overstrike underline} -weight] eq "bold") && + ([font actual {times 12 bold italic overstrike underline} -slant] eq "italic") && + ([font actual {times 12 bold italic overstrike underline} -underline] eq "1") && + ([font actual {times 12 bold italic overstrike underline} -overstrike] eq "1") +}] # constraints for the visuals available testConstraint pseudocolor8 [expr { diff --git a/tests/font.test b/tests/font.test index b3e286a..ca712be 100644 --- a/tests/font.test +++ b/tests/font.test @@ -15,7 +15,6 @@ tcltest::loadTestedCommands testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}] testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] set defaultfontlist [font names] @@ -2258,7 +2257,7 @@ test font-38.10 {ParseFontNameObj procedure: arguments} -body { font actual {times xyz xyz} } -returnCodes error -result {expected integer but got "xyz"} test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints { - unixOrWin failsOnUbuntuNoXft + unixOrWin haveTimes12BoldItalicUnderlineOverstrikeFont } -body { lrange [font actual {times 12 bold italic overstrike underline}] 4 end } -result {-weight bold -slant italic -underline 1 -overstrike 1} @@ -2348,7 +2347,7 @@ test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntu -setup { } -cleanup { tk scaling $oldscale } -result {24} -test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed failsOnUbuntuNoXft} -setup { +test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed haveTimes12Font} -setup { set oldscale [tk scaling] } -body { tk scaling 0.5 diff --git a/tests/fontchooser.test b/tests/fontchooser.test index b83f653..e2e404f 100644 --- a/tests/fontchooser.test +++ b/tests/fontchooser.test @@ -179,7 +179,7 @@ test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body { expr {$::testfont ne {}} } -result {1} -test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl haveTimes14Bold} -body { +test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl haveTimes14BoldFont} -body { start { tk::fontchooser::Configure -command ApplyFont -font {times 14 bold} tk::fontchooser::Show diff --git a/tests/unixFont.test b/tests/unixFont.test index ff16750..3661ae2 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -17,7 +17,6 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] -testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] if {[tk windowingsystem] eq "x11"} { @@ -118,7 +117,7 @@ test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} { lindex [font actual {-family courier}] 1 } {courier} -test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 failsOnUbuntuNoXft} { +test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 haveCourier37Font} { lindex [font actual {-family courier -size 37}] 3 } {37} test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { |