summaryrefslogtreecommitdiffstats
path: root/layout/mathml/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /layout/mathml/tests
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/mathml/tests')
-rw-r--r--layout/mathml/tests/chrome.ini6
-rw-r--r--layout/mathml/tests/file_bug706406_iframe.html61
-rw-r--r--layout/mathml/tests/file_disabled_iframe.html33
-rw-r--r--layout/mathml/tests/mathml_example_test.html28
-rw-r--r--layout/mathml/tests/mochitest.ini14
-rw-r--r--layout/mathml/tests/test_bug330964.html98
-rw-r--r--layout/mathml/tests/test_bug553917.html221
-rw-r--r--layout/mathml/tests/test_bug706406.html19
-rw-r--r--layout/mathml/tests/test_bug827713-2.html123
-rw-r--r--layout/mathml/tests/test_disabled.html23
-rw-r--r--layout/mathml/tests/test_disabled_chrome.html51
-rw-r--r--layout/mathml/tests/test_opentype-axis-height.html58
-rw-r--r--layout/mathml/tests/test_opentype-limits.html68
13 files changed, 803 insertions, 0 deletions
diff --git a/layout/mathml/tests/chrome.ini b/layout/mathml/tests/chrome.ini
new file mode 100644
index 0000000000..0885f4c6b3
--- /dev/null
+++ b/layout/mathml/tests/chrome.ini
@@ -0,0 +1,6 @@
+[DEFAULT]
+
+support-files =
+ mathml_example_test.html
+
+[test_disabled_chrome.html]
diff --git a/layout/mathml/tests/file_bug706406_iframe.html b/layout/mathml/tests/file_bug706406_iframe.html
new file mode 100644
index 0000000000..e1fd3f7423
--- /dev/null
+++ b/layout/mathml/tests/file_bug706406_iframe.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<style>
+/* For some reason, test is failing on treeherder if the rules from the UA sheet
+ are not overridden. */
+ maction > :not(:first-child) { display: inline; }
+</style>
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <maction actiontype="toggle" id="maction">
+ <mn>1</mn>
+ <mn>2</mn>
+ </maction>
+</math>
+<pre id="test">
+<script>
+window.is = window.parent.is;
+window.SimpleTest = window.parent.SimpleTest;
+function doTest()
+{
+ function doStopPropagation(aEvent) {
+ aEvent.stopPropagation();
+ }
+
+ var maction = document.getElementById("maction");
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "2",
+ "maction's selection attribute isn't 2 by first click");
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "1",
+ "maction's selection attribute isn't 1 by second click");
+
+ window.addEventListener("mousedown", doStopPropagation, true);
+ window.addEventListener("mouseup", doStopPropagation, true);
+ window.addEventListener("click", doStopPropagation, true);
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "2",
+ "maction's selection attribute isn't 2 by first click called stopPropagation()");
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "1",
+ "maction's selection attribute isn't 1 by second click called stopPropagation()");
+
+ window.removeEventListener("mousedown", doStopPropagation, true);
+ window.removeEventListener("mouseup", doStopPropagation, true);
+ window.removeEventListener("click", doStopPropagation, true);
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(doTest);
+
+</script>
+</pre>
diff --git a/layout/mathml/tests/file_disabled_iframe.html b/layout/mathml/tests/file_disabled_iframe.html
new file mode 100644
index 0000000000..24ff4847ae
--- /dev/null
+++ b/layout/mathml/tests/file_disabled_iframe.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<script>
+window.is = window.parent.is;
+window.SimpleTest = window.parent.SimpleTest;
+</script>
+<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
+<pre id="test">
+<script>
+ let t = document.getElementById('testnodes');
+ t.innerHTML = null;
+ t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math:math"));
+ t.firstChild.textContent = "<foo>";
+ is(t.innerHTML, "<math:math>&lt;foo&gt;</math:math>");
+
+ t.innerHTML = null;
+ t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
+ is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script"));
+ is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
+ is(t.innerHTML, '<math><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></math>');
+
+ t.innerHTML = null;
+ t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
+ is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "style"));
+ is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
+ is(t.innerHTML, '<math><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></math>');
+
+ SimpleTest.finish();
+</script>
+</pre>
diff --git a/layout/mathml/tests/mathml_example_test.html b/layout/mathml/tests/mathml_example_test.html
new file mode 100644
index 0000000000..6eee75d013
--- /dev/null
+++ b/layout/mathml/tests/mathml_example_test.html
@@ -0,0 +1,28 @@
+<math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mstyle scriptsizemultiplier="2">
+ <msub>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </msub>
+ <msup>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </msup>
+ <msubsup>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </msubsup>
+ <mmultiscripts>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ <mprescripts/>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </mmultiscripts>
+ </mstyle>
+</math>
+
+<svg id="svgel">
+</svg>
diff --git a/layout/mathml/tests/mochitest.ini b/layout/mathml/tests/mochitest.ini
new file mode 100644
index 0000000000..f5aec6be3d
--- /dev/null
+++ b/layout/mathml/tests/mochitest.ini
@@ -0,0 +1,14 @@
+[DEFAULT]
+support-files =
+ file_disabled_iframe.html
+ file_bug706406_iframe.html
+
+[test_bug330964.html]
+[test_bug553917.html]
+[test_bug706406.html]
+disabled = bug 1789349
+[test_bug827713-2.html]
+[test_disabled.html]
+[test_opentype-axis-height.html]
+[test_opentype-limits.html]
+skip-if = os == "win" # Fails on WinXP
diff --git a/layout/mathml/tests/test_bug330964.html b/layout/mathml/tests/test_bug330964.html
new file mode 100644
index 0000000000..84da15194e
--- /dev/null
+++ b/layout/mathml/tests/test_bug330964.html
@@ -0,0 +1,98 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=330964
+-->
+<head>
+ <title>Test for Bug 706406</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=330964">Mozilla Bug 330964</a>
+<p id="display"></p>
+
+<math>
+ <mtable framespacing="7px 20px" frame="solid" rowspacing="11px 27px" columnspacing="5px 16px"
+ style="border-width: 2px;" id="mtable0">
+ <mtr>
+ <mtd id="mtd0">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd1">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd2">
+ <mn>X</mn>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd id="mtd3">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd4">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd5">
+ <mn>X</mn>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd id="mtd6">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd7">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd8">
+ <mn>X</mn>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
+
+<pre id="test">
+<script type="application/javascript">
+
+ var epsilon = 2;
+ function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }
+
+ rectTable = $("mtable0").getBoundingClientRect();
+ rect0 = $("mtd0").getBoundingClientRect();
+ rect1 = $("mtd1").getBoundingClientRect();
+ rect2 = $("mtd2").getBoundingClientRect();
+ rect3 = $("mtd3").getBoundingClientRect();
+ rect4 = $("mtd4").getBoundingClientRect();
+ rect5 = $("mtd5").getBoundingClientRect();
+ rect6 = $("mtd6").getBoundingClientRect();
+ rect7 = $("mtd7").getBoundingClientRect();
+ rect8 = $("mtd8").getBoundingClientRect();
+ ok(almostEqual(rect1.left - rect0.right, 5), "columnspacing wonky");
+ ok(almostEqual(rect2.left - rect1.right, 16), "columnspacing wonky");
+ ok(almostEqual(rect4.left - rect3.right, 5), "columnspacing wonky");
+ ok(almostEqual(rect5.left - rect4.right, 16), "columnspacing wonky");
+ ok(almostEqual(rect7.left - rect6.right, 5), "columnspacing wonky");
+ ok(almostEqual(rect8.left - rect7.right, 16), "columnspacing wonky");
+ ok(almostEqual(rect3.top - rect0.bottom, 11), "rowspacing wonky");
+ ok(almostEqual(rect4.top - rect1.bottom, 11), "rowspacing wonky");
+ ok(almostEqual(rect5.top - rect2.bottom, 11), "rowspacing wonky");
+ ok(almostEqual(rect6.top - rect3.bottom, 27), "rowspacing wonky");
+ ok(almostEqual(rect7.top - rect4.bottom, 27), "rowspacing wonky");
+ ok(almostEqual(rect8.top - rect5.bottom, 27), "rowspacing wonky");
+ // Remember to subtract border
+ ok(almostEqual(rect0.left - rectTable.left - 2, 7), "framespacing left wonky");
+ ok(almostEqual(rect3.left - rectTable.left - 2, 7), "framespacing left wonky");
+ ok(almostEqual(rect6.left - rectTable.left - 2, 7), "framespacing left wonky");
+ ok(almostEqual(rect0.top - rectTable.top - 2, 20), "framespacing top wonky");
+ ok(almostEqual(rect1.top - rectTable.top - 2, 20), "framespacing top wonky");
+ ok(almostEqual(rect2.top - rectTable.top - 2, 20), "framespacing top wonky");
+ ok(almostEqual(rectTable.bottom - rect6.bottom - 2, 20), "framespacing bottom wonky");
+ ok(almostEqual(rectTable.bottom - rect7.bottom - 2, 20), "framespacing bottom wonky");
+ ok(almostEqual(rectTable.bottom - rect8.bottom - 2, 20), "framespacing bottom wonky");
+ ok(almostEqual(rectTable.right - rect2.right - 2, 7), "framespacing right wonky");
+ ok(almostEqual(rectTable.right - rect5.right - 2, 7), "framespacing right wonky");
+ ok(almostEqual(rectTable.right - rect8.right - 2, 7), "framespacing right wonky");
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/mathml/tests/test_bug553917.html b/layout/mathml/tests/test_bug553917.html
new file mode 100644
index 0000000000..0992e6708d
--- /dev/null
+++ b/layout/mathml/tests/test_bug553917.html
@@ -0,0 +1,221 @@
+<!DOCTYPE HTML>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=553917
+-->
+<html>
+ <head>
+ <title>Test for Bug 553917</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 type="application/javascript">
+ var stringBundleService =
+ SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(SpecialPowers.Ci.nsIStringBundleService);
+ var g_bundl =
+ stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
+
+ const allow_mathspace_names = !SpecialPowers.getBoolPref('mathml.mathspace_names.disabled');
+ const allow_scriptsizemultiplier_attribute = !SpecialPowers.getBoolPref('mathml.scriptsizemultiplier_attribute.disabled');
+
+ var g_errorInfo = {
+ /*<math><mroot></mroot></math>
+ <math><msub></msub></math>
+ <math><msup></msup></math>
+ <math><mfrac></mfrac></math>
+ <math><msubsup></msubsup></math>
+ <math><munderover></munderover></math>*/
+ ChildCountIncorrect: {
+ status : [false, false, false, false, false, false],
+ args : [["mroot"], ["msub"], ["msup"], ["mfrac"], ["msubsup"], ["munderover"]] },
+ /*<math><mpadded width="BAD!"></mpadded></math>
+ <math><mpadded height="BAD!"></mpadded></math>
+ <math><mpadded voffset="BAD!"></mpadded></math>*/
+ AttributeParsingError: {
+ status: [false, false, false],
+ args: [["BAD!","width","mpadded"], ["BAD!","height","mpadded"], ["BAD!","voffset","mpadded"]]
+ },
+ /*<math scriptlevel="BAD!"></math>
+ <math scriptsizemultiplier="BAD!"></math>*/
+ AttributeParsingErrorNoTag: {
+ status: [false, !allow_scriptsizemultiplier_attribute],
+ args: [["BAD!","scriptlevel"], ["BAD!","scriptsizemultiplier"]]
+ },
+ /* <math><mo rspace="2..0px">+</mo></math>
+ <math><mo minsize="1.5notaunit">+</mo></math>
+ <math><mspace width="2"/></math>
+ <math><mo lspace="BADlspace">+</mo></math>
+ <math><mspace height="BADheight"/></math>
+ <math><mspace depth="BADdepth"/></math>
+ <math><mfrac linethickness="thin"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="medium"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="thick"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mstyle mathsize="small"></mstyle></math>
+ <math><mstyle mathsize="normal"></mstyle></math>
+ <math><mstyle mathsize="big"></mstyle></math>
+ <math><mspace width="veryverythinmathspace"/></math>
+ <math><mspace width="verythinmathspace"/></math>
+ <math><mspace width="thinmathspace"/></math>
+ <math><mspace width="mediummathspace"/></math>
+ <math><mspace width="thickmathspace"/></math>
+ <math><mspace width="verythickmathspace"/></math>
+ <math><mspace width="veryverythickmathspace"/></math>
+ <math><mspace width="12345."/></math>
+ <math><mo minsize="17">+</mo></math>
+ */
+ LengthParsingError : {
+ status: [false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ false,
+ false,
+ ],
+ args: [["2..0px"],
+ ["1.5notaunit"],
+ ["2"],
+ ["BADlspace"],
+ ["BADheight"],
+ ["BADdepth"],
+ ["thin"],
+ ["medium"],
+ ["thick"],
+ ["small"],
+ ["normal"],
+ ["big"],
+ ["veryverythinmathspace"],
+ ["verythinmathspace"],
+ ["thinmathspace"],
+ ["mediummathspace"],
+ ["thickmathspace"],
+ ["verythickmathspace"],
+ ["veryverythickmathspace"],
+ ["12345."],
+ ["17"]
+ ]
+ },
+ /*<math><mmultiscripts></mmultiscripts></math>
+ <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
+ <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>*/
+ MMultiscriptsErrors: {
+ status: [false, false, false],
+ args: ["NoBase","DuplicateMprescripts", "SubSupMismatch"]
+ }};
+
+ var g_errorTypes = ["ChildCountIncorrect","AttributeParsingError",
+ "AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors"];
+
+ function getErrorMessage(name,idx)
+ {
+ if (name != "MMultiscriptsErrors") {
+ var formatParams = g_errorInfo[name].args[idx];
+ if (formatParams.length > 0) {
+ return g_bundl.formatStringFromName(name,formatParams);
+ }
+ return g_bundl.GetStringFromName(name);
+ }
+ return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
+ }
+
+ /** Checks the roll call to see if all expected error messages were present. */
+ function processRollCall()
+ {
+ for (var i=0; i<g_errorTypes.length;i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ ok(g_errorInfo[g_errorTypes[i]].status[j],
+ "\"" + getErrorMessage(g_errorTypes[i], j)
+ + "\" was expected to be in the error console.");
+ }
+ }
+ }
+
+ /** Tests a candidate to see if it is one of the expected messages and updates the
+ g_errorInfo structure if it is. */
+ function doRollCall(msg)
+ {
+ for (var i = 0; i < g_errorTypes.length; i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ if (msg == getErrorMessage(g_errorTypes[i], j))
+ {
+ g_errorInfo[g_errorTypes[i]].status[j] = true;
+ }
+ }
+ }
+ }
+
+ SpecialPowers.registerConsoleListener(
+ function (msg) {
+ if (msg.message == "SENTINEL") {
+ processRollCall();
+ SimpleTest.finish();
+ } else if (msg.isScriptError) {
+ doRollCall(msg.errorMessage);
+ }
+ });
+
+ SimpleTest.waitForExplicitFinish();
+ </script>
+ </head>
+ <body onload="SpecialPowers.postConsoleSentinel();">
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553917">Mozilla Bug 553917</a>
+ <!-- ChildCountIncorrect -->
+ <math><mroot></mroot></math>
+ <math><msub></msub></math>
+ <math><msup></msup></math>
+ <math><mfrac></mfrac></math>
+ <math><msubsup></msubsup></math>
+ <math><munderover></munderover></math>
+
+ <!-- AttributeParsingError -->
+ <math><mpadded width="BAD!"></mpadded></math>
+ <math><mpadded height="BAD!"></mpadded></math>
+ <math><mpadded voffset="BAD!"></mpadded></math>
+
+ <!-- AttributeParsingErrorNoTag -->
+ <math scriptlevel="BAD!"></math>
+ <math scriptsizemultiplier="BAD!"></math>
+
+ <!-- LengthParsingError -->
+ <math><mo rspace="2..0px">+</mo></math>
+ <math><mo minsize="1.5notaunit">+</mo></math>
+ <math><mspace width="2"/></math>
+ <math><mo lspace="BADlspace">+</mo></math>
+ <math><mspace height="BADheight"/></math>
+ <math><mspace depth="BADdepth"/></math>
+ <math><mfrac linethickness="thin"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="medium"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="thick"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mstyle mathsize="small"></mstyle></math>
+ <math><mstyle mathsize="normal"></mstyle></math>
+ <math><mstyle mathsize="big"></mstyle></math>
+ <math><mspace width="veryverythinmathspace"/></math>
+ <math><mspace width="verythinmathspace"/></math>
+ <math><mspace width="thinmathspace"/></math>
+ <math><mspace width="mediummathspace"/></math>
+ <math><mspace width="thickmathspace"/></math>
+ <math><mspace width="verythickmathspace"/></math>
+ <math><mspace width="veryverythickmathspace"/></math>
+ <math><mspace width="12345."/></math>
+ <math><mo minsize="17">+</mo></math>
+
+ <!-- MMultiscriptsErrors -->
+ <math><mmultiscripts></mmultiscripts></math>
+ <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
+ <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>
+ </body>
+</html>
diff --git a/layout/mathml/tests/test_bug706406.html b/layout/mathml/tests/test_bug706406.html
new file mode 100644
index 0000000000..72e7872844
--- /dev/null
+++ b/layout/mathml/tests/test_bug706406.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=706406">Mozilla Bug 706406</a>
+<iframe></iframe>
+<pre id="test">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ SpecialPowers.pushPrefEnv({"set": [["mathml.legacy_maction_and_semantics_implementations.disabled", false]]}, function() {
+ document.querySelector('iframe').src = "file_bug706406_iframe.html";
+ });
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/mathml/tests/test_bug827713-2.html b/layout/mathml/tests/test_bug827713-2.html
new file mode 100644
index 0000000000..8143bc0493
--- /dev/null
+++ b/layout/mathml/tests/test_bug827713-2.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=553917
+-->
+<html>
+ <head>
+ <title>Test for error handling aspect of Bug 827713</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 type="application/javascript">
+
+ var stringBundleService =
+ SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(SpecialPowers.Ci.nsIStringBundleService);
+ var g_bundl =
+ stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
+
+ var g_errorInfo = {
+ InvalidChild: {
+ status : [false, false, false],
+ args : [["mprescripts", "msubsup"], ["mprescripts", "msubsup"],
+ ["mprescripts", "msub"]]
+ },
+
+ MMultiscriptsErrors: {
+ status: [false, false],
+ args: ["NoBase", "SubSupMismatch"]
+ }
+ };
+
+ var g_errorTypes = ["InvalidChild", "MMultiscriptsErrors"];
+
+ function getErrorMessage(name,idx)
+ {
+ if (name != "MMultiscriptsErrors") {
+ return g_bundl.formatStringFromName(name,g_errorInfo[name].args[idx]);
+ }
+ return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
+ }
+
+ /** Checks the roll call to see if all expected error messages were present. */
+ function processRollCall()
+ {
+ for (var i=0; i<g_errorTypes.length;i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ ok(g_errorInfo[g_errorTypes[i]].status[j],
+ "\"" + getErrorMessage(g_errorTypes[i], j)
+ + "\" was expected to be in the error console.");
+ }
+ }
+ }
+
+ /** Tests a candidate to see if it is one of the expected messages and updates the
+ g_errorInfo structure if it is. */
+ function doRollCall(msg)
+ {
+ for (var i = 0; i < g_errorTypes.length; i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ if (msg == getErrorMessage(g_errorTypes[i], j))
+ {
+ g_errorInfo[g_errorTypes[i]].status[j] = true;
+ }
+ }
+ }
+ }
+
+ SpecialPowers.registerConsoleListener(
+ function (msg) {
+ if (msg.message == "SENTINEL") {
+ processRollCall();
+ SimpleTest.finish();
+ } else if (msg.isScriptError) {
+ doRollCall(msg.errorMessage);
+ }
+ });
+
+ SimpleTest.waitForExplicitFinish();
+ </script>
+ </head>
+ <body onload="SpecialPowers.postConsoleSentinel();">
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827713">Mozilla Bug 827713</a>
+
+ <!-- InvalidChild -->
+ <math>
+ <msubsup>
+ <mprescripts/>
+ </msubsup>
+ </math>
+
+ <math>
+ <msubsup>
+ <mprescripts/>
+ <mprescripts/>
+ </msubsup>
+ </math>
+
+ <math>
+ <msub>
+ <mtext>a</mtext>
+ <mprescripts/>
+ <mtext>a</mtext>
+ <mprescripts/>
+ </msub>
+ </math>
+
+ <!-- NoBase -->
+ <math>
+ <mmultiscripts>
+ </mmultiscripts>
+ </math>
+
+ <!-- SubSupMismatch -->
+ <math>
+ <mmultiscripts>
+ <mtext>b</mtext>
+ <mtext>c</mtext>
+ <mprescripts/>
+ <mtext>a</mtext>
+ </mmultiscripts>
+ </math>
+ </body>
+</html>
diff --git a/layout/mathml/tests/test_disabled.html b/layout/mathml/tests/test_disabled.html
new file mode 100644
index 0000000000..f0c62ec994
--- /dev/null
+++ b/layout/mathml/tests/test_disabled.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Copied from https://bugzilla.mozilla.org/show_bug.cgi?id=744830
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
+<iframe></iframe>
+<pre id="test">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ SpecialPowers.pushPrefEnv({"set": [["mathml.disabled", true]]}, function() {
+ document.querySelector('iframe').src = "file_disabled_iframe.html";
+ });
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/layout/mathml/tests/test_disabled_chrome.html b/layout/mathml/tests/test_disabled_chrome.html
new file mode 100644
index 0000000000..af97f2d430
--- /dev/null
+++ b/layout/mathml/tests/test_disabled_chrome.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=744830
+-->
+<head>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<!--
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+-->
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
+<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
+<pre id="test">
+<script type="application/javascript">
+ add_task(async function() {
+ const initialPrefValue = SpecialPowers.getBoolPref("mathml.disabled");
+ SpecialPowers.setBoolPref("mathml.disabled", true);
+ const Cu = SpecialPowers.Components.utils;
+ const { ContentTaskUtils } = ChromeUtils.import("resource://testing-common/ContentTaskUtils.jsm");
+ let t = document.getElementById('testnodes');
+
+ let url = 'chrome://mochitests/content/chrome/layout/mathml/tests/mathml_example_test.html'
+ const chromeIframeEl = document.createElement('iframe');
+ let chromeLoadPromise = ContentTaskUtils.waitForEvent(chromeIframeEl, 'load', false);
+ chromeIframeEl.src = url;
+ t.appendChild(chromeIframeEl);
+
+ await chromeLoadPromise;
+ const chromeBR = chromeIframeEl.contentDocument.body.getBoundingClientRect();
+
+ url = "http://mochi.test:8888/chrome/layout/mathml/tests/mathml_example_test.html";
+ const iframeEl = document.createElement('iframe');
+ iframeEl.src = url;
+ let loadPromise = ContentTaskUtils.waitForEvent(iframeEl, 'load', false);
+ t.appendChild(iframeEl);
+ await loadPromise;
+
+ const contentBR = iframeEl.contentDocument.body.getBoundingClientRect();
+
+ ok(chromeBR.height > contentBR.height, "Chrome content height should be bigger than content due to layout");
+
+ SpecialPowers.setBoolPref("mathml.disabled", initialPrefValue);
+ });
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/layout/mathml/tests/test_opentype-axis-height.html b/layout/mathml/tests/test_opentype-axis-height.html
new file mode 100644
index 0000000000..f65e276253
--- /dev/null
+++ b/layout/mathml/tests/test_opentype-axis-height.html
@@ -0,0 +1,58 @@
+<!doctype html>
+<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"/>
+ <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);
+ }
+ @font-face {
+ font-family: axis-height-2;
+ src: url(/tests/fonts/math/axis-height-2.otf);
+ }
+ </style>
+ <script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ 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();
+ }
+ </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;">
+ <mo id="plus1">+</mo>
+ </math>
+ <math style="font-family: axis-height-2;">
+ <mo id="plus2">+</mo>
+ </math>
+ </p>
+
+ </body>
+</html>
diff --git a/layout/mathml/tests/test_opentype-limits.html b/layout/mathml/tests/test_opentype-limits.html
new file mode 100644
index 0000000000..56d30fd738
--- /dev/null
+++ b/layout/mathml/tests/test_opentype-limits.html
@@ -0,0 +1,68 @@
+<!doctype html>
+<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"/>
+ <meta charset="utf-8"/>
+ <style type="text/css">
+ math {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: limits-5;
+ src: url(/tests/fonts/math/limits-5.otf);
+ }
+ </style>
+ <script type="text/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ 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();
+ }
+ </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"/>
+ </math>
+ <math style="font-family: limits-5;" displaystyle="true">
+ <mover>
+ <mspace id="base9" height="2em" width="2em" mathbackground="blue"/>
+ <mo id="over9" stretchy="false">~</mo>
+ </mover>
+ </math>
+ <math style="font-family: limits-5;" displaystyle="true">
+ <munderover>
+ <mspace id="base10" height="2em" width="2em" mathbackground="blue"/>
+ <mspace id="under10" height="1em" width="1em" mathbackground="red"/>
+ <mo id="over10" stretchy="false">~</mo>
+ </munderover>
+ </math>
+ </p>
+
+ </body>
+</html>