зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1847201 - Reorganize and tweak tests for mathml.disabled=true. r=emilio
After bug 1847177, the only remaining tests in layout/mathml/tests are for testing the effect of mathml.disabled=true. test_disabled.html is a plain mochitest, rename it dynamic-math-tree-001.html and move it into testing/web-platform/mozilla/tests/mathml/disabled. The iframe added in bug 1470163 is no longer necessary since the preference is enabled in the __dir__ini manifest. test_disabled_chrome.html is a chrome mochitest checking that MathML is still laid out in Chrome document when mathml.disabled is true. It is a bit complex and non-obvious so try to rewrite it in a more straightforward way. Also use test_disabled_chrome_iframe.html as a file name for the the iframe content to make clear it's associated to this test. Probably this test could be rewritten as a browser mochitest (see bug 1847206). math-parse01.html is copied from the the upstream WPT repo but runs with mathml.disabled=true. Move it into the same directory as other WPT tests testing support when MathML is disabled. Finally, also enable linting for layout/mathml/tests. Differential Revision: https://phabricator.services.mozilla.com/D185426
This commit is contained in:
Родитель
af4d15c34d
Коммит
3ca3383228
|
@ -359,7 +359,6 @@ const extraMochitestTestPaths = [
|
|||
"layout/forms/test/",
|
||||
"layout/generic/test/",
|
||||
"layout/inspector/tests/",
|
||||
"layout/mathml/tests/",
|
||||
"layout/style/test/",
|
||||
"layout/svg/tests/",
|
||||
"layout/tables/test/",
|
||||
|
@ -430,7 +429,6 @@ let expectedDupePaths = new Set([
|
|||
"layout/base/tests/",
|
||||
"layout/forms/test/",
|
||||
"layout/generic/test/",
|
||||
"layout/mathml/tests/",
|
||||
"layout/style/test/",
|
||||
"layout/svg/tests/",
|
||||
"layout/xul/test/",
|
||||
|
|
|
@ -8,9 +8,6 @@ with Files("**"):
|
|||
BUG_COMPONENT = ("Core", "MathML")
|
||||
|
||||
if CONFIG["ENABLE_TESTS"]:
|
||||
MOCHITEST_MANIFESTS += [
|
||||
"tests/mochitest.ini",
|
||||
]
|
||||
MOCHITEST_CHROME_MANIFESTS += [
|
||||
"tests/chrome.ini",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
[DEFAULT]
|
||||
|
||||
support-files =
|
||||
mathml_example_test.html
|
||||
test_disabled_chrome_iframe.html
|
||||
prefs=
|
||||
mathml.disabled=true
|
||||
|
||||
[test_disabled_chrome.html]
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<!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><foo></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&2<3>4 \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&2<3>4 \u003C/style></math>');
|
||||
|
||||
SimpleTest.finish();
|
||||
</script>
|
||||
</pre>
|
|
@ -1,28 +0,0 @@
|
|||
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mstyle>
|
||||
<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>
|
|
@ -1,5 +0,0 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
file_disabled_iframe.html
|
||||
|
||||
[test_disabled.html]
|
|
@ -1,23 +0,0 @@
|
|||
<!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>
|
||||
|
|
@ -1,53 +1,34 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=744830
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1173199
|
||||
-->
|
||||
<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>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1173199">Mozilla Bug 1173199</a>
|
||||
<div id="testnodes"></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.importESModule(
|
||||
"resource://testing-common/ContentTaskUtils.sys.mjs"
|
||||
);
|
||||
let t = document.getElementById('testnodes');
|
||||
|
||||
let url = 'chrome://mochitests/content/chrome/layout/mathml/tests/mathml_example_test.html'
|
||||
const url = 'chrome://mochitests/content/chrome/layout/mathml/tests/test_disabled_chrome_iframe.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);
|
||||
const mspaceBox = chromeIframeEl.contentDocument.body.querySelector("mspace").getBoundingClientRect();
|
||||
ok(mspaceBox.width > 50, "MathML is laid out in Chrome documents even when the mathml.disabled preference is true.");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<math>
|
||||
<mspace style="background: green" height="100px" width="100px"></mspace>
|
||||
</math>
|
|
@ -1,3 +0,0 @@
|
|||
[math-parse01.html]
|
||||
type: testharness
|
||||
prefs: [mathml.disabled:true]
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1173199
|
||||
-->
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
|
||||
<script type="application/javascript">
|
||||
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
||||
let t = document.getElementById('testnodes');
|
||||
|
||||
test(function() {
|
||||
t.innerHTML = null;
|
||||
t.appendChild(document.createElementNS(mathmlNS, "math:math"));
|
||||
assert_equals(t.firstChild.namespaceURI, mathmlNS);
|
||||
t.firstChild.textContent = "<foo>";
|
||||
assert_equals(t.innerHTML, "<math:math><foo></math:math>");
|
||||
}, "Writing '<foo>' element in a dynamically created MathML element.");
|
||||
|
||||
test(function() {
|
||||
t.innerHTML = null;
|
||||
t.appendChild(document.createElementNS(mathmlNS, "math"));
|
||||
assert_equals(t.firstChild.namespaceURI, mathmlNS);
|
||||
t.firstChild.appendChild(document.createElementNS(mathmlNS, "script"));
|
||||
assert_equals(t.firstChild.firstChild.namespaceURI, mathmlNS);
|
||||
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
|
||||
assert_equals(t.innerHTML,
|
||||
'<math><script>1&2<3>4 \u003C/script></math>');
|
||||
}, "Writing '<script>' element in a dynamically created MathML element.");
|
||||
|
||||
test(function() {
|
||||
t.innerHTML = null;
|
||||
t.appendChild(document.createElementNS(mathmlNS, "math"));
|
||||
assert_equals(t.firstChild.namespaceURI, mathmlNS);
|
||||
t.firstChild.appendChild(document.createElementNS(mathmlNS, "style"));
|
||||
assert_equals(t.firstChild.firstChild.namespaceURI, mathmlNS);
|
||||
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
|
||||
assert_equals(t.innerHTML,
|
||||
'<math><style>1&2<3>4 \u003C/style></math>');
|
||||
}, "Writing '<style>' element in a dynamically created MathML element.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -85,7 +85,6 @@ file-whitespace:
|
|||
- layout/generic/crashtests
|
||||
- layout/generic/test
|
||||
- layout/inspector/tests
|
||||
- layout/mathml/tests
|
||||
- layout/painting/crashtests/1405881-1.html
|
||||
- layout/painting/crashtests/1407470-1.html
|
||||
- layout/reftests
|
||||
|
|
Загрузка…
Ссылка в новой задаче