summaryrefslogtreecommitdiffstats
path: root/tests/textDisp.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-11-27 11:32:30 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-11-27 11:32:30 (GMT)
commita27551234375d448f5c75d5f068a651b32b9443b (patch)
treea7ca7d3274ba8f43e52891b01c5aec932055ddef /tests/textDisp.test
parenta15e86ba8fe09a9d4dacaddb52626a08ec634cfb (diff)
parent1d9db21e6c8179d6b535f3dc448540dcb9a097fb (diff)
downloadtk-a27551234375d448f5c75d5f068a651b32b9443b.zip
tk-a27551234375d448f5c75d5f068a651b32b9443b.tar.gz
tk-a27551234375d448f5c75d5f068a651b32b9443b.tar.bz2
Merge core-8-6-branch. Resolve conflicts.
Diffstat (limited to 'tests/textDisp.test')
-rw-r--r--tests/textDisp.test59
1 files changed, 40 insertions, 19 deletions
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 30aedb3..792fa45 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -84,11 +84,20 @@ 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}]
# On Windows at least, the tests do work with {Courier -10}, {Courier -12} or {Courier -14} as fixedFont.
-# Warn the user if the actual font size is too different from what was requested.
+# Warn the user if the actual font is too different from what was requested.
if {[font metrics [font actual $fixedFont] -fixed] != 1} {
puts "---> Warning: the font actually used by the tests, which is \"[font actual $fixedFont]\",\
does not seem to be a fixed-width font as expected. If this is really the case, many upcoming\
@@ -654,7 +663,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} failsOnUbuntuNoXft {
+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"
@@ -1328,7 +1337,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} failsOnUbuntuNoXft {
+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"
@@ -1388,7 +1397,9 @@ test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} {
update idletasks
} {}
-test textDisp-9.1 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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"
@@ -1399,7 +1410,9 @@ test textDisp-9.1 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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} -constraints failsOnUbuntuNoXft -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"
@@ -1409,8 +1422,8 @@ test textDisp-9.2 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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} failsOnUbuntuNoXft {
+} -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"
@@ -1421,7 +1434,7 @@ test textDisp-9.3 {TkTextRedrawTag} failsOnUbuntuNoXft {
update
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20} {2.0 2.20 eof}}
-test textDisp-9.4 {TkTextRedrawTag} failsOnUbuntuNoXft {
+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"
@@ -1432,7 +1445,9 @@ test textDisp-9.4 {TkTextRedrawTag} failsOnUbuntuNoXft {
update
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20} {2.0 2.20 eof}}
-test textDisp-9.5 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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
@@ -1447,7 +1462,7 @@ test textDisp-9.5 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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} failsOnUbuntuNoXft {
+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"
@@ -1458,7 +1473,7 @@ test textDisp-9.6 {TkTextRedrawTag} failsOnUbuntuNoXft {
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} failsOnUbuntuNoXft {
+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"
@@ -1468,7 +1483,9 @@ test textDisp-9.7 {TkTextRedrawTag} failsOnUbuntuNoXft {
update
set tk_textRedraw
} {2.0 2.20 eof}
-test textDisp-9.8 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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"
@@ -1480,7 +1497,9 @@ test textDisp-9.8 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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} -constraints failsOnUbuntuNoXft -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"
@@ -1492,7 +1511,7 @@ test textDisp-9.9 {TkTextRedrawTag} -constraints failsOnUbuntuNoXft -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"
@@ -1503,7 +1522,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"
@@ -2259,7 +2278,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} failsOnUbuntuNoXft {
+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}
@@ -2314,7 +2334,8 @@ test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} {
}
lequal [.t index @0,0] $expected
} {1}
-test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntuNoXft {
+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}
@@ -3363,7 +3384,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} failsOnUbuntuNoXft {
+test textDisp-22.6 {TkTextCharBbox, line visible but not char} havebigFontTwiceLargerThanTextFont {
wm geometry . {}
update
scan [wm geom .] %dx%d oriWidth oriHeight
@@ -3379,7 +3400,7 @@ test textDisp-22.6 {TkTextCharBbox, line visible but not char} failsOnUbuntuNoXf
} {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