Bug 1610245 [wpt PR 21257] - Add tests for baseline, stretchiness and spacing in unknown elements., a=testonly

Automatic update from web-platform-tests
Add tests for baseline, stretchiness and spacing in unknown elements. (#21257)

See https://github.com/mathml-refresh/mathml/issues/139

This also fixes wrong mpadded@notation attribute and repeats spacing tests
for other mrow-like elements.
--

wpt-commits: 87646d626a9a84941e790da383f140df6b37279d
wpt-pr: 21257
This commit is contained in:
Frédéric Wang 2020-01-21 10:54:32 +00:00 коммит произвёл moz-wptsync-bot
Родитель 66ff0b0d5f
Коммит b7b7673144
3 изменённых файлов: 58 добавлений и 4 удалений

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

@ -20,7 +20,7 @@
window.addEventListener("load", runTests);
function runTests()
{
["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded"].forEach((tag) => {
["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded", "Unknown"].forEach((tag) => {
var x = document.getElementById("above" + tag).getBoundingClientRect();
var y = document.getElementById("below" + tag).getBoundingClientRect();
test(function() {
@ -43,8 +43,10 @@
<math><mspace id="aboveMath" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMath" width="10px" depth="30px" style="background: blue"></mspace></math>
<math><menclose notation="box"><mspace id="aboveMenclose" width="10px" height="30px" style="background: purple"
></mspace><mspace id="belowMenclose" width="10px" depth="30px" style="background: blue"></mspace></menclose></math>
<math><mpadded notation="box"><mspace id="aboveMpadded" width="10px" height="30px" style="background: purple"
<math><mpadded lspace="10px"><mspace id="aboveMpadded" width="10px" height="30px" style="background: purple"
></mspace><mspace id="belowMpadded" width="10px" depth="30px" style="background: blue"></mspace></mpadded></math>
<math><unknown><mspace id="aboveUnknown" width="10px" height="30px" style="background: purple"
></mspace><mspace id="belowUnknown" width="10px" depth="30px" style="background: blue"></mspace></unknown></math>
</p>
</body>
</html>

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

@ -31,7 +31,7 @@
window.addEventListener("load", () => { document.fonts.ready.then(runTests); });
function runTests()
{
["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded"].forEach((tag) => {
["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded", "Unknown"].forEach((tag) => {
var mo = document.getElementById("mo" + tag);
test(function() {
assert_true(MathMLFeatureDetection.has_mspace());
@ -52,7 +52,8 @@
<math><mphantom><mo style="visibilty: visible;" id="moPhantom">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mphantom></math>
<math><mo id="moMath">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></math>
<math><menclose notation="box"><mo id="moMenclose">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></menclose></math>
<math><mpadded notation="box"><mo id="moMpadded">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mpadded></math>
<math><mpadded lspace="10px"><mo id="moMpadded">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mpadded></math>
<math><unknown><mo id="moUnknown">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></unknown></math>
</p>
</body>
</html>

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

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Spacing in mrows</title>
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#horizontally-group-sub-expressions-mrow">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#radicals-msqrt-mroot">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#style-change-mstyle">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#error-message-merror">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#making-sub-expressions-invisible-mphantom">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-top-level-math-element">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#enclose-expression-inside-notation-menclose">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#adjust-space-around-content-mpadded">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
<meta name="assert" content="Spacing is added around operators inside mrow-like elements.">
<script src="/mathml/support/feature-detection.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
setup({ explicit_done: true });
window.addEventListener("load", () => { document.fonts.ready.then(runTests); });
function runTests()
{
["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded", "Unknown"].forEach((tag) => {
test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
var mrow = document.getElementById(tag);
var mn1 = mrow.firstElementChild.getBoundingClientRect();
var mn2 = mrow.lastElementChild.getBoundingClientRect();
assert_greater_than_equal(mn2.left - mn1.right, 50);
}, `operator spacing inside ${tag}`);
});
done();
}
</script>
</head>
<body>
<div id="log"></div>
<p>
<math><mrow id="Mrow"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mrow></math>
<math><msqrt id="Sqrt"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></msqrt></math>
<math><mstyle id="Style"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mstyle></math>
<math><merror id="Error"><mn>1</mn><mo lspace="50px"></mo><mn>2</mn></merror></math>
<math><mphantom id="Phantom"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mphantom></math>
<math id="Math"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></math>
<math><menclose id="Menclose" notation="box"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></menclose></math>
<math><mpadded id="Mpadded" lspace="10px"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></mpadded></math>
<math><unknown id="Unknown"><mn>1</mn><mo lspace="50px">|</mo><mn>2</mn></unknown></math>
</p>
</body>
</html>