Skip to content

Commit 14a8b37

Browse files
committed
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 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
1 parent 743ec3d commit 14a8b37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+66
-159
lines changed

layout/mathml/tests/mochitest.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ support-files =
66
[test_bug553917.html]
77
[test_bug827713-2.html]
88
[test_disabled.html]
9-
[test_opentype-axis-height.html]
10-
[test_opentype-limits.html]
11-
skip-if = os == "win" # Fails on WinXP
-1.83 KB
Binary file not shown.

layout/reftests/mathml/opentype-fraction-dynamic-linethickness-ref.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

layout/reftests/mathml/opentype-fraction-dynamic-linethickness.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

layout/reftests/mathml/reftest.list

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,12 @@ random-if(gtkWidget) == mpadded-9.html mpadded-9-ref.html # bug 1309430
9090
== mo-invisibleoperators.html mo-invisibleoperators-ref.html
9191
== mo-invisibleoperators-2.html mo-invisibleoperators-2-ref.html
9292
random-if(gtkWidget) == mo-glyph-size.html mo-glyph-size-ref.html # bug 1309426
93-
random-if(winWidget&&!d2d) == opentype-stretchy.html opentype-stretchy-ref.html
94-
== opentype-fraction-dynamic-linethickness.html opentype-fraction-dynamic-linethickness-ref.html
9593
== operator-1.xhtml operator-1-ref.xhtml
9694
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
9795
== mathml-mmultiscript-base.html mathml-mmultiscript-base-ref.html
9896
== mathml-mmultiscript-mprescript.html mathml-mmultiscript-mprescript-ref.html
9997
== mmultiscript-align.html mmultiscript-align-ref.html
10098
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)
101-
== dtls-1.html dtls-1-ref.html
102-
== dtls-2.html dtls-2-ref.html
103-
pref(mathml.legacy_mathvariant_attribute.disabled,false) == dtls-3.html dtls-3-ref.html
104-
== ssty-1.html ssty-1-ref.html
105-
== ssty-2.html ssty-2-ref.html
106-
== mathscript-1.html mathscript-1-ref.html
107-
== mathscript-2.html mathscript-2-ref.html
10899
== mo-accent-dynamic.html mo-accent-dynamic-ref.html
109100
== mo-movablelimits-dynamic.html mo-movablelimits-dynamic-ref.html
110101
== 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
119110
== mfrac-C-2.html mfrac-C-2-ref.html
120111
== mfrac-D-2.html mfrac-D-2-ref.html
121112
== mfrac-E-1.html mfrac-E-1-ref.html
122-
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
123-
test-pref(font.minimum-size.x-math,40) == default-font.html default-font-ref.html
124113
!= radicalbar-1.html about:blank
125114
!= radicalbar-1a.html about:blank
126115
!= radicalbar-1b.html about:blank

layout/reftests/moz.build

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

7-
TEST_HARNESS_FILES.testing.mochitest.tests.fonts.math += [
8-
"fonts/math/axis-height-1.otf",
9-
"fonts/math/axis-height-2.otf",
10-
"fonts/math/fraction-1.otf",
11-
"fonts/math/limits-5.otf",
12-
]
13-
147
TEST_HARNESS_FILES.testing.mochitest.tests.fonts.mplus += [
158
"fonts/mplus/mplus-1p-regular.ttf",
169
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[default-font.html]
2+
prefs: [font.minimum-size.x-math: 40]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[dtls-3.html]
2+
prefs: [mathml.legacy_mathvariant_attribute.disabled: false]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[font-inflation-1.html]
2+
prefs: [ui.useOverlayScrollbars: 1, dom.meta-viewport.enabled: true, font.size.inflation.emPerLine: 25]
3+
fuzzy:
4+
if not (os == "linux"): maxDifference=0-255;totalPixels=0-324
5+
if (os == "linux"): maxDifference=0-255;totalPixels=0-66 # Bug 1607294
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[opentype-strechy.html]
2+
expected:
3+
if os == "win": [PASS, FAIL]

testing/web-platform/mozilla/tests/mathml/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ any specification:
1010
mostly used for Tor browser's "high security" mode, see
1111
[bug 1173199](https://bugzilla.mozilla.org/1173199).
1212

13+
- `fonts`: font-related tests, such as OpenType features not handled yet in
14+
MathML Core or other Gecko-specific behavior.
15+
1316
- `mathspaces_names`: Tests for
1417
[MathML3 namedspaces](https://www.w3.org/TR/MathML3/chapter2.html#type.namedspace)
1518
which are removed from MathML Core. See

layout/reftests/mathml/default-font.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/default-font.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<title>default font</title>
55
<meta charset="utf-8"/>
6+
<link rel="match" href="default-font-ref.html"/>
67
</head>
78
<body style="font: 20px monospace;">
89

layout/reftests/mathml/dtls-1-ref.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/dtls-1-ref.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<style type="text/css" media="screen, print">
44
@font-face {
55
font-family: "dtls-1";
6-
src: url(../fonts/math/dtls-1.otf);
6+
src: url(dtls-1.otf);
77
}
88
math {
99
font-family: dtls-1;

layout/reftests/mathml/dtls-1.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/dtls-1.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<!DOCTYPE html>
22
<head>
3+
<link rel="match" href="dtls-1-ref.html"/>
34
<style type="text/css" media="screen, print">
45
@font-face {
56
font-family: "dtls-1";
6-
src: url(../fonts/math/dtls-1.otf);
7+
src: url(dtls-1.otf);
78
}
89
math {
910
font-family: dtls-1;

layout/reftests/mathml/dtls-2-ref.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/dtls-2-ref.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<style type="text/css" media="screen, print">
55
@font-face {
66
font-family: "dtls-1";
7-
src: url(../fonts/math/dtls-1.otf);
7+
src: url(dtls-1.otf);
88
}
99
</style>
1010
</head>

layout/reftests/mathml/dtls-2.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/dtls-2.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<!DOCTYPE html>
22
<html class="reftest-wait">
3+
<link rel="match" href="dtls-2-ref.html"/>
34
<style type="text/css" media="screen, print">
45
@font-face {
56
font-family: "dtls-1";
6-
src: url(../fonts/math/dtls-1.otf);
7+
src: url(dtls-1.otf);
78
}
89
</style>
910
</head>
@@ -207,7 +208,7 @@
207208

208209
document.documentElement.removeAttribute("class");
209210
}
210-
window.addEventListener("MozReftestInvalidate", doTest);
211+
document.documentElement.addEventListener("TestRendered", doTest);
211212
</script>
212213
</body>
213214
</html>

layout/reftests/mathml/dtls-3-ref.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/dtls-3-ref.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<style type="text/css" media="screen, print">
55
@font-face {
66
font-family: "dtls-1";
7-
src: url(../fonts/math/dtls-1.otf);
7+
src: url(dtls-1.otf);
88
}
99
</style>
1010
</head>

layout/reftests/mathml/dtls-3.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/dtls-3.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<!DOCTYPE html>
22
<html class="reftest-wait">
3+
<link rel="match" href="dtls-3-ref.html"/>
34
<style type="text/css" media="screen, print">
45
@font-face {
56
font-family: "dtls-1";
6-
src: url(../fonts/math/dtls-1.otf);
7+
src: url(dtls-1.otf);
78
}
89
</style>
910
</head>
@@ -210,7 +211,7 @@
210211

211212
document.documentElement.removeAttribute("class");
212213
}
213-
window.addEventListener("MozReftestInvalidate", doTest);
214+
document.documentElement.addEventListener("TestRendered", doTest);
214215
</script>
215216
</body>
216217
</html>

layout/reftests/mathml/font-inflation-1-ref.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/font-inflation-1-ref.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<style>
77
@font-face {
88
font-family: "dtls-1";
9-
src: url(../fonts/math/dtls-1.otf);
9+
src: url(dtls-1.otf);
1010
}
1111
p, math {
1212
font-family: serif;

layout/reftests/mathml/font-inflation-1.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/font-inflation-1.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
<head>
44
<title>Font Inflation</title>
55
<meta charset="utf-8"/>
6+
<link rel="match" href="font-inflation-1-ref.html"/>
67
<style>
78
@font-face {
89
font-family: "dtls-1";
9-
src: url(../fonts/math/dtls-1.otf);
10+
src: url(dtls-1.otf);
1011
}
1112
p, math {
1213
font-family: serif;
@@ -43,7 +44,7 @@
4344
document.documentElement.removeAttribute("class");
4445
}
4546

46-
window.addEventListener("MozReftestInvalidate", verifySizes);
47+
document.documentElement.addEventListener("TestRendered", verifySizes);
4748
</script>
4849
</head>
4950
<body>

layout/reftests/fonts/math/generate.py renamed to testing/web-platform/mozilla/tests/mathml/fonts/generate.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -290,21 +290,6 @@ def createDiamondGlyph(aFont, aCodePoint):
290290
createSquareGlyph(f, ord("+"))
291291
saveMathFont(f)
292292

293-
################################################################################
294-
# Testing Fraction Parameters
295-
f = newMathFont("fraction-1")
296-
f.math.FractionRuleThickness = 20 * em
297-
f.math.FractionNumeratorShiftUp = 0
298-
f.math.FractionNumeratorDisplayStyleShiftUp = 0
299-
f.math.FractionDenominatorShiftDown = 0
300-
f.math.FractionNumeratorGapMin = 0
301-
f.math.FractionDenominatorGapMin = 0
302-
f.math.FractionNumeratorDisplayStyleShiftUp = 0
303-
f.math.FractionDenominatorDisplayStyleShiftDown = 0
304-
f.math.FractionNumeratorDisplayStyleGapMin = 0
305-
f.math.FractionDenominatorDisplayStyleGapMin = 0
306-
saveMathFont(f)
307-
308293
################################################################################
309294
# Testing Limits Parameters
310295
f = newMathFont("limits-5")

layout/reftests/mathml/mathscript-1-ref.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/mathscript-1-ref.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

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

layout/reftests/mathml/mathscript-1.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/mathscript-1.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!DOCTYPE html>
22
<head>
3+
<link rel="match" href="mathscript-1-ref.html"/>
34
<style type="text/css" media="screen, print">
45
@font-face {
56
font-family: "mathssty";
@@ -10,9 +11,9 @@
1011
<body>
1112

1213
<!-- Demonstrate that it has no effect outside MathML -->
13-
<div style="font-family: 'mathssty';
14+
<div style="font-family: 'mathssty';
1415
font-feature-settings: 'ssty' 1">A</div>
15-
<div style="font-family: 'mathssty';
16+
<div style="font-family: 'mathssty';
1617
font-feature-settings: 'ssty' 2">A</div>
1718

1819
<!-- Demonstrate that it works within MathML -->

layout/reftests/mathml/mathscript-2.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/mathscript-2.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html class="reftest-wait">
33
<head>
44
<title>Dynamic OpenType 'math' script tests</title>
5+
<link rel="match" href="mathscript-2-ref.html"/>
56
<!-- See mathscript-1-ref.html for an explanation of this font -->
67
<style type="text/css" media="screen, print">
78
@font-face {
@@ -32,7 +33,7 @@
3233
document.getElementById("mo0").appendChild(document.createTextNode("A"));
3334
document.documentElement.removeAttribute("class");
3435
}
35-
window.addEventListener("MozReftestInvalidate", doTest);
36+
document.documentElement.addEventListener("TestRendered", doTest);
3637
</script>
3738

3839
</body>

layout/mathml/tests/test_opentype-axis-height.html renamed to testing/web-platform/mozilla/tests/mathml/fonts/opentype-axis-height.html

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,41 @@
22
<html>
33
<head>
44
<title>Open Type MATH - axis-height</title>
5-
<script src="/tests/SimpleTest/SimpleTest.js"></script>
6-
<script src="/tests/SimpleTest/EventUtils.js"></script>
7-
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365"/>
88
<meta charset="utf-8"/>
99
<style type="text/css">
1010
math {
1111
font-size: 10px;
1212
}
1313
@font-face {
1414
font-family: axis-height-1;
15-
src: url(/tests/fonts/math/axis-height-1.otf);
15+
src: url(axis-height-1.otf);
1616
}
1717
@font-face {
1818
font-family: axis-height-2;
19-
src: url(/tests/fonts/math/axis-height-2.otf);
19+
src: url(axis-height-2.otf);
2020
}
2121
</style>
2222
<script type="application/javascript">
23-
SimpleTest.waitForExplicitFinish();
23+
setup({explicit_done : true});
2424

2525
var epsilon = 5;
26-
function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }
2726

2827
function getBox(aId) {
2928
return document.getElementById(aId).getBoundingClientRect();
3029
}
3130

3231
function doTest() {
33-
ok(almostEqual(getBox("plus1").top - getBox("plus2").top, 10 * 20),
34-
"Bad AxisHeight");
35-
36-
SimpleTest.finish();
32+
test(function() {
33+
assert_approx_equals(getBox("plus1").top - getBox("plus2").top, 10 * 20, epsilon);
34+
}, "AxisHeight");
35+
done();
3736
}
3837
</script>
3938
</head>
4039
<body onload="doTest()">
41-
<a target="_blank"
42-
href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365">
43-
Mozilla Bug 961365
44-
</a>
45-
46-
<p id="display"></p>
4740

4841
<p>
4942
<math style="font-family: axis-height-1;">

0 commit comments

Comments
 (0)