mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1567435 [wpt PR 17932] - Convert frac-linethickness-002 to testharness and extend it, a=testonly
Automatic update from web-platform-tests Convert frac-linethickness-002 to testharness and extend it (#17932) This makes the test a bit more robust by accepting rounding errors. It also checks a positive length value. -- wpt-commits: 6340a70e8df5e850ea44436b54105f59dd5aa22e wpt-pr: 17932
This commit is contained in:
parent
6dc8ee4e15
commit
d42c070040
@ -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>
|
||||
<mfrac>
|
||||
<mspace width="20px" height="70px" style="background: blue"></mspace>
|
||||
<mspace width="20px" height="10px" style="background: cyan"></mspace>
|
||||
</mfrac>
|
||||
</math>
|
||||
</body>
|
||||
</html>
|
@ -4,39 +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>
|
||||
<!-- Namedspace values are invalid in MathML Core. -->
|
||||
<mfrac linethickness="veryverythickmathspace">
|
||||
<mspace width="20px" height="70px" style="background: blue"></mspace>
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user