Bug 1342741 - Adjust a few testcases that are sensitive to glyph/metrics differences in Menlo. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D107288
This commit is contained in:
Jonathan Kew 2021-03-12 16:13:18 +00:00
parent e9dbacf32b
commit 45d1f12441
21 changed files with 72 additions and 47 deletions

View File

@ -113,7 +113,7 @@ function runTest() {
is(text2Bounds.left, text1Bounds.left + 100, "text2.getBoundingClientRect().left");
is(text2Bounds.top, text1Bounds.top, "text2.getBoundingClientRect().top");
is(text2Bounds.width, text1Bounds.width, "text2.getBoundingClientRect().width");
isfuzzy(text2Bounds.width, text1Bounds.width, 0.1, "text2.getBoundingClientRect().width");
is(text2Bounds.height, text1Bounds.height, "text2.getBoundingClientRect().height");
var r = (text1Bounds.width + text1Bounds.height) * sin45;
@ -189,7 +189,7 @@ function runTest() {
is(text1aBounds.width, text1Bounds.width + 4, "text1a.getBoundingClientRect().width");
is(text2aBounds.left, text1aBounds.left + 100 - 3, "text2a.getBoundingClientRect().left");
is(text2aBounds.width, text1aBounds.width + 6, "text2a.getBoundingClientRect().width");
isfuzzy(text2aBounds.width, text1aBounds.width + 6, 0.1, "text2a.getBoundingClientRect().width");
var iBounds = doc.getElementById("i").getBoundingClientRect();
is(iBounds.left, 20, "i.getBoundingClientRect().left");

View File

@ -40,7 +40,7 @@ function runTests(text, charWidth) {
function expectValue(charnum, nchars, expected) {
try {
is(text.getSubStringLength(charnum, nchars), expected,
isfuzzy(text.getSubStringLength(charnum, nchars), expected, 0.01,
"text.getSubStringLength(" + charnum + "," + nchars + ") " +
"returned wrong value");
} catch (e) {

View File

@ -33,6 +33,11 @@ function runTest() {
is(pt1.y, y, str + " y");
}
function isPointFuzzy(pt1, x, y, str) {
isfuzzy(pt1.x, x, 0.05, str + " x");
isfuzzy(pt1.y, y, 0.05, str + " y");
}
function ymost(r) {
return r.y + r.height;
}
@ -49,20 +54,20 @@ function runTest() {
ok(text1.getComputedTextLength() > 0, "text1 measured length");
is(text1.getComputedTextLength(), text1.getSubStringLength(0, 3), "text1 substring length");
isPoint(text1.getStartPositionOfChar(0), 5, 25, "text1 char 0 start offset");
isPoint(text1.getStartPositionOfChar(1), 5 + charWidth, 25, "text1 char 1 start offset");
isPoint(text1.getStartPositionOfChar(2), 5 + 2 * charWidth, 25, "text1 char 2 start offset");
isPoint(text1.getEndPositionOfChar(0), 5 + charWidth, 25, "text1 char 0 end offset");
isPoint(text1.getEndPositionOfChar(1), 5 + 2 * charWidth, 25, "text1 char 1 end offset");
isPoint(text1.getEndPositionOfChar(2), 5 + 3 * charWidth, 25, "text1 char 2 end offset");
is(text1.getExtentOfChar(0).x, 5, "text1 char 0 extent x");
isPointFuzzy(text1.getStartPositionOfChar(1), 5 + charWidth, 25, "text1 char 1 start offset");
isPointFuzzy(text1.getStartPositionOfChar(2), 5 + 2 * charWidth, 25, "text1 char 2 start offset");
isPointFuzzy(text1.getEndPositionOfChar(0), 5 + charWidth, 25, "text1 char 0 end offset");
isPointFuzzy(text1.getEndPositionOfChar(1), 5 + 2 * charWidth, 25, "text1 char 1 end offset");
isPointFuzzy(text1.getEndPositionOfChar(2), 5 + 3 * charWidth, 25, "text1 char 2 end offset");
isfuzzy(text1.getExtentOfChar(0).x, 5, 0.01, "text1 char 0 extent x");
is(text1.getExtentOfChar(0).width, text1.getSubStringLength(0, 1), "text1 char 0 extent width");
ok(text1.getExtentOfChar(0).y < 25, "text1 char 0 extent y");
ok(ymost(text1.getExtentOfChar(0)) > 25, "text1 char 0 extent height");
is(text1.getExtentOfChar(1).x, 5 + charWidth, "text1 char 1 extent x");
isfuzzy(text1.getExtentOfChar(1).x, 5 + charWidth, 0.01, "text1 char 1 extent x");
is(text1.getExtentOfChar(1).width, text1.getSubStringLength(0, 1), "text1 char 1 extent width");
is(text1.getExtentOfChar(1).y, text1.getExtentOfChar(0).y, "text1 char 0/1 extent y");
is(text1.getExtentOfChar(1).height, text1.getExtentOfChar(0).height, "text1 char 0/1 extent height");
is(text1.getExtentOfChar(2).x, 5 + 2 * charWidth, "text1 char 2 extent x");
isfuzzy(text1.getExtentOfChar(2).x, 5 + 2 * charWidth, 0.02, "text1 char 2 extent x");
is(text1.getExtentOfChar(2).width, text1.getSubStringLength(0, 1), "text1 char 2 extent width");
is(text1.getExtentOfChar(2).y, text1.getExtentOfChar(0).y, "text1 char 0/2 extent y");
is(text1.getExtentOfChar(2).height, text1.getExtentOfChar(0).height, "text1 char 0/2 extent height");
@ -93,21 +98,21 @@ function runTest() {
is(text2.getNumberOfChars(), 3, "text2 length");
ok(text2.getComputedTextLength() > 0, "text2 measured length");
is(text2.getComputedTextLength(), text2.getSubStringLength(0, 3), "text2 substring length");
isPoint(text2.getStartPositionOfChar(0), 100, 125, "text2 char 0 start offset");
isPoint(text2.getStartPositionOfChar(1), 100, 125 + charWidth, "text2 char 1 start offset");
isPoint(text2.getStartPositionOfChar(2), 100, 125 + 2 * charWidth, "text2 char 2 start offset");
isPoint(text2.getEndPositionOfChar(0), 100, 125 + charWidth, "text2 char 0 end offset");
isPoint(text2.getEndPositionOfChar(1), 100, 125 + 2 * charWidth, "text2 char 1 end offset");
isPoint(text2.getEndPositionOfChar(2), 100, 125 + 3 * charWidth, "text2 char 2 end offset");
is(text2.getExtentOfChar(0).y, 125, "text2 char 0 extent y");
isPointFuzzy(text2.getStartPositionOfChar(0), 100, 125, "text2 char 0 start offset");
isPointFuzzy(text2.getStartPositionOfChar(1), 100, 125 + charWidth, "text2 char 1 start offset");
isPointFuzzy(text2.getStartPositionOfChar(2), 100, 125 + 2 * charWidth, "text2 char 2 start offset");
isPointFuzzy(text2.getEndPositionOfChar(0), 100, 125 + charWidth, "text2 char 0 end offset");
isPointFuzzy(text2.getEndPositionOfChar(1), 100, 125 + 2 * charWidth, "text2 char 1 end offset");
isPointFuzzy(text2.getEndPositionOfChar(2), 100, 125 + 3 * charWidth, "text2 char 2 end offset");
isfuzzy(text2.getExtentOfChar(0).y, 125, 0.01, "text2 char 0 extent y");
isfuzzy(text2.getExtentOfChar(0).height, charWidth, 0.000001, "text2 char 0 extent height");
ok(text2.getExtentOfChar(0).width < 100, "text2 char 0 extent x");
ok(xmost(text2.getExtentOfChar(0)) > 100, "text2 char 0 extent width");
is(text2.getExtentOfChar(1).y, 125 + charWidth, "text2 char 1 extent x");
isfuzzy(text2.getExtentOfChar(1).y, 125 + charWidth, 0.01, "text2 char 1 extent x");
isfuzzy(text2.getExtentOfChar(1).height, text2.getSubStringLength(0, 1), 0.000001, "text2 char 1 extent width");
is(text2.getExtentOfChar(1).x, text2.getExtentOfChar(0).x, "text2 char 0/1 extent y");
is(text2.getExtentOfChar(1).width, text2.getExtentOfChar(0).width, "text2 char 0/1 extent height");
is(text2.getExtentOfChar(2).y, 125 + 2 * charWidth, "text2 char 2 extent x");
isfuzzy(text2.getExtentOfChar(2).y, 125 + 2 * charWidth, 0.01, "text2 char 2 extent x");
isfuzzy(text2.getExtentOfChar(2).height, text2.getSubStringLength(0, 1), 0.000001, "text2 char 2 extent width");
is(text2.getExtentOfChar(2).x, text2.getExtentOfChar(0).x, "text2 char 0/2 extent y");
is(text2.getExtentOfChar(2).width, text2.getExtentOfChar(0).width, "text2 char 0/2 extent height");

View File

@ -160,14 +160,14 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1b-ltr.html bra
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1b-rtl.html brackets-1b-rtl-ref.html # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1c-ltr.html brackets-1c-ltr-ref.html # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-1c-rtl.html brackets-1c-rtl-ref.html # Bug 1392106
fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2a-ltr.html brackets-2a-ltr-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-4) fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2a-ltr.html brackets-2a-ltr-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-2) fuzzy-if(Android,0-254,0-557) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2a-rtl.html brackets-2a-rtl-ref.html # Bug 1392106
fuzzy-if(Android,0-1,0-8) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-ltr.html brackets-2b-ltr-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-2) fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-rtl.html brackets-2b-rtl-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-2) fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-ltr.html brackets-2c-ltr-ref.html # Bug 1392106
fuzzy-if(Android,0-254,0-231) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-rtl.html brackets-2c-rtl-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-3) fuzzy-if(Android,0-1,0-8) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-ltr.html brackets-3a-ltr-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-2) fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-rtl.html brackets-3a-rtl-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-6) fuzzy-if(Android,0-1,0-8) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-ltr.html brackets-2b-ltr-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-7) fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2b-rtl.html brackets-2b-rtl-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-7) fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-ltr.html brackets-2c-ltr-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-6) fuzzy-if(Android,0-254,0-231) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-2c-rtl.html brackets-2c-rtl-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-6) fuzzy-if(Android,0-1,0-8) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-ltr.html brackets-3a-ltr-ref.html # Bug 1392106
fuzzy-if(cocoaWidget,0-1,0-3) fuzzy-if(Android,0-1,0-6) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3a-rtl.html brackets-3a-rtl-ref.html # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3b-ltr.html brackets-3b-ltr-ref.html # Bug 1392106
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == brackets-3b-rtl.html brackets-3b-rtl-ref.html # Bug 1392106
== 1217833-1.html 1217833-1-ref.html

View File

@ -1,6 +1,6 @@
== box-decoration-break-1.html box-decoration-break-1-ref.html
fuzzy(0-1,0-20) fuzzy-if(skiaContent,0-1,0-700) == box-decoration-break-with-inset-box-shadow-1.html box-decoration-break-with-inset-box-shadow-1-ref.html
skip-if(verify) fuzzy(0-45,0-460) fuzzy-if(skiaContent,0-57,0-439) fuzzy-if(Android,0-70,0-1330) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == box-decoration-break-with-outset-box-shadow-1.html box-decoration-break-with-outset-box-shadow-1-ref.html # Bug 1386543, bug 1392106
skip-if(verify) fuzzy(0-45,0-460) fuzzy-if(skiaContent,0-64,0-484) fuzzy-if(Android,0-70,0-1330) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == box-decoration-break-with-outset-box-shadow-1.html box-decoration-break-with-outset-box-shadow-1-ref.html # Bug 1386543, bug 1392106
== box-decoration-break-border-image.html box-decoration-break-border-image-ref.html
== box-decoration-break-block-border-padding.html box-decoration-break-block-border-padding-ref.html
== box-decoration-break-block-margin.html box-decoration-break-block-margin-ref.html

View File

@ -8,7 +8,7 @@
<title>Reference: Testcase for bug 944200</title>
<style type="text/css">
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
color:black; background-color:white; font:20px/1 Courier New, Courier, monospace; padding:0; margin:0;
}
.container {

View File

@ -8,7 +8,7 @@
<title>Testcase for bug 944200</title>
<style type="text/css">
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
color:black; background-color:white; font:20px/1 Courier New, Courier, monospace; padding:0; margin:0;
}
.container {

View File

@ -3,9 +3,12 @@
<head>
<style>
code {
display:block;
hyphens:manual;
display: block;
hyphens: manual;
border: 1px solid black;
/* Prefer Courier New if available, as otherwise Menlo may be used,
and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
font-family: Courier New, Courier, monospace;
}
</style>
</head>

View File

@ -3,9 +3,12 @@
<head>
<style>
code {
display:block;
hyphens:auto;
display: block;
hyphens: auto;
border: 1px solid black;
/* Prefer Courier New if available, as otherwise Menlo may be used,
and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
font-family: Courier New, Courier, monospace;
}
</style>
</head>

View File

@ -3,9 +3,12 @@
<head>
<style>
code {
display:block;
hyphens:manual;
display: block;
hyphens: manual;
border: 1px solid black;
/* Prefer Courier New if available, as otherwise Menlo may be used,
and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
font-family: Courier New, Courier, monospace;
}
</style>
</head>

View File

@ -3,9 +3,12 @@
<head>
<style>
code {
display:block;
hyphens:auto;
display: block;
hyphens: auto;
border: 1px solid black;
/* Prefer Courier New if available, as otherwise Menlo may be used,
and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
font-family: Courier New, Courier, monospace;
}
</style>
</head>

View File

@ -2,7 +2,7 @@
<html lang="en">
<meta charset="utf-8">
<style>
.test { hyphens:auto; font:10px monospace; border: 1px solid silver; }
.test { hyphens:auto; font:10px Ubuntu Mono, Courier New, Courier, monospace; border: 1px solid silver; }
</style>
<body>
<p>All the columns should appear identical:</p>

View File

@ -2,7 +2,7 @@
<html lang="en">
<meta charset="utf-8">
<style>
.test { hyphens:auto; font:10px monospace; border: 1px solid silver; }
.test { hyphens:auto; font:10px Ubuntu Mono, Courier New, Courier, monospace; border: 1px solid silver; }
</style>
<body>
<p>All the columns should appear identical:</p>

View File

@ -195,7 +195,7 @@ fails-if(Android) == 1463020-letter-spacing-text-transform-2.html 1463020-letter
== 1507661-spurious-hyphenation-after-explicit.html 1507661-spurious-hyphenation-after-explicit-ref.html
fuzzy-if(!webrender,12-66,288-1681) fails-if(gtkWidget&&!webrender) == 1522857-1.html 1522857-1-ref.html # antialiasing fuzz in non-webrender cases
!= 1637405-pua-shaping-1.html 1637405-pua-shaping-1-notref.html
fuzzy-if(!webrender,0-42,0-1553) fuzzy-if(gtkWidget&&!webrender,0-255,0-50) == 1655364-1.html 1655364-1-ref.html
fuzzy-if(!webrender,0-42,0-1590) fuzzy-if(gtkWidget&&!webrender,0-255,0-50) == 1655364-1.html 1655364-1-ref.html
== 1670581-1.html 1670581-1-ref.html
== 1673098-1.html 1673098-1-ref.html

View File

@ -1,5 +1,6 @@
[selection-input-011.html]
expected:
if os == "mac" and webrender: PASS
if os == "android" and non_native_theme and webrender: PASS
FAIL
bug: Test relies on on particular font metrics which are just right on Android (and on non-WebRender we anti-alias the border with the input background).

View File

@ -3,4 +3,5 @@
expected:
if os == "linux": PASS
if os == "android": PASS
if os == "mac": PASS
FAIL

View File

@ -3,6 +3,5 @@
if (os == "win") and (processor == "aarch64"): PASS
if (os == "win") and (version == "6.1.7601"): FAIL
if not webrender and (os == "win") and (bits == 64): FAIL
if os == "mac" and not webrender: FAIL
if webrender and (os == 'android'): PASS
if (os == "android"): FAIL

View File

@ -1,3 +1,4 @@
[transform-input-009.html]
expected:
if (os == "mac"): FAIL
if (os == "android"): FAIL

View File

@ -1,4 +1,4 @@
[transform-input-012.html]
expected:
if (os == "mac") and not non_native_theme: FAIL
if (os == "mac"): FAIL
if (os == "android"): FAIL

View File

@ -7,9 +7,12 @@
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<style>
code {
display:block;
hyphens:manual;
display: block;
hyphens: manual;
border: 1px solid black;
/* Prefer Courier New if available, as otherwise Menlo may be used,
and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
font-family: Courier New, Courier, monospace;
}
</style>
</head>

View File

@ -12,9 +12,12 @@ must be ignored if the word contains a conditional hyphen (&shy; or U+00AD), in
conditional hyphen(s).">
<style>
code {
display:block;
hyphens:auto;
display: block;
hyphens: auto;
border: 1px solid black;
/* Prefer Courier New if available, as otherwise Menlo may be used,
and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
font-family: Courier New, Courier, monospace;
}
</style>
</head>