Update web-platform-tests to revision 6340a70e8df5e850ea44436b54105f59dd5aa22e

This commit is contained in:
WPT Sync Bot 2019-07-19 10:25:00 +00:00
parent 5788e8c050
commit 7be3e2f06b
131 changed files with 3893 additions and 1852 deletions

View file

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>fractions linethickness</title>
<style type="text/css">
@font-face {
font-family: TestFont;
src: url("/fonts/math/fraction-rulethickness10000.woff");
}
math {
/* FractionRuleThickness = 10000 * 1 / 1000 = 10px; */
font-family: "TestFont";
font-size: 1px;
}
</style>
</head>
<body>
<p>This test passes if you see fraction with a cyan denominator and
a blue numerator as tall as its black bar.</p>
<math>
<mfrac linethickness="0px">
<mspace width="20px" height="0px" style="background: blue"></mspace>
<mspace width="20px" height="10px" style="background: cyan"></mspace>
</mfrac>
</math>
<math>
<mfrac linethickness="50px">
<mspace width="20px" height="50px" style="background: blue"></mspace>
<mspace width="20px" height="10px" style="background: cyan"></mspace>
</mfrac>
</math>
<math style="font-size: 180px">
<mfrac linethickness="0.3888888888888889em">
<mspace width="20px" height="70px" style="background: blue"></mspace>
<mspace width="20px" height="10px" style="background: cyan"></mspace>
</mfrac>
</math>
</body>
</html>

View file

@ -4,38 +4,82 @@
<meta charset="utf-8">
<title>fractions linethickness</title>
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#fractions-mfrac">
<meta name="assert" content="Verifies fraction with negative, percent and named space linethickness values.">
<link rel="match" href="frac-linethickness-002-ref.html">
<meta name="assert" content="Verifies fraction with positive, negative, percent and named space linethickness values.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style type="text/css">
@font-face {
font-family: TestFont;
src: url("/fonts/math/fraction-rulethickness10000.woff");
}
math {
/* FractionRuleThickness = 10000 * 1 / 1000 = 10px; */
/* FractionRuleThickness = 10000 * 10 / 1000 = 100px; */
font-family: "TestFont";
font-size: 1px;
font-size: 10px;
}
</style>
<script>
function LineThickness(aId) {
var mfrac = document.getElementById(aId);
var numBox = mfrac.firstElementChild.getBoundingClientRect();
var denumBox = mfrac.lastElementChild.getBoundingClientRect();
return denumBox.top - numBox.bottom;
}
setup({ explicit_done: true });
window.addEventListener("load", function() {
// Delay the check to workaround WebKit's bug https://webkit.org/b/174030.
requestAnimationFrame(() => { document.fonts.ready.then(runTests); });
});
function runTests() {
var defaultRuleThickness = 100;
var epsilon = 2;
test(function() {
assert_approx_equals(LineThickness("positive"), 5.67 * 10, epsilon);
}, "Positive");
test(function() {
/* Negative values are treated as 0 */
assert_approx_equals(LineThickness("negative"), 0, epsilon);
}, "Negative");
test(function() {
assert_approx_equals(LineThickness("percent"), defaultRuleThickness * 234 / 100, epsilon);
}, "Percentage");
test(function() {
/* Namedspace values are invalid in MathML Core. */
assert_approx_equals(LineThickness("namedspace"), defaultRuleThickness, epsilon);
}, "Named space");
done();
}
</script>
</head>
<body>
<p>This test passes if you see fraction with a cyan denominator and
a blue numerator as tall as its black bar.</p>
<math>
<mfrac linethickness="-1.23em">
<mspace width="20px" height="0px" style="background: blue"></mspace>
<mfrac id="positive" linethickness="5.67em">
<mspace width="20px" height="10px" style="background: blue"></mspace>
<mspace width="20px" height="10px" style="background: cyan"></mspace>
</mfrac>
</math>
<math>
<mfrac linethickness="500%">
<mspace width="20px" height="50px" style="background: blue"></mspace>
<mfrac id="negative" linethickness="-1.23em">
<mspace width="20px" height="10px" style="background: blue"></mspace>
<mspace width="20px" height="10px" style="background: cyan"></mspace>
</mfrac>
</math>
<math style="font-size: 180px">
<mfrac linethickness="veryverythickmathspace">
<mspace width="20px" height="70px" style="background: blue"></mspace>
<math>
<mfrac id="percent" linethickness="234%">
<mspace width="20px" height="10px" style="background: blue"></mspace>
<mspace width="20px" height="10px" style="background: cyan"></mspace>
</mfrac>
</math>
<math>
<mfrac id="namedspace" linethickness="veryverythickmathspace">
<mspace width="20px" height="10px" style="background: blue"></mspace>
<mspace width="20px" height="10px" style="background: cyan"></mspace>
</mfrac>
</math>

View file

@ -39,13 +39,11 @@
assert_equals(getBox("unitEm").width, 120, "em");
assert_equals(getBox("unitEx").width, 500, "ex");
assert_equals(getBox("unitIn").width, 288, "in");
assert_equals(getBox("unitNamed").width, 700, "namedspace");
assert_equals(getBox("unitMm").width, 576, "mm");
assert_equals(getBox("unitPc").width, 96, "pc");
assert_equals(getBox("unitPercentage").width, 60, "%");
assert_equals(getBox("unitPt").width, 96, "pt");
assert_equals(getBox("unitPx").width, 123, "px");
assert_equals(getBox("unitNone").width, 150, "Unitless");
}, "Units");
test(function() {
@ -53,20 +51,17 @@
assert_equals(getBox("spaceEm").width, 120, "em");
assert_equals(getBox("spaceEx").width, 500, "ex");
assert_equals(getBox("spaceIn").width, 288, "in");
assert_equals(getBox("spaceNamed").width, 700, "namedspace");
assert_equals(getBox("spaceMm").width, 576, "mm");
assert_equals(getBox("spacePc").width, 96, "pc");
assert_equals(getBox("spacePercentage").width, 60, "%");
assert_equals(getBox("spacePt").width, 96, "pt");
assert_equals(getBox("spacePx").width, 123, "px");
assert_equals(getBox("spaceNone").width, 150, "Unitless");
}, "Trimming of space");
test(function() {
assert_approx_equals(getBox("n0").width, 0, epsilon, "n0");
assert_approx_equals(getBox("n1").width, 90, epsilon, "n1");
assert_approx_equals(getBox("n2").width, 8, epsilon, "n2");
assert_approx_equals(getBox("n3").width, 70, epsilon, "n3");
assert_approx_equals(getBox("n4").width, 650, epsilon, "n4");
assert_approx_equals(getBox("n5").width, 4320, epsilon, "n5");
assert_approx_equals(getBox("n6").width, 1, epsilon, "n6");
@ -81,7 +76,6 @@
assert_approx_equals(getBox("N0").top - topRef, -0, epsilon, "N0");
assert_approx_equals(topRef - getBox("N1").top, -90, epsilon, "N1");
assert_approx_equals(topRef - getBox("N2").top, -8, epsilon, "N2");
assert_approx_equals(topRef - getBox("N3").top, -70, epsilon, "N3");
assert_approx_equals(topRef - getBox("N4").top, -650, epsilon, "N4");
assert_approx_equals(topRef - getBox("N5").top, -4320, epsilon, "N5");
assert_approx_equals(topRef - getBox("N6").top, -1, epsilon, "N6");
@ -91,6 +85,38 @@
assert_approx_equals(topRef - getBox("N10").top, -123, epsilon, "N10");
}, "Non-positive numbers");
test(function() {
// Namedspace values are invalid in MathML Core.
["veryverythinmathspace",
"verythinmathspace",
"thinmathspace",
"mediummathspace",
"thickmathspace",
"verythickmathspace",
"veryverythickmathspace",
"negativeveryverythinmathspace",
"negativeverythinmathspace",
"negativethinmathspace",
"negativemediummathspace",
"negativethickmathspace",
"negativeverythickmathspace",
"negativeveryverythickmathspace"
].forEach(function(space) {
var mrow = document.getElementById(space);
var boxBefore = mrow.firstElementChild.getBoundingClientRect();
var boxAfter = mrow.lastElementChild.getBoundingClientRect();
assert_equals(boxAfter.left - boxBefore.right, 0, space);
});
}, "Legacy namedspaces");
test(function() {
// These values are invalid in MathML Core.
assert_equals(getBox("unitNone").width, 30, "Unitless");
assert_approx_equals(getBox("n3").width, 0, epsilon, "n3");
var topRef = getBox("ref").top;
assert_approx_equals(topRef - getBox("N3").top, 0, epsilon, "N3");
}, "Legacy numbers");
done();
}
</script>
@ -103,7 +129,6 @@
<mspace id="unitEm" width="12em"/>
<mspace id="unitEx" width="100ex"/>
<mspace id="unitIn" width="3in"/>
<mspace style="font-size: 1800px" id="unitNamed" width="veryverythickmathspace"/>
<mspace id="unitMm" width="152.4mm"/>
<mspace id="unitPc" width="6pc"/>
<mstyle mathsize="200%"><mspace id="unitPercentage" width="3em"/></mstyle>
@ -118,13 +143,11 @@
<mspace id="spaceEm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;12em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mspace id="spaceEx" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;100ex&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mspace id="spaceIn" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3in&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mspace style="font-size: 1800px" id="spaceNamed" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;veryverythickmathspace&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mspace id="spaceMm" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;152.4mm&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mspace id="spacePc" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;6pc&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mstyle mathsize="200%"><mspace id="spacePercentage" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/></mstyle>
<mspace id="spacePt" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;72pt&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mspace id="spacePx" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;123px&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/>
<mstyle mathsize="5"><mspace id="spaceNone" width="&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;3em&#x20;&#x9;&#xA;&#xD;&#x20;&#x9;&#xA;&#xD;"/></mstyle>
</math>
</p>
<p>
@ -158,5 +181,81 @@
<mpadded voffset="-012.345em"><mspace id="N10"/></mpadded>
</math>
</p>
<p>
<math>
<mrow id="veryverythinmathspace">
<mspace width="1em"/>
<mspace width="veryverythinmathspace"/>
<mspace/>
</mrow>
<mrow id="verythinmathspace">
<mspace width="1em"/>
<mspace width="verythinmathspace"/>
<mspace/>
</mrow>
<mrow id="thinmathspace">
<mspace width="1em"/>
<mspace width="thinmathspace"/>
<mspace/>
</mrow>
<mrow id="mediummathspace">
<mspace width="1em"/>
<mspace width="mediummathspace"/>
<mspace/>
</mrow>
<mrow id="thickmathspace">
<mspace width="1em"/>
<mspace width="thickmathspace"/>
<mspace/>
</mrow>
<mrow id="verythickmathspace">
<mspace width="1em"/>
<mspace width="verythickmathspace"/>
<mspace/>
</mrow>
<mrow id="veryverythickmathspace">
<mspace width="1em"/>
<mspace width="veryverythickmathspace"/>
<mspace/>
</mrow>
</math>
<math>
<mrow id="negativeveryverythinmathspace">
<mspace width="1em"/>
<mspace width="veryverythinmathspace"/>
<mspace/>
</mrow>
<mrow id="negativeverythinmathspace">
<mspace width="1em"/>
<mspace width="verythinmathspace"/>
<mspace/>
</mrow>
<mrow id="negativethinmathspace">
<mspace width="1em"/>
<mspace width="thinmathspace"/>
<mspace/>
</mrow>
<mrow id="negativemediummathspace">
<mspace width="1em"/>
<mspace width="mediummathspace"/>
<mspace/>
</mrow>
<mrow id="negativethickmathspace">
<mspace width="1em"/>
<mspace width="thickmathspace"/>
<mspace/>
</mrow>
<mrow id="negativeverythickmathspace">
<mspace width="1em"/>
<mspace width="verythickmathspace"/>
<mspace/>
</mrow>
<mrow id="negativeveryverythickmathspace">
<mspace width="1em"/>
<mspace width="veryverythickmathspace"/>
<mspace/>
</mrow>
</math>
</p>
</body>
</html>