Skip to content

Commit

Permalink
Bug 1847007 - Convert font-related MathML tests to WPT. r=emilio
Browse files Browse the repository at this point in the history
* 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 w3c/mathml-core#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
  • Loading branch information
fred-wang committed Aug 4, 2023
1 parent 8037fb7 commit 8dc5180
Show file tree
Hide file tree
Showing 42 changed files with 66 additions and 159 deletions.
3 changes: 0 additions & 3 deletions layout/mathml/tests/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file removed layout/reftests/fonts/math/fraction-1.otf
Binary file not shown.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions layout/reftests/mathml/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 0 additions & 7 deletions layout/reftests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default-font.html]
prefs: [font.minimum-size.x-math: 40]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[dtls-3.html]
prefs: [mathml.legacy_mathvariant_attribute.disabled: false]
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[opentype-strechy.html]
expected:
if os == "win": [PASS, FAIL]
3 changes: 3 additions & 0 deletions testing/web-platform/mozilla/tests/mathml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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;">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -207,7 +208,7 @@

document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
document.documentElement.addEventListener("TestRendered", doTest);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -210,7 +211,7 @@

document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
document.documentElement.addEventListener("TestRendered", doTest);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,7 +44,7 @@
document.documentElement.removeAttribute("class");
}

window.addEventListener("MozReftestInvalidate", verifySizes);
document.documentElement.addEventListener("TestRendered", verifySizes);
</script>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,21 +290,6 @@ def createDiamondGlyph(aFont, aCodePoint):
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")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,41 @@
<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 {
font-size: 10px;
}
@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;">
Expand Down
Loading

0 comments on commit 8dc5180

Please sign in to comment.