Bug 1847007 - Convert font-related MathML tests to WPT. r=emilio

* opentype-axis-height.html: This is verifying Gecko's special behavior
  to calculate fallback for AxisHeight fallback
  (see nsMathMLFrame::GetAxisHeight) but that's not part of MathML
  Core so keep it as an internal testharness test.

* opentype-limits.html: This is verifying the Gecko's interpretation
  of AccentBaseHeight / accent property, which is different from
  MathML Core so keep it as an internal testharness test. Remove
  failure for Win XP, which we no longer support.

* opentype-fraction-dynamic-linethickness: Remove since that's covered
  by mathml/presentation-markup/fractions/frac-parameters-2.html

* dtls-*: Tests for the dtls OpenType feature, which are not part of
  MathML Core.

* ssty-*, mathscript-*: Tests for the ssty OpenType feature, which are
  not part of MathML Core.

* default-font.html: This is testing Gecko's x-math preferences, so keep
  it as internal test.

* font-inflation-1.html: This is testing Gecko's font inflation feature,
  so keep it as internal test.

* opentype-stretchy.html: There are similar testharness tests in the
  official WPT but this reftest additionally checks the painting of
  stretchy/largeop. It's also possible that the
  DisplayOperatorMinHeight test specifically checks Gecko's
  handling of integrals which is not part of MathML Core
  (see https://github.com/w3c/mathml-core/issues/126). For now, just
  keep this as internal WPT test. Mark it as random on all Windows
  platform as there does not seem to be an equivalent for 2d2.

Differential Revision: https://phabricator.services.mozilla.com/D185291
This commit is contained in:
Frederic Wang 2023-08-04 09:04:28 +00:00
Родитель 8037fb727d
Коммит 8dc5180e6d
42 изменённых файлов: 66 добавлений и 159 удалений

Просмотреть файл

@ -6,6 +6,3 @@ support-files =
[test_bug553917.html]
[test_bug827713-2.html]
[test_disabled.html]
[test_opentype-axis-height.html]
[test_opentype-limits.html]
skip-if = os == "win" # Fails on WinXP

Двоичные данные
layout/reftests/fonts/math/fraction-1.otf

Двоичный файл не отображается.

Просмотреть файл

@ -1,29 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>mfrac linethickness</title>
<style type="text/css">
math {
font-size: 10px;
}
@font-face {
font-family: fraction-1;
src: url(../fonts/math/fraction-1.otf);
}
</style>
</head>
<body>
<math style="font-family: fraction-1;">
<mfrac>
<mspace height="1em" width="1em" mathbackground="red"/>
<mspace height="1em" width="1em" mathbackground="red"/>
</mfrac>
</math>
<math displaystyle="true" style="font-family: fraction-1;">
<mfrac>
<mspace height="1em" width="1em" mathbackground="red"/>
<mspace height="1em" width="1em" mathbackground="red"/>
</mfrac>
</math>
</body>
</html>

Просмотреть файл

@ -1,38 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>mfrac linethickness</title>
<style type="text/css">
math {
font-size: 10px;
}
@font-face {
font-family: fraction-1;
src: url(../fonts/math/fraction-1.otf);
}
</style>
<script type="text/javascript">
function doTest() {
var mfracs = document.getElementsByTagName("mfrac");
mfracs[0].removeAttribute("linethickness");
mfracs[1].removeAttribute("linethickness");
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</head>
<body>
<math style="font-family: fraction-1;">
<mfrac linethickness="200%">
<mspace height="1em" width="1em" mathbackground="red"/>
<mspace height="1em" width="1em" mathbackground="red"/>
</mfrac>
</math>
<math displaystyle="true" style="font-family: fraction-1;">
<mfrac linethickness="200%">
<mspace height="1em" width="1em" mathbackground="red"/>
<mspace height="1em" width="1em" mathbackground="red"/>
</mfrac>
</math>
</body>
</html>

Просмотреть файл

@ -90,21 +90,12 @@ random-if(gtkWidget) == mpadded-9.html mpadded-9-ref.html # bug 1309430
== mo-invisibleoperators.html mo-invisibleoperators-ref.html
== mo-invisibleoperators-2.html mo-invisibleoperators-2-ref.html
random-if(gtkWidget) == mo-glyph-size.html mo-glyph-size-ref.html # bug 1309426
random-if(winWidget&&!d2d) == opentype-stretchy.html opentype-stretchy-ref.html
== opentype-fraction-dynamic-linethickness.html opentype-fraction-dynamic-linethickness-ref.html
== operator-1.xhtml operator-1-ref.xhtml
fuzzy(0-1,0-80) fuzzy-if(Android,0-255,0-105) fuzzy-if(gtkWidget,0-255,0-136) skip-if(winWidget) == multiscripts-1.html multiscripts-1-ref.html # Windows: bug 1314684; Android: bug 1392254; Linux: bug 1599638
== mathml-mmultiscript-base.html mathml-mmultiscript-base-ref.html
== mathml-mmultiscript-mprescript.html mathml-mmultiscript-mprescript-ref.html
== mmultiscript-align.html mmultiscript-align-ref.html
fails-if(winWidget) fuzzy-if(gtkWidget,255-255,776226-776226) == subscript-italic-correction.html subscript-italic-correction-ref.html # bug 961482 (Windows), bug 1599640 (Linux)
== dtls-1.html dtls-1-ref.html
== dtls-2.html dtls-2-ref.html
pref(mathml.legacy_mathvariant_attribute.disabled,false) == dtls-3.html dtls-3-ref.html
== ssty-1.html ssty-1-ref.html
== ssty-2.html ssty-2-ref.html
== mathscript-1.html mathscript-1-ref.html
== mathscript-2.html mathscript-2-ref.html
== mo-accent-dynamic.html mo-accent-dynamic-ref.html
== mo-movablelimits-dynamic.html mo-movablelimits-dynamic-ref.html
== munderover-accent-dynamic.html munderover-accent-dynamic-ref.html
@ -119,8 +110,6 @@ pref(mathml.legacy_mathvariant_attribute.disabled,false) == dtls-3.html dtls-3-r
== mfrac-C-2.html mfrac-C-2-ref.html
== mfrac-D-2.html mfrac-D-2-ref.html
== mfrac-E-1.html mfrac-E-1-ref.html
pref(ui.useOverlayScrollbars,1) pref(dom.meta-viewport.enabled,true) pref(font.size.inflation.emPerLine,25) fuzzy-if(!gtkWidget,0-255,0-324) fuzzy-if(gtkWidget,0-255,0-66) == font-inflation-1.html font-inflation-1-ref.html # gtkWidget due to Bug 1607294
test-pref(font.minimum-size.x-math,40) == default-font.html default-font-ref.html
!= radicalbar-1.html about:blank
!= radicalbar-1a.html about:blank
!= radicalbar-1b.html about:blank

Просмотреть файл

@ -4,13 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TEST_HARNESS_FILES.testing.mochitest.tests.fonts.math += [
"fonts/math/axis-height-1.otf",
"fonts/math/axis-height-2.otf",
"fonts/math/fraction-1.otf",
"fonts/math/limits-5.otf",
]
TEST_HARNESS_FILES.testing.mochitest.tests.fonts.mplus += [
"fonts/mplus/mplus-1p-regular.ttf",
]

Просмотреть файл

@ -0,0 +1,2 @@
[default-font.html]
prefs: [font.minimum-size.x-math: 40]

Просмотреть файл

@ -0,0 +1,2 @@
[dtls-3.html]
prefs: [mathml.legacy_mathvariant_attribute.disabled: false]

Просмотреть файл

@ -0,0 +1,5 @@
[font-inflation-1.html]
prefs: [ui.useOverlayScrollbars: 1, dom.meta-viewport.enabled: true, font.size.inflation.emPerLine: 25]
fuzzy:
if not (os == "linux"): maxDifference=0-255;totalPixels=0-324
if (os == "linux"): maxDifference=0-255;totalPixels=0-66 # Bug 1607294

Просмотреть файл

@ -0,0 +1,3 @@
[opentype-strechy.html]
expected:
if os == "win": [PASS, FAIL]

Просмотреть файл

@ -10,6 +10,9 @@ any specification:
mostly used for Tor browser's "high security" mode, see
[bug 1173199](https://bugzilla.mozilla.org/1173199).
- `fonts`: font-related tests, such as OpenType features not handled yet in
MathML Core or other Gecko-specific behavior.
- `mathspaces_names`: Tests for
[MathML3 namedspaces](https://www.w3.org/TR/MathML3/chapter2.html#type.namedspace)
which are removed from MathML Core. See

Просмотреть файл

@ -3,6 +3,7 @@
<head>
<title>default font</title>
<meta charset="utf-8"/>
<link rel="match" href="default-font-ref.html"/>
</head>
<body style="font: 20px monospace;">

Просмотреть файл

@ -3,7 +3,7 @@
<style type="text/css" media="screen, print">
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
math {
font-family: dtls-1;

Просмотреть файл

@ -1,9 +1,10 @@
<!DOCTYPE html>
<head>
<link rel="match" href="dtls-1-ref.html"/>
<style type="text/css" media="screen, print">
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
math {
font-family: dtls-1;

Просмотреть файл

@ -4,7 +4,7 @@
<style type="text/css" media="screen, print">
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
</style>
</head>

Просмотреть файл

@ -1,9 +1,10 @@
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="dtls-2-ref.html"/>
<style type="text/css" media="screen, print">
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
</style>
</head>
@ -207,7 +208,7 @@
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
document.documentElement.addEventListener("TestRendered", doTest);
</script>
</body>
</html>

Просмотреть файл

@ -4,7 +4,7 @@
<style type="text/css" media="screen, print">
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
</style>
</head>

Просмотреть файл

@ -1,9 +1,10 @@
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="dtls-3-ref.html"/>
<style type="text/css" media="screen, print">
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
</style>
</head>
@ -210,7 +211,7 @@
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
document.documentElement.addEventListener("TestRendered", doTest);
</script>
</body>
</html>

Просмотреть файл

@ -6,7 +6,7 @@
<style>
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
p, math {
font-family: serif;

Просмотреть файл

@ -3,10 +3,11 @@
<head>
<title>Font Inflation</title>
<meta charset="utf-8"/>
<link rel="match" href="font-inflation-1-ref.html"/>
<style>
@font-face {
font-family: "dtls-1";
src: url(../fonts/math/dtls-1.otf);
src: url(dtls-1.otf);
}
p, math {
font-family: serif;
@ -43,7 +44,7 @@
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", verifySizes);
document.documentElement.addEventListener("TestRendered", verifySizes);
</script>
</head>
<body>

Просмотреть файл

@ -290,21 +290,6 @@ f.math.AxisHeight = 20 * em
createSquareGlyph(f, ord("+"))
saveMathFont(f)
################################################################################
# Testing Fraction Parameters
f = newMathFont("fraction-1")
f.math.FractionRuleThickness = 20 * em
f.math.FractionNumeratorShiftUp = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionDenominatorShiftDown = 0
f.math.FractionNumeratorGapMin = 0
f.math.FractionDenominatorGapMin = 0
f.math.FractionNumeratorDisplayStyleShiftUp = 0
f.math.FractionDenominatorDisplayStyleShiftDown = 0
f.math.FractionNumeratorDisplayStyleGapMin = 0
f.math.FractionDenominatorDisplayStyleGapMin = 0
saveMathFont(f)
################################################################################
# Testing Limits Parameters
f = newMathFont("limits-5")

Просмотреть файл

@ -3,9 +3,9 @@
<!-- This font only has glyphs defined for 'A', 'B', 'C' and 'D', and is
designed purely for testing ssty and OpenType 'math' script
functionality
functionality
The glyphs for 'A' and 'D' are identical, the difference between them is
that 'A' supports the ssty font feature.
that 'A' supports the ssty font feature.
'A' with ssty = 1 maps to 'B'
'A' with ssty = 2 maps to 'C'
The difference between this font and ssty.woff is that the font feature

Просмотреть файл

@ -1,5 +1,6 @@
<!DOCTYPE html>
<head>
<link rel="match" href="mathscript-1-ref.html"/>
<style type="text/css" media="screen, print">
@font-face {
font-family: "mathssty";
@ -10,9 +11,9 @@
<body>
<!-- Demonstrate that it has no effect outside MathML -->
<div style="font-family: 'mathssty';
<div style="font-family: 'mathssty';
font-feature-settings: 'ssty' 1">A</div>
<div style="font-family: 'mathssty';
<div style="font-family: 'mathssty';
font-feature-settings: 'ssty' 2">A</div>
<!-- Demonstrate that it works within MathML -->

Просмотреть файл

@ -2,6 +2,7 @@
<html class="reftest-wait">
<head>
<title>Dynamic OpenType 'math' script tests</title>
<link rel="match" href="mathscript-2-ref.html"/>
<!-- See mathscript-1-ref.html for an explanation of this font -->
<style type="text/css" media="screen, print">
@font-face {
@ -32,7 +33,7 @@
document.getElementById("mo0").appendChild(document.createTextNode("A"));
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
document.documentElement.addEventListener("TestRendered", doTest);
</script>
</body>

Просмотреть файл

@ -2,9 +2,9 @@
<html>
<head>
<title>Open Type MATH - axis-height</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"/>
<meta charset="utf-8"/>
<style type="text/css">
math {
@ -12,38 +12,31 @@
}
@font-face {
font-family: axis-height-1;
src: url(/tests/fonts/math/axis-height-1.otf);
src: url(axis-height-1.otf);
}
@font-face {
font-family: axis-height-2;
src: url(/tests/fonts/math/axis-height-2.otf);
src: url(axis-height-2.otf);
}
</style>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
setup({explicit_done : true});
var epsilon = 5;
function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }
function getBox(aId) {
return document.getElementById(aId).getBoundingClientRect();
}
function doTest() {
ok(almostEqual(getBox("plus1").top - getBox("plus2").top, 10 * 20),
"Bad AxisHeight");
SimpleTest.finish();
test(function() {
assert_approx_equals(getBox("plus1").top - getBox("plus2").top, 10 * 20, epsilon);
}, "AxisHeight");
done();
}
</script>
</head>
<body onload="doTest()">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365">
Mozilla Bug 961365
</a>
<p id="display"></p>
<p>
<math style="font-family: axis-height-1;">

Просмотреть файл

@ -2,9 +2,9 @@
<html>
<head>
<title>Open Type MATH - limits</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"/>
<meta charset="utf-8"/>
<style type="text/css">
math {
@ -12,39 +12,31 @@
}
@font-face {
font-family: limits-5;
src: url(/tests/fonts/math/limits-5.otf);
src: url(limits-5.otf);
}
</style>
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
setup({explicit_done : true});
var epsilon = 5;
function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }
function getBox(aId) {
return document.getElementById(aId).getBoundingClientRect();
}
function doTest() {
ok(almostEqual(getBox("base9").top - getBox("over9").bottom,
(6 - 2) * 10) &&
almostEqual(getBox("base10").top - getBox("over10").bottom,
(6 - 2) * 10),
"Bad AccentBaseHeight");
SimpleTest.finish();
test(function() {
assert_approx_equals(getBox("base9").top - getBox("over9").bottom,
(6 - 2) * 10, epsilon);
assert_approx_equals(getBox("base10").top - getBox("over10").bottom,
(6 - 2) * 10, epsilon);
}, "AccentBaseHeight");
done();
}
</script>
</head>
<body onload="doTest()">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365">
Mozilla Bug 961365
</a>
<p id="display"></p>
<p>
<math style="font-family: limits-5;" displaystyle="true">
<mspace id="ref5" height="1em" width="1em" mathbackground="green"/>

Просмотреть файл

@ -6,7 +6,7 @@
<style type="text/css">
@font-face {
font-family: stretchy;
src: url(../fonts/math/stretchy.otf);
src: url(stretchy.otf);
}
math {
font-family: stretchy;

Просмотреть файл

@ -2,11 +2,12 @@
<html>
<head>
<title>Open Type MATH - stretchy operator</title>
<link rel="match" href="opentype-stretchy-ref.html"/>
<meta charset="utf-8"/>
<style type="text/css">
@font-face {
font-family: stretchy;
src: url(../fonts/math/stretchy.otf);
src: url(stretchy.otf);
}
math {
font-family: stretchy;

Просмотреть файл

@ -1,5 +1,6 @@
<!DOCTYPE html>
<head>
<link rel="match" href="ssty-1-ref.html"/>
<style type="text/css" media="screen, print">
@font-face {
font-family: "sstyfont";

Просмотреть файл

@ -272,4 +272,4 @@
</mstyle>
</math>
</body>
</body>

Просмотреть файл

@ -1,5 +1,6 @@
<!DOCTYPE html>
<head>
<link rel="match" href="ssty-2-ref.html"/>
<!-- See ssty-1-ref.html for an explanation of this font -->
<style type="text/css" media="screen, print">
@font-face {