mirror of
https://github.com/servo/servo.git
synced 2025-08-29 17:18:23 +01:00
Update web-platform-tests to revision bc60e6f82132cfc9a5b688c566c7772024b3c15c
This commit is contained in:
parent
449881f566
commit
29156ca9e2
223 changed files with 7517 additions and 2093 deletions
|
@ -62,5 +62,7 @@
|
|||
</math>
|
||||
</p>
|
||||
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mspace");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -6,15 +6,11 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Test dir="rtl" on MathML token elements. The text contains RTL and
|
||||
LTR characters, so the attribute is needed to specify the actual
|
||||
direction. -->
|
||||
|
||||
<p><math><mtext dir="rtl">חוק \left חסר או חוק \right מיותר</mtext></math></p>
|
||||
<p><math><ms dir="rtl">חוק \left חסר או חוק \right מיותר</ms></math></p>
|
||||
<p><math><mo dir="rtl">חוק \left חסר או חוק \right מיותר</mo></math></p>
|
||||
<p><math><mi dir="rtl">חוק \left חסר או חוק \right מיותר</mi></math></p>
|
||||
<p><math><mn dir="rtl">חוק \left חסר או חוק \right מיותר</mn></math></p>
|
||||
<p><math><mtext style="direction: rtl;">חוק \left חסר או חוק \right מיותר</mtext></math></p>
|
||||
<p><math><ms style="direction: rtl;">חוק \left חסר או חוק \right מיותר</ms></math></p>
|
||||
<p><math><mo style="direction: rtl;">חוק \left חסר או חוק \right מיותר</mo></math></p>
|
||||
<p><math><mi style="direction: rtl;">חוק \left חסר או חוק \right מיותר</mi></math></p>
|
||||
<p><math><mn style="direction: rtl;">חוק \left חסר או חוק \right מיותר</mn></math></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -21,5 +21,8 @@
|
|||
<p><math><mi dir="rtl">חוק \left חסר או חוק \right מיותר</mi></math></p>
|
||||
<p><math><mn dir="rtl">חוק \left חסר או חוק \right מיותר</mn></math></p>
|
||||
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_dir");</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Verify fraction metrics for different sizes of numerator and denominator.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -33,6 +34,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3;
|
||||
var mathAxis = getBox("axis").middle;
|
||||
// For stacks, nothing in the OpenType MATH specification seems to ensure
|
||||
|
@ -51,6 +54,8 @@
|
|||
}, "Fraction axis is aligned on the math axis");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
assert_less_than(getBox("frac" + i + "num").bottom, getBox("frac" + i + "den").top, "numerator is above denominator");
|
||||
assert_less_than(getBox("frac" + i + "den").top - getBox("frac" + i + "num").bottom, 5, "The gap between numerator and denominator is not too large");
|
||||
|
@ -58,12 +63,16 @@
|
|||
}, "Vertical positions of numerator and denominator");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3;
|
||||
for (var i = 0; i < 10; i++)
|
||||
assert_approx_equals(getBox("frac" + i + "num").center, getBox("frac" + i + "den").center, e, "numerator and denominator are horizontally centered");
|
||||
}, "Horizontal alignments of numerator and denominator");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 5;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var frac = getBox("frac" + i);
|
||||
|
|
|
@ -51,5 +51,7 @@
|
|||
</mfrac>
|
||||
</math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -28,5 +28,7 @@
|
|||
</mfrac>
|
||||
</math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<p>This test passes if it renders the same as an invalid fraction with 3 children.</p>
|
||||
<math>
|
||||
<math></math>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -30,5 +30,7 @@
|
|||
<mn id="mn2">2</mn>
|
||||
</mfrac>
|
||||
</math>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<p>This test passes if you see a fraction.</p>
|
||||
<math>
|
||||
<math></math>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -41,5 +41,7 @@
|
|||
<mspace width="20px" height="10px" style="background: cyan"></mspace>
|
||||
</mfrac>
|
||||
</math>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<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>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: TestFont;
|
||||
|
@ -37,19 +38,23 @@
|
|||
var epsilon = 2;
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_approx_equals(LineThickness("positive"), 5.67 * 10, epsilon);
|
||||
}, "Positive");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
/* Negative values are treated as 0 */
|
||||
assert_approx_equals(LineThickness("negative"), 0, epsilon);
|
||||
}, "Negative");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_approx_equals(LineThickness("percent"), defaultRuleThickness * 234 / 100, epsilon);
|
||||
}, "Percentage");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
/* Namedspace values are invalid in MathML Core. */
|
||||
assert_approx_equals(LineThickness("namedspace"), defaultRuleThickness, epsilon);
|
||||
}, "Named space");
|
||||
|
|
|
@ -26,5 +26,7 @@
|
|||
<mspace width="20px" height="10px" style="background: cyan"></mspace>
|
||||
</mfrac>
|
||||
</math>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -22,5 +22,7 @@
|
|||
</mrow>
|
||||
</mfrac>
|
||||
</math>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -52,5 +52,7 @@
|
|||
</mfrac>
|
||||
</math>
|
||||
</p>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Element mfrac correctly uses the fraction parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -68,6 +69,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 7000 * emToPx;
|
||||
var v2 = 1000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom,
|
||||
|
@ -75,54 +78,72 @@
|
|||
}, "AxisHeight");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 5000 * emToPx;
|
||||
assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom,
|
||||
v1, epsilon, "mfrac: denominator gap");
|
||||
}, "DenominatorDisplayStyleGapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 6000 * emToPx;
|
||||
assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom,
|
||||
v1, epsilon, "mfrac: denominator shift");
|
||||
}, "DenominatorDisplayStyleShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 4000 * emToPx;
|
||||
assert_approx_equals(getBox("den0004").top - getBox("ref0004").bottom,
|
||||
v1, epsilon, "mfrac: denominator gap");
|
||||
}, "DenominatorGapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("den0005").top - getBox("ref0005").bottom,
|
||||
v1, epsilon, "mfrac: denominator shift");
|
||||
}, "DenominatorShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 8000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom,
|
||||
v1, epsilon, "mfrac: numerator gap");
|
||||
}, "NumeratorDisplayStyleGapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 2000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom,
|
||||
v1, epsilon, "mfrac: numerator shift");
|
||||
}, "NumeratorDisplayStyleShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 9000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0008").top - getBox("num0008").bottom,
|
||||
v1, epsilon, "mfrac: numerator gap");
|
||||
}, "NumeratorGapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 11000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0009").top - getBox("num0009").bottom,
|
||||
v1, epsilon, "mfrac: numerator shift");
|
||||
}, "NumeratorShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 10000 * emToPx;
|
||||
assert_approx_equals(getBox("den0010").top - getBox("num0010").bottom,
|
||||
v1, epsilon, "mfrac: rule thickness");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Element mfrac correctly uses the stack parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -56,42 +57,56 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 7000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom,
|
||||
v, epsilon, "mfrac: axis height");
|
||||
}, "AxisHeight");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 5000 * emToPx;
|
||||
assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom,
|
||||
v, epsilon, "mfrac: denominator shift");
|
||||
}, "BottomDisplayStyleShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 6000 * emToPx;
|
||||
assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom,
|
||||
v, epsilon, "mfrac: denominator shift");
|
||||
}, "BottomShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 4000 * emToPx;
|
||||
assert_approx_equals(getBox("den0004").top - getBox("num0004").bottom,
|
||||
v, epsilon, "mfrac: gap");
|
||||
}, "DisplayStyleGapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 8000 * emToPx;
|
||||
assert_approx_equals(getBox("den0005").top - getBox("num0005").bottom,
|
||||
v, epsilon, "mfrac: gap");
|
||||
}, "GapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom,
|
||||
v, epsilon, "mfrac: numerator shift");
|
||||
}, "TopDisplayStyleShiftUp");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 9000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom,
|
||||
v, epsilon, "mfrac: numerator shift");
|
||||
|
|
|
@ -86,5 +86,7 @@
|
|||
</math>
|
||||
</p>
|
||||
<div id="frame"></div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -86,5 +86,7 @@
|
|||
</math>
|
||||
</p>
|
||||
<div id="frame"></div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -86,5 +86,7 @@
|
|||
</math>
|
||||
</p>
|
||||
<div id="frame"></div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -86,5 +86,7 @@
|
|||
</math>
|
||||
</p>
|
||||
<div id="frame"></div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -86,5 +86,7 @@
|
|||
</math>
|
||||
</p>
|
||||
<div id="frame"></div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -86,5 +86,7 @@
|
|||
</math>
|
||||
</p>
|
||||
<div id="frame"></div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -18,5 +18,7 @@
|
|||
</mfrac>
|
||||
</math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<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">
|
||||
<meta name="assert" content="Baseline for mrow-like elements is correct.">
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
@ -23,6 +24,7 @@
|
|||
var x = document.getElementById("above" + tag).getBoundingClientRect();
|
||||
var y = document.getElementById("below" + tag).getBoundingClientRect();
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_equals(x.bottom, y.top);
|
||||
}, "baseline alignment inside " + tag);
|
||||
});
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<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="Operators can stretch inside mrow-like elements.">
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
|
@ -36,6 +37,7 @@
|
|||
["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded"].forEach((tag) => {
|
||||
var mo = document.getElementById("mo" + tag);
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_greater_than_equal(mo.getBoundingClientRect().height, 100);
|
||||
}, "operator stretching inside " + tag);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Embellished operators</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#embellished-operators">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of embellished operators">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
.testedElement mo {
|
||||
color: yellow !important;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBeforeElement(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnBefore = element.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBefore.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceBeforeCoreOperator(id) {
|
||||
var element = document.getElementById(id);
|
||||
var coreMo = element.getElementsByTagName("mo")[0];
|
||||
return coreMo.getBoundingClientRect().left - element.getBoundingClientRect().left;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
["mrow", "mstyle", "mphantom", "mpadded"].forEach(tag => {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBeforeElement(`${tag}-op`), 2 * emToPx, epsilon);
|
||||
assert_approx_equals(spaceBeforeCoreOperator(`${tag}-op`), 0, epsilon);
|
||||
}, `${tag} (embellished operator)`);
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBeforeElement(`${tag}-nonop`), 0, epsilon);
|
||||
assert_approx_equals(spaceBeforeCoreOperator(`${tag}-nonop`), 2 * emToPx, epsilon);
|
||||
}, `${tag} (not embellished operator)`);
|
||||
});
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow id="mrow-op" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mtext class="space-like">X</mtext>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow id="mrow-nonop" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn> <!-- "mn" is not space-like -->
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<!-- mstyle is an embellished operator if its children consist
|
||||
of one embellished operator and zero or more space-like elements. -->
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mstyle id="mstyle-op" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</mstyle>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mstyle id="mstyle-nonop" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn> <!-- "mn" is not space-like -->
|
||||
</mstyle>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<!-- mphantom is an embellished operator if its children consist
|
||||
of one embellished operator and zero or more space-like elements. -->
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mphantom id="mphantom-op" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</mphantom>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mphantom id="mphantom-nonop" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn> <!-- "mn" is not space-like -->
|
||||
</mphantom>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<!-- mpadded is an embellished operator if its children consist
|
||||
of one embellished operator and zero or more space-like elements. -->
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mpadded id="mpadded-op" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</mpadded>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mpadded id="mpadded-nonop" class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn> <!-- "mn" is not space-like -->
|
||||
</mpadded>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,286 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Embellished operators</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#embellished-operators">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of embellished operators">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mtext.space-like {
|
||||
color: lightblue !important;
|
||||
}
|
||||
.testedElement mo {
|
||||
color: yellow !important;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBeforeElement(element) {
|
||||
var mnBefore = element.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBefore.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
["msub", "msup", "msubsup", "munder", "mover", "munderover",
|
||||
"mmultiscripts", "mfrac", "maction", "semantics"].forEach(tag => {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
var element = document.getElementsByTagName(tag)[0];
|
||||
assert_approx_equals(spaceBeforeElement(element), 2 * emToPx, epsilon);
|
||||
}, `${tag} (embellished operator)`);
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
var element = document.getElementsByTagName(tag)[1];
|
||||
assert_approx_equals(spaceBeforeElement(element), 0, epsilon);
|
||||
}, `${tag} (not embellished operator)`);
|
||||
});
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<!-- <msub>, <msup>, <msubsup>, <munder>, <mover>, <munderover>,
|
||||
<mmultiscripts>, <mfrac>, <semantics> or <maction> are embellished
|
||||
operators if their first child exists and is an embellished operator -->
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<msub class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
</msub>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<msup class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
</msup>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<msubsup class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
<mn>X</mn>
|
||||
</msubsup>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<munder class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
</munder>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mover class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
</mover>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<munderover class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
</munderover>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mmultiscripts class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
<mn>X</mn>
|
||||
<mn>X</mn>
|
||||
<mn>X</mn>
|
||||
</mmultiscripts>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mfrac class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
</mfrac>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<maction class="testedElement" actiontype="statusline">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>STATUS MESSAGE</mn>
|
||||
</maction>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<semantics class="testedElement">
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<annotation>TEXT ANNOTATION</annotation>
|
||||
<mn>X</mn>
|
||||
</semantics>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<!-- <msub>, <msup>, <msubsup>, <munder>, <mover>, <munderover>,
|
||||
<mmultiscripts>, <mfrac>, <semantics> or <maction> are not embellished
|
||||
operators if their first child is not an embellished operator -->
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<msub class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</msub>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<msup class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</msup>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<msubsup class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
</msubsup>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<munder class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</munder>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mover class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</mover>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<munderover class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</munderover>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mmultiscripts class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
<mn>X</mn>
|
||||
<mn>X</mn>
|
||||
<mn>X</mn>
|
||||
</mmultiscripts>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mfrac class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</mfrac>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<maction class="testedElement" actiontype="statusline">
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">STATUS MESSAGE</mo>
|
||||
</maction>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<semantics class="testedElement">
|
||||
<mrow>
|
||||
<mn>X</mn>
|
||||
<mo lspace="2em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<annotation>TEXT ANNOTATION</annotation>
|
||||
</semantics>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements msqrt and mroot correctly use the radical parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -56,6 +57,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 25;
|
||||
var v2 = 1000 * emToPx;
|
||||
var radicalHeight = getBox("base001").height + v2;
|
||||
|
@ -65,6 +68,8 @@
|
|||
}, "RadicalDegreeBottomRaisePercent");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 7000 * emToPx;
|
||||
var v2 = 1000 * emToPx;
|
||||
assert_approx_equals(getBox("base0021").top - getBox("radical0021").top,
|
||||
|
@ -76,6 +81,8 @@
|
|||
}, "RadicalDisplayStyleVerticalGap");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 3000 * emToPx;
|
||||
var v2 = 1000 * emToPx;
|
||||
assert_approx_equals(getBox("base0031").top - getBox("radical0031").top,
|
||||
|
@ -86,7 +93,9 @@
|
|||
"mroot: vertical gap");
|
||||
}, "RadicalExtraAscender");
|
||||
|
||||
test(function() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
// Note: the size variants of U+221A in this font have width 1000.
|
||||
var v1 = 5000 * emToPx;
|
||||
var radicalSymbolWidth = 1000 * emToPx;
|
||||
|
@ -97,6 +106,8 @@
|
|||
}, "RadicalKernAfterDegree");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 4000 * emToPx;
|
||||
assert_approx_equals(getBox("index005").left - getBox("radical005").left,
|
||||
v1, epsilon,
|
||||
|
@ -104,6 +115,8 @@
|
|||
}, "RadicalKernBeforeDegree");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 8000 * emToPx;
|
||||
assert_approx_equals(getBox("base0061").top - getBox("radical0061").top,
|
||||
v, epsilon,
|
||||
|
@ -114,6 +127,8 @@
|
|||
}, "RadicalRuleThickness");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 6000 * emToPx;
|
||||
var v2 = 1000 * emToPx;
|
||||
assert_approx_equals(getBox("base0071").top - getBox("radical0071").top,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Basic metrics for elements msub, msup and msubsup.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -28,6 +29,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
assert_less_than_equal(getBox("msubBase").right, getBox("msubSub").left, e, "msub: subscript is after base");
|
||||
assert_less_than_equal(getBox("msupBase").right, getBox("msupSup").left, e, "msup: superscript is after base");
|
||||
|
@ -43,6 +46,8 @@
|
|||
}, "Respective horizontal positions");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
assert_approx_equals(getBox("msubBase").middle, getBox("baseline").bottom, e, "msub: base is placed on the baseline");
|
||||
assert_approx_equals(getBox("msupBase").middle, getBox("baseline").bottom, e, "msup: base is placed on the baseline");
|
||||
|
@ -50,6 +55,8 @@
|
|||
}, "Alignment of the base on the baseline");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3;
|
||||
assert_approx_equals(getBox("msubSub").middle, getBox("msubBase").bottom, e, "msub: script is placed at the bottom of the base");
|
||||
assert_approx_equals(getBox("msupSup").middle, getBox("msupBase").top, e, "msup: script is placed at the top of the base");
|
||||
|
@ -58,6 +65,8 @@
|
|||
}, "Vertical position of scripts");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3;
|
||||
assert_approx_equals(getBox("msub").width, getBox("msubSub").right - getBox("msubBase").left, e, "msub: width is determined by the left/right sides of base/script (+ some space after script)");
|
||||
assert_approx_equals(getBox("msup").width, getBox("msupSup").right - getBox("msupBase").left, e, "msup: width is determined by the left/right sides of base/script (+ some space after script)");
|
||||
|
@ -65,6 +74,8 @@
|
|||
}, "Width of scripted elements");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
assert_greater_than_equal(getBox("msub").height, getBox("msubBase").height, e, "msub: height is at least the one of the base");
|
||||
assert_greater_than_equal(getBox("msup").height, getBox("msupBase").height, e, "msup: height is at least the one of the base");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Basic metrics for the mmultiscript element.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -28,6 +29,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
assert_less_than_equal(getBox("msubBase").right, getBox("msubSub").left, e, "subscript is after base");
|
||||
assert_less_than_equal(getBox("msupBase").right, getBox("msupSup").left, e, "superscript is after base");
|
||||
|
@ -54,6 +57,8 @@
|
|||
}, "Respective horizontal positions");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
assert_approx_equals(getBox("msubBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
||||
assert_approx_equals(getBox("msupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
||||
|
@ -64,6 +69,8 @@
|
|||
}, "Alignment of the base on the baseline");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3;
|
||||
assert_approx_equals(getBox("msubSub").middle, getBox("msubBase").bottom, e, "script is placed at the bottom of the base");
|
||||
assert_approx_equals(getBox("msupSup").middle, getBox("msupBase").top, e, "script is placed at the top of the base");
|
||||
|
@ -77,6 +84,8 @@
|
|||
}, "Vertical position of scripts");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3;
|
||||
assert_approx_equals(getBox("msub").width, getBox("msubSub").right - getBox("msubBase").left, e, "width is determined by the left/right sides of base/script (+ some space after script)");
|
||||
assert_approx_equals(getBox("msup").width, getBox("msupSup").right - getBox("msupBase").left, e, "width is determined by the left/right sides of base/script (+ some space after script)");
|
||||
|
@ -88,6 +97,8 @@
|
|||
}, "Width of scripted elements");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
assert_greater_than_equal(getBox("msub").height, getBox("msubBase").height, e, "height is at least the one of the base");
|
||||
assert_greater_than_equal(getBox("msup").height, getBox("msupBase").height, e, "height is at least the one of the base");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Basic metrics for the mmultiscript element with many scripts.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -28,12 +29,16 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
for (var i = 0; i < 5; i++)
|
||||
assert_approx_equals(getBox("multi" + i + "base").middle, getBox("baseline").bottom, e, "base " + i + "is placed on the baseline");
|
||||
}, "Alignment of the base on the baseline");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 5;
|
||||
assert_approx_equals(getBox("multi0").width, 30, e, "width of multi0");
|
||||
assert_approx_equals(getBox("multi0").height, 30, e, "height of multi0");
|
||||
|
@ -49,6 +54,8 @@
|
|||
}, "Dimensions of the scripted elements");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3;
|
||||
for (var i = 2; i <= 4; i++) {
|
||||
var base = getBox("multi" + i + "base");
|
||||
|
@ -66,6 +73,8 @@
|
|||
}, "Vertical positions of scripts");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
for (var i = 2; i <= 4; i++) {
|
||||
var base = getBox("multi" + i + "base");
|
||||
|
@ -81,6 +90,8 @@
|
|||
}, "Horizontal alignment of scripts");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
for (var i = 2; i <= 4; i++) {
|
||||
var base = getBox("multi" + i + "base");
|
||||
var firstPostScript = getBox("multi" + i + "postsub1");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Verify metrics of scripted elements for bases of different heights.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -30,6 +31,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
sizeArray.forEach(function(size) {
|
||||
assert_approx_equals(getBox("msub" + size + "base").middle, getBox("baseline").bottom, e, "msub base " + size + "is placed on the baseline");
|
||||
|
@ -40,6 +43,8 @@
|
|||
}, "Alignment on the baseline for bases of different heights");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 5;
|
||||
sizeArray.forEach(function(size) {
|
||||
assert_approx_equals(getBox("msub" + size + "sub").middle, getBox("msub" + size + "base").bottom, e, "msub script " + size + "is placed at the top of of the base");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Verify metrics of scripted elements with tall scripts.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -30,6 +31,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
assert_approx_equals(getBox("msubbase").middle, getBox("baseline").bottom, e, "msub base is placed on the baseline");
|
||||
assert_approx_equals(getBox("msupbase").middle, getBox("baseline").bottom, e, "msup base is placed on the baseline");
|
||||
|
@ -38,6 +41,8 @@
|
|||
}, "Alignment on the baseline with different and large script heights");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
assert_greater_than(getBox("msubsub").top, getBox("msubbase").top, "msub: subscript is below the top of the base");
|
||||
assert_less_than(getBox("msupsup").bottom, getBox("msupbase").bottom, "msup: supscript is above the bottom of the base");
|
||||
assert_greater_than(getBox("msubsupsub").top, getBox("msubsupbase").top, "msubsup: subscript is below the top of the base");
|
||||
|
@ -49,6 +54,8 @@
|
|||
}, "Tall subscripts/superscripts are not placed too high/low");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
assert_greater_than(getBox("msubsupsub").top, getBox("msubsupsup").bottom, "msubsup: subscript is below the superscript");
|
||||
assert_greater_than(getBox("multipresub").top, getBox("multipresup").bottom, "mmultiscripts: presubscript is below the presuperscript");
|
||||
assert_greater_than(getBox("multipostsub").top, getBox("multipostsup").bottom, "mmultiscripts: postsubscript is below the postsuperscript");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements msub, msup, subsup and msubsup correctly use the subscript and superscript parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -68,6 +69,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("ref001").left - getBox("sub001").right, v, epsilon, "msub: Space after subscript");
|
||||
assert_approx_equals(getBox("ref002").left - getBox("sup002").right, v, epsilon, "msup: Space after superscript");
|
||||
|
@ -78,6 +81,8 @@
|
|||
}, "SpaceAfterScript");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 7000 * emToPx;
|
||||
assert_approx_equals(getBox("ref101").bottom - getBox("sup102").bottom, v, epsilon, "msup: Superscript shift");
|
||||
assert_approx_equals(getBox("ref101").bottom - getBox("sup103").bottom, v, epsilon, "msubsup: Superscript shift");
|
||||
|
@ -87,6 +92,8 @@
|
|||
}, "SuperscriptShiftUp");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 5000 * emToPx;
|
||||
assert_approx_equals(getBox("ref201").bottom - getBox("sup202").bottom, v, epsilon, "msup: Superscript shift");
|
||||
assert_approx_equals(getBox("ref201").bottom - getBox("sup203").bottom, v, epsilon, "msubsup: Superscript shift");
|
||||
|
@ -96,6 +103,8 @@
|
|||
}, "SuperscriptShiftUpCramped");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 6000 * emToPx;
|
||||
assert_approx_equals(getBox("sub301").bottom - getBox("ref300").bottom, v, epsilon, "msup: Subscript shift");
|
||||
assert_approx_equals(getBox("sub302").bottom - getBox("ref300").bottom, v, epsilon, "msubsup: Subscript shift");
|
||||
|
@ -104,12 +113,16 @@
|
|||
}, "SubscriptShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 11000 * emToPx;
|
||||
assert_approx_equals(getBox("sub4011").top - getBox("sup4012").bottom, v, epsilon, "msubsup: SubSuperscript gap");
|
||||
assert_approx_equals(getBox("sub4021").top - getBox("sup4022").bottom, v, epsilon, "mmultiscripts: SubSuperscript gap");
|
||||
}, "SubSuperscriptGapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 11000 * emToPx;
|
||||
var v2 = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("sub501").top - getBox("sup501").bottom, v1, epsilon, "msubsup: SubSuperscript gap");
|
||||
|
@ -119,21 +132,29 @@
|
|||
}, "SuperscriptBottomMaxWithSubscript");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 4000 * emToPx;
|
||||
assert_approx_equals(getBox("ref600").bottom - getBox("sub601").top, v, epsilon, "msub: Subscript top");
|
||||
}, "SubscriptTopMax");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 8000 * emToPx;
|
||||
assert_approx_equals(getBox("ref700").bottom - getBox("sub701").bottom, v, epsilon, "msub: Superscript bottom");
|
||||
}, "SuperscriptBottomMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 9000 * emToPx;
|
||||
assert_approx_equals(getBox("sub801").bottom - getBox("base801").bottom, v, epsilon, "msub: Superscript drop");
|
||||
}, "SubscriptBaselineDrop");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 10000 * emToPx;
|
||||
assert_approx_equals(getBox("sup901").bottom - getBox("base901").top, v, epsilon, "msup: Superscript drop");
|
||||
}, "SuperscriptBaselineDrop");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements msub, msup, subsup and msubsup correctly use the italic correction from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -42,6 +43,8 @@
|
|||
var epsilon = 1;
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 0;
|
||||
assert_approx_equals(getBox("base001").right - getBox("sub001").left, v, epsilon, "msub");
|
||||
assert_approx_equals(getBox("sup002").left, getBox("base002").right, epsilon, "msup");
|
||||
|
@ -50,6 +53,8 @@
|
|||
assert_approx_equals(getBox("sup005").left - getBox("sub005").left, 0, epsilon, "mmultiscripts prescripts");
|
||||
}, "Null Italic Correction");
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
|
||||
var v = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("base011").right - getBox("sub011").left, v, epsilon, "msub");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements munder, mover, munderover correctly .">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace, mo {
|
||||
font-size: 10px;
|
||||
|
@ -29,6 +30,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
for (var i = 0; i <= 3; i++) {
|
||||
assert_approx_equals(getBox("under" + i + "base").middle, getBox("baseline").bottom, e, "munder " + i + ": base is placed on the baseline");
|
||||
|
@ -40,6 +43,8 @@
|
|||
}, "Alignment of the base on the baseline");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
for (var i = 0; i <= 3; i++) {
|
||||
assert_approx_equals(getBox("under" + i + "under").center, getBox("under" + i + "base").center, e, "munder " + i + ": base and script are horizontally centered");
|
||||
|
@ -52,6 +57,8 @@
|
|||
}, "Horizontal alignments of base and scripts");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
for (var i = 0; i <= 3; i++) {
|
||||
assert_greater_than_equal(getBox("under" + i + "under").top, getBox("under" + i + "base").bottom, "munder " + i + ": script is under base");
|
||||
assert_less_than_equal(getBox("over" + i + "over").bottom, getBox("over" + i + "base").top, "mover " + i + ": script is over base");
|
||||
|
@ -63,6 +70,8 @@
|
|||
}, "Relative vertical positions of base and scripts");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 1;
|
||||
for (var i = 0; i <= 3; i++) {
|
||||
assert_approx_equals(getBox("under" + i).width, Math.max(getBox("under" + i + "base").width, getBox("under" + i + "under").width), e, "munder " + i + ": width is determined by the maximum of width of base and script");
|
||||
|
@ -74,6 +83,8 @@
|
|||
}, "Width of scripted elements");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var e = 3.2;
|
||||
for (var i = 0; i <= 3; i++) {
|
||||
assert_approx_equals(getBox("under" + i).height, getBox("under" + i + "base").height + getBox("under" + i + "under").height + e, e, "munder " + i + ": height is determined by the sum of heights of base and script plus some spacing.");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements munder, mover, munderover correctly use the limit parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace, mo {
|
||||
font-size: 10px;
|
||||
|
@ -44,6 +45,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("under00011").top - getBox("ref0001").bottom,
|
||||
v, epsilon, "munder: under shift");
|
||||
|
@ -52,6 +55,8 @@
|
|||
}, "LowerLimitBaselineDropMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 11000 * emToPx;
|
||||
assert_approx_equals(getBox("under00021").top - getBox("ref0002").bottom,
|
||||
v, epsilon, "munder: under gap");
|
||||
|
@ -60,6 +65,8 @@
|
|||
}, "LowerLimitGapMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 5000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0003").top - getBox("over00031").bottom,
|
||||
v, epsilon, "mover: over shift");
|
||||
|
@ -68,6 +75,8 @@
|
|||
}, "UpperLimitBaselineRiseMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 7000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0004").top - getBox("over00041").bottom,
|
||||
v, epsilon, "mover: over shift");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements munder, mover, munderover correctly use the stretch stack parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace, mo {
|
||||
font-size: 10px;
|
||||
|
@ -44,6 +45,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("under00011").top - getBox("ref0001").bottom,
|
||||
v, epsilon, "munder: under shift");
|
||||
|
@ -52,6 +55,8 @@
|
|||
}, "StretchStackBottomShiftDown");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 11000 * emToPx;
|
||||
assert_approx_equals(getBox("under00021").top - getBox("ref0002").bottom,
|
||||
v, epsilon, "munder: under gap");
|
||||
|
@ -60,6 +65,8 @@
|
|||
}, "StretchStackGapBelowMin");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 5000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0003").top - getBox("over00031").bottom,
|
||||
v, epsilon, "mover: over shift");
|
||||
|
@ -68,6 +75,8 @@
|
|||
}, "StretchStackTopShiftUp");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 7000 * emToPx;
|
||||
assert_approx_equals(getBox("ref0004").top - getBox("over00041").bottom,
|
||||
v, epsilon, "mover: over shift");
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements munder, mover, munderover correctly use underbar/overbar and AccentBaseHeight parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace, mo {
|
||||
font-size: 10px;
|
||||
|
@ -47,6 +48,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
for (var i = 1; i <= 4; i++) {
|
||||
for (var j = 1; j <= 6; j++) {
|
||||
var baseId = ("base00" + i) + j;
|
||||
|
@ -59,6 +62,8 @@
|
|||
}, "Baseline alignment");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
for (var i = 1; i <= 4; i++) {
|
||||
for (var j = 1; j <= 6; j++) {
|
||||
var baseId = ("base00" + i) + j;
|
||||
|
@ -72,6 +77,8 @@
|
|||
}, "Heights of bases");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 5000 * emToPx;
|
||||
assert_approx_equals(getBox("ref001").bottom - getBox("over0014").bottom,
|
||||
shortBaseHeight, epsilon,
|
||||
|
@ -96,6 +103,8 @@
|
|||
}, "AccentBaseHeight, UnderbarExtraDescender");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 7000 * emToPx;
|
||||
assert_approx_equals(getBox("ref002").bottom - getBox("over0024").bottom,
|
||||
shortBaseHeight, epsilon,
|
||||
|
@ -118,6 +127,8 @@
|
|||
}, "AccentBaseHeight, UnderbarVerticalGap");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("ref003").bottom - getBox("over0031").bottom,
|
||||
shortBaseHeight, epsilon,
|
||||
|
@ -154,6 +165,8 @@
|
|||
}, "AccentBaseHeight, OverbarExtraAscender");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
v = 11000 * emToPx;
|
||||
assert_approx_equals(getBox("ref004").bottom - getBox("over0041").bottom,
|
||||
shortBaseHeight + v, epsilon,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Elements munder, mover, munderover correctly use underbar/overbar and AccentBaseHeight parameters from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace, mo {
|
||||
font-size: 10px;
|
||||
|
@ -47,6 +48,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
for (var i = 1; i <= 4; i++) {
|
||||
for (var j = 1; j <= 6; j++) {
|
||||
var baseId = ("base00" + i) + j;
|
||||
|
@ -59,6 +62,8 @@
|
|||
}, "Baseline alignment");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
for (var i = 1; i <= 4; i++) {
|
||||
for (var j = 1; j <= 6; j++) {
|
||||
var baseId = ("base00" + i) + j;
|
||||
|
@ -72,6 +77,8 @@
|
|||
}, "Heights of bases");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 5000 * emToPx;
|
||||
assert_approx_equals(getBox("ref001").bottom - getBox("over0014").bottom,
|
||||
shortBaseHeight, epsilon,
|
||||
|
@ -96,6 +103,8 @@
|
|||
}, "AccentBaseHeight, UnderbarExtraDescender");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 7000 * emToPx;
|
||||
assert_approx_equals(getBox("ref002").bottom - getBox("over0024").bottom,
|
||||
shortBaseHeight, epsilon,
|
||||
|
@ -118,6 +127,8 @@
|
|||
}, "AccentBaseHeight, UnderbarVerticalGap");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v = 3000 * emToPx;
|
||||
assert_approx_equals(getBox("ref003").bottom - getBox("over0031").bottom,
|
||||
shortBaseHeight, epsilon,
|
||||
|
@ -154,6 +165,8 @@
|
|||
}, "AccentBaseHeight, OverbarExtraAscender");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
v = 11000 * emToPx;
|
||||
assert_approx_equals(getBox("ref004").bottom - getBox("over0041").bottom,
|
||||
shortBaseHeight + v, epsilon,
|
||||
|
|
|
@ -0,0 +1,257 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mtext"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mtext"), emToPx, epsilon);
|
||||
}, "mtext is space-like");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mspace"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mspace"), emToPx, epsilon);
|
||||
}, "mspace is space-like");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mrow1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mrow1"), emToPx, epsilon);
|
||||
}, "space-like mrow");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mrow2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mrow2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mrow");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mstyle1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mstyle1"), emToPx, epsilon);
|
||||
}, "space-like mstyle");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mstyle2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mstyle2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mstyle");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mphantom1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mphantom1"), emToPx, epsilon);
|
||||
}, "space-like mphantom");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mphantom2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mphantom2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mphantom");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mpadded1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mpadded1"), emToPx, epsilon);
|
||||
}, "space-like mpadded");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mpadded2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mpadded2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mpadded");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mtext is space-like. -->
|
||||
<mtext class="testedElement" id="mtext">X</mtext>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mspace is space-like. -->
|
||||
<mspace class="testedElement" id="mspace" width="25px" height="10px"></mspace>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mrow is space-like when it contains only space-like elements. -->
|
||||
<mrow id="mrow1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mrow is not space-like when it contains a non space-like element
|
||||
such as "mn". -->
|
||||
<mrow id="mrow2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mstyle is space-like when it contains only space-like elements. -->
|
||||
<mstyle id="mstyle1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mstyle>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mstyle is not space-like when it contains a non space-like element
|
||||
such as "mn". -->
|
||||
<mstyle id="mstyle2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mstyle>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mphantom is space-like when it contains only space-like elements.
|
||||
-->
|
||||
<mphantom id="mphantom1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mphantom>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mphantom is not space-like when it contains a non space-like
|
||||
element such as "mn". -->
|
||||
<mphantom id="mphantom2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mphantom>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mpadded is space-like when it contains only space-like elements. -->
|
||||
<mpadded id="mpadded1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mpadded>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mpadded is not space-like when it contains a non space-like element
|
||||
such as "mn". -->
|
||||
<mpadded id="mpadded2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mpadded>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,174 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("maction1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("maction1"), emToPx, epsilon);
|
||||
}, "space-like maction");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("maction2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("maction2"), 2 * emToPx, epsilon);
|
||||
}, "non-space like maction (no first child)");
|
||||
|
||||
test(function() {
|
||||
assert_approx_equals(spaceBefore("maction3"), 0, epsilon);
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceAfter("maction3"), 2 * emToPx, epsilon);
|
||||
}, "non-space like maction (first child not space-like)");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("semantics1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("semantics1"), emToPx, epsilon);
|
||||
}, "space-like semantics");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("semantics2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("semantics2"), 2 * emToPx, epsilon);
|
||||
}, "non-space like semantics (no first child)");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("semantics3"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("semantics3"), 2 * emToPx, epsilon);
|
||||
}, "non-space like semantics (first child not space-like)");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- maction is space-like when its first child exists and is space-like -->
|
||||
<maction id="maction1" class="testedElement" actiontype="statusline">
|
||||
<mtext>X</mtext>
|
||||
<mtext>STATUS MESSAGE</mtext>
|
||||
</maction>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- maction is not space-like when its first does not exist-like -->
|
||||
<maction id="maction2" class="testedElement" actiontype="statusline">
|
||||
</maction>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- maction is not space-like when its first is not space-like -->
|
||||
<maction id="maction3" class="testedElement" actiontype="statusline">
|
||||
<mn>1</mn>
|
||||
<mtext>STATUS MESSAGE</mtext>
|
||||
</maction>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- semantics is space-like when its first child exists and is space-like -->
|
||||
<semantics id="semantics1" class="testedElement" actiontype="statusline">
|
||||
<mtext>X</mtext>
|
||||
<annotation>TEXT ANNOTATION</annotation>
|
||||
</semantics>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- semantics is not space-like when its first does not exist-like -->
|
||||
<semantics id="semantics2" class="testedElement" actiontype="statusline">
|
||||
</semantics>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- semantics is not space-like when its first is not space-like -->
|
||||
<semantics id="semantics3" class="testedElement" actiontype="statusline">
|
||||
<mn>1</mn>
|
||||
<annotation>TEXT ANNOTATION</annotation>
|
||||
</semantics>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,276 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Non space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(element) {
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(element) {
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
Array.from(document.querySelectorAll(".testedElement")).forEach(el => {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore(el), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter(el), 2 * emToPx, epsilon);
|
||||
}, `${el.tagName} is not space-like`);
|
||||
});
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<merror class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
</merror>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mroot class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mroot>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<menclose class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
</menclose>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mfrac class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mfrac>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mi class="testedElement">X</mi>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mmultiscripts class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mmultiscripts>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mn class="testedElement">X</mn>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mo class="testedElement" lspace="0" rspace="0">X</mo>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mover class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mover>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<munder class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</munder>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<ms class="testedElement">X</ms>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<munderover class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</munderover>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msup class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</msup>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msub class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</msub>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msubsup class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</msubsup>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msqrt class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
</msqrt>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mtable class="testedElement">
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mtext>X</mtext>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,193 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("complex1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("complex1"), emToPx, epsilon);
|
||||
}, "complex space-like subtree");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("complex2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("complex2"), 2 * emToPx, epsilon);
|
||||
}, "complex non-space-like subtree");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- This element is space-like because it is made of nested
|
||||
mrow, mstyle, mpadded, mphantom, mtext, mspace
|
||||
-->
|
||||
<mrow class="testedElement" id="complex1">
|
||||
<mtext>X</mtext>
|
||||
<mstyle>
|
||||
<mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mtext>X</mtext>
|
||||
<mrow></mrow>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mrow>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mrow>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
</mstyle>
|
||||
<mspace width="25px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- This element is not space-like. It is made of nested
|
||||
mrow, mstyle, mpadded, mphantom, mtext, mspace but contains
|
||||
one non-space like descendant (an mn element).
|
||||
-->
|
||||
<mrow class="testedElement" id="complex2">
|
||||
<mtext>X</mtext>
|
||||
<mstyle>
|
||||
<mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mtext>X</mtext>
|
||||
<mrow></mrow>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mrow>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mrow>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mphantom>
|
||||
<mn>X</mn> <!-- mn is not space-like -->
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
</mstyle>
|
||||
<mspace width="25px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -7,6 +7,7 @@
|
|||
<meta name="assert" content="Element mtable correctly uses the axis height parameter from the MATH table.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
math, mspace {
|
||||
font-size: 10px;
|
||||
|
@ -32,6 +33,8 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
|
||||
var v1 = 5000 * emToPx;
|
||||
var tableMiddle = (getBox("table").bottom + getBox("table").top) / 2;
|
||||
assert_approx_equals(getBox("baseline").bottom - tableMiddle,
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="match" href="color-001-ref.html"/>
|
||||
<meta name="assert" content="Verify that the color is used for the text of token elements.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px; padding: 1px;">
|
||||
<math><mi style="color: green">1</mi></math>
|
||||
<math><mn style="color: green">2</mn></math>
|
||||
<math><mo style="color: green">3</mo></math>
|
||||
<math><mtext style="color: green">4</mtext></math>
|
||||
<math><ms style="color: green">5</ms></math>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color (reference)</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; width: 200px; height: 200px; padding: 1px;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness">
|
||||
<link rel="match" href="color-002-ref.html"/>
|
||||
<meta name="assert" content="Verify that the color is used for text and fraction bar of the mfrac element.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px; padding: 1px;">
|
||||
<math><mfrac style="color: green"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color (reference)</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; width: 200px; height: 200px; padding: 1px;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#radical-symbol">
|
||||
<link rel="match" href="color-003-ref.html"/>
|
||||
<meta name="assert" content="Verify that the color is used for text and radical symbol of the msqrt and mroot elements.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px; padding: 1px;">
|
||||
<math><msqrt style="color: green"><mn>1</mn></msqrt></math>
|
||||
<math><mroot style="color: green"><mn>2</mn><mn>2</mn></mroot></math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_msqrt");</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color (reference)</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; width: 200px; height: 200px; padding: 1px;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#enclose-expression-inside-notation-menclose">
|
||||
<link rel="match" href="color-004-ref.html"/>
|
||||
<meta name="assert" content="Verify that the color is used for text and graphical elements of the menclose element.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px; padding: 1px;">
|
||||
<math><menclose notation="left" style="color: green"><mn>1</mn></menclose></math>
|
||||
<math><menclose notation="right" style="color: green"><mn>2</mn></menclose></math>
|
||||
<math><menclose notation="top" style="color: green"><mn>3</mn></menclose></math>
|
||||
<math><menclose notation="bottom" style="color: green"><mn>4</mn></menclose></math>
|
||||
<math><menclose notation="box" style="color: green"><mn>5</mn></menclose></math>
|
||||
<math><menclose notation="roundedbox" style="color: green"><mn>6</mn></menclose></math>
|
||||
<math><menclose notation="actuarial" style="color: green"><mn>7</mn></menclose></math>
|
||||
<math><menclose notation="madruwb" style="color: green"><mn>8</mn></menclose></math>
|
||||
<math><menclose notation="horizontalstrike" style="color: green"><mn>9</mn></menclose></math>
|
||||
<math><menclose notation="verticalstrike" style="color: green"><mn>10</mn></menclose></math>
|
||||
<math><menclose notation="updiagonalstrike" style="color: green"><mn>11</mn></menclose></math>
|
||||
<math><menclose notation="downdiagonalstrike" style="color: green"><mn>12</mn></menclose></math>
|
||||
<math><menclose notation="longdiv" style="color: green"><mn>13</mn></menclose></math>
|
||||
<math><menclose notation="circle" style="color: green"><mn>14</mn></menclose></math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_menclose");</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,41 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>color</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#radical-symbol">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#enclose-expression-inside-notation-menclose">
|
||||
<link rel="match" href="color-1-ref.html"/>
|
||||
<meta name="assert" content="Verify that the color is used for text and graphical elements.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px; padding: 1px;">
|
||||
<math><mfrac style="color: green"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><msqrt style="color: green"><mn>3</mn></msqrt></math>
|
||||
<math><mroot style="color: green"><mn>4</mn><mn>5</mn></mroot></math>
|
||||
<math><menclose notation="left" style="color: green"><mn>6</mn></menclose></math>
|
||||
<math><menclose notation="right" style="color: green"><mn>7</mn></menclose></math>
|
||||
<math><menclose notation="top" style="color: green"><mn>8</mn></menclose></math>
|
||||
<math><menclose notation="bottom" style="color: green"><mn>9</mn></menclose></math>
|
||||
<math><menclose notation="box" style="color: green"><mn>10</mn></menclose></math>
|
||||
<math><menclose notation="roundedbox" style="color: green"><mn>11</mn></menclose></math>
|
||||
<math><menclose notation="actuarial" style="color: green"><mn>12</mn></menclose></math>
|
||||
<math><menclose notation="madruwb" style="color: green"><mn>13</mn></menclose></math>
|
||||
<math><menclose notation="horizontalstrike" style="color: green"><mn>14</mn></menclose></math>
|
||||
<math><menclose notation="verticalstrike" style="color: green"><mn>15</mn></menclose></math>
|
||||
<math><menclose notation="updiagonalstrike" style="color: green"><mn>16</mn></menclose></math>
|
||||
<math><menclose notation="downdiagonalstrike" style="color: green"><mn>17</mn></menclose></math>
|
||||
<math><menclose notation="longdiv" style="color: green"><mn>18</mn></menclose></math>
|
||||
<math><menclose notation="circle" style="color: green"><mn>19</mn></menclose></math>
|
||||
<math><mi style="color: green">20</mi></math>
|
||||
<math><mn style="color: green">21</mn></math>
|
||||
<math><mo style="color: green">22</mo></math>
|
||||
<math><mtext style="color: green">23</mtext></math>
|
||||
<math><ms style="color: green">24</ms></math>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -12,5 +12,7 @@
|
|||
<div style="background: green; color: red; width: 200px; height: 200px;">
|
||||
<math style="display: none;"><mspace width="200px" height="200px" style="background: red"/></math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mspace");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
verify_displaystyle("mtable_true", true, "explicit displaystyle true");
|
||||
}, "mtable element");
|
||||
test(function() {
|
||||
verify_displaystyle("mfrac_sibling", true, "sibling");
|
||||
verify_displaystyle("mfrac_numerator", false, "numerator");
|
||||
verify_displaystyle("mfrac_denominator", false, "denominator");
|
||||
}, "mfrac element");
|
||||
|
@ -105,7 +106,7 @@
|
|||
<math displaystyle="true"><mtable><mtr><mtd><mo id="mtable_default">⫿</mo></mtd></mtr></mtable></math>
|
||||
<math><mtable displaystyle="true"><mtr><mtd><mo id="mtable_true">⫿</mo></mtd></mtr></mtable></math>
|
||||
<math displaystyle="true"><mtable displaystyle="false"><mtr><mtd><mo id="mtable_false">⫿</mo></mtd></mtr></mtable></math>
|
||||
<math displaystyle="true"><mfrac><mo id="mfrac_numerator">⫿</mo><mo id="mfrac_denominator">⫿</mo></mfrac></math>
|
||||
<math displaystyle="true"><mo id="mfrac_sibling">⫿</mo><mfrac><mo id="mfrac_numerator">⫿</mo><mo id="mfrac_denominator">⫿</mo></mfrac></math>
|
||||
<math displaystyle="true"><mroot><mo id="mroot_base">⫿</mo><mo id="mroot_index">⫿</mo></mroot></math>
|
||||
<math displaystyle="true"><msub><mo id="msub_base">⫿</mo><mo id="msub_subscript">⫿</mo></msub></math>
|
||||
<math displaystyle="true"><msup><mo id="msup_base">⫿</mo><mo id="msup_supscript">⫿</mo></msup></math>
|
||||
|
|
|
@ -99,5 +99,7 @@
|
|||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_dir");</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<meta name="assert" content="Verify various cases of the MathML length syntax.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: TestFont;
|
||||
|
@ -35,6 +36,7 @@
|
|||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_equals(getBox("unitCm").width, 96, "cm");
|
||||
assert_equals(getBox("unitEm").width, 120, "em");
|
||||
assert_equals(getBox("unitEx").width, 500, "ex");
|
||||
|
@ -47,6 +49,7 @@
|
|||
}, "Units");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_equals(getBox("spaceCm").width, 96, "cm");
|
||||
assert_equals(getBox("spaceEm").width, 120, "em");
|
||||
assert_equals(getBox("spaceEx").width, 500, "ex");
|
||||
|
@ -59,6 +62,7 @@
|
|||
}, "Trimming of space");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
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");
|
||||
|
@ -72,6 +76,7 @@
|
|||
}, "Non-negative numbers");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
var topRef = getBox("ref").top;
|
||||
assert_approx_equals(getBox("N0").top - topRef, -0, epsilon, "N0");
|
||||
assert_approx_equals(topRef - getBox("N1").top, -90, epsilon, "N1");
|
||||
|
@ -86,6 +91,7 @@
|
|||
}, "Non-positive numbers");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
// Namedspace values are invalid in MathML Core.
|
||||
["veryverythinmathspace",
|
||||
"verythinmathspace",
|
||||
|
@ -110,6 +116,7 @@
|
|||
}, "Legacy namedspaces");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
// These values are invalid in MathML Core.
|
||||
assert_equals(getBox("unitNone").width, 30, "Unitless");
|
||||
assert_approx_equals(getBox("n3").width, 0, epsilon, "n3");
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>border</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-algorithms">
|
||||
<meta name="assert" content="Verify that border is taken into account.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="helper.js"></script>
|
||||
<script>
|
||||
var epsilon = 1;
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-border")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left border");
|
||||
assert_approx_equals(s.right, 30, epsilon, "right border");
|
||||
assert_approx_equals(s.top, 40, epsilon, "top border");
|
||||
assert_approx_equals(s.bottom, 50, epsilon, "bottom border");
|
||||
}, "Border properties on mrow");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-border-shorthand")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left border");
|
||||
assert_approx_equals(s.right, 20, epsilon, "right border");
|
||||
assert_approx_equals(s.top, 20, epsilon, "top border");
|
||||
assert_approx_equals(s.bottom, 20, epsilon, "bottom border");
|
||||
}, "Border properties on mrow (shorthand)");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-border-logical")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left border");
|
||||
assert_approx_equals(s.right, 30, epsilon, "right border");
|
||||
assert_approx_equals(s.top, 40, epsilon, "top border");
|
||||
assert_approx_equals(s.bottom, 50, epsilon, "bottom border");
|
||||
}, "Border properties on mrow (logical)");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-border-logical-shorthand")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left border");
|
||||
assert_approx_equals(s.right, 20, epsilon, "right border");
|
||||
assert_approx_equals(s.top, 30, epsilon, "top border");
|
||||
assert_approx_equals(s.bottom, 30, epsilon, "bottom border");
|
||||
}, "Border properties on mrow (logical, shorthand)");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border"
|
||||
style="border-left: 20px;
|
||||
border-right: 30px;
|
||||
border-top: 40px;
|
||||
border-bottom: 50px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border-shorthand"
|
||||
style="border: 20px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border-logical"
|
||||
style="border-inline-start: 20px;
|
||||
border-inline-end: 30px;
|
||||
border-block-start: 40px;
|
||||
border-block-end: 50px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-border-logical-shorthand"
|
||||
style="border-inline: 20px;
|
||||
border-block: 30px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
function measureSpaceAround(id) {
|
||||
var mrow = document.getElementById(id);
|
||||
var mrowBox = mrow.getBoundingClientRect();
|
||||
var parentBox = mrow.parentNode.getBoundingClientRect();
|
||||
var childBox = mrow.firstElementChild.getBoundingClientRect();
|
||||
return {
|
||||
left: childBox.left - parentBox.left,
|
||||
right: parentBox.right - childBox.right,
|
||||
top: childBox.top - parentBox.top,
|
||||
bottom: parentBox.bottom - childBox.bottom
|
||||
};
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>margin</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-algorithms">
|
||||
<meta name="assert" content="Verify that margin is taken into account.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="helper.js"></script>
|
||||
<script>
|
||||
var epsilon = 1;
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-margin")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left margin");
|
||||
assert_approx_equals(s.right, 30, epsilon, "right margin");
|
||||
assert_approx_equals(s.top, 40, epsilon, "top margin");
|
||||
assert_approx_equals(s.bottom, 50, epsilon, "bottom margin");
|
||||
}, "Margin properties on mrow");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-margin-shorthand")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left margin");
|
||||
assert_approx_equals(s.right, 20, epsilon, "right margin");
|
||||
assert_approx_equals(s.top, 20, epsilon, "top margin");
|
||||
assert_approx_equals(s.bottom, 20, epsilon, "bottom margin");
|
||||
}, "Margin properties on mrow (shorthand)");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-margin-logical")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left margin");
|
||||
assert_approx_equals(s.right, 30, epsilon, "right margin");
|
||||
assert_approx_equals(s.top, 40, epsilon, "top margin");
|
||||
assert_approx_equals(s.bottom, 50, epsilon, "bottom margin");
|
||||
}, "Margin properties on mrow (logical)");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-margin-logical-shorthand")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left margin");
|
||||
assert_approx_equals(s.right, 20, epsilon, "right margin");
|
||||
assert_approx_equals(s.top, 30, epsilon, "top margin");
|
||||
assert_approx_equals(s.bottom, 30, epsilon, "bottom margin");
|
||||
}, "Margin properties on mrow (logical, shorthand)");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-margin"
|
||||
style="margin-left: 20px;
|
||||
margin-right: 30px;
|
||||
margin-top: 40px;
|
||||
margin-bottom: 50px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-margin-shorthand"
|
||||
style="margin: 20px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-margin-logical"
|
||||
style="margin-inline-start: 20px;
|
||||
margin-inline-end: 30px;
|
||||
margin-block-start: 40px;
|
||||
margin-block-end: 50px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-margin-logical-shorthand"
|
||||
style="margin-inline: 20px;
|
||||
margin-block: 30px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>padding</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-algorithms">
|
||||
<meta name="assert" content="Verify that padding is taken into account.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="helper.js"></script>
|
||||
<script>
|
||||
var epsilon = 1;
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-padding")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left padding");
|
||||
assert_approx_equals(s.right, 30, epsilon, "right padding");
|
||||
assert_approx_equals(s.top, 40, epsilon, "top padding");
|
||||
assert_approx_equals(s.bottom, 50, epsilon, "bottom padding");
|
||||
}, "Padding properties on mrow");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-padding-shorthand")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left padding");
|
||||
assert_approx_equals(s.right, 20, epsilon, "right padding");
|
||||
assert_approx_equals(s.top, 20, epsilon, "top padding");
|
||||
assert_approx_equals(s.bottom, 20, epsilon, "bottom padding");
|
||||
}, "Padding properties on mrow (shorthand)");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-padding-logical")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left padding");
|
||||
assert_approx_equals(s.right, 30, epsilon, "right padding");
|
||||
assert_approx_equals(s.top, 40, epsilon, "top padding");
|
||||
assert_approx_equals(s.bottom, 50, epsilon, "bottom padding");
|
||||
}, "Padding properties on mrow (logical)");
|
||||
|
||||
test(function() {
|
||||
var s = measureSpaceAround("mrow-padding-logical-shorthand")
|
||||
assert_approx_equals(s.left, 20, epsilon, "left padding");
|
||||
assert_approx_equals(s.right, 20, epsilon, "right padding");
|
||||
assert_approx_equals(s.top, 30, epsilon, "top padding");
|
||||
assert_approx_equals(s.bottom, 30, epsilon, "bottom padding");
|
||||
}, "Padding properties on mrow (logical, shorthand)");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-padding"
|
||||
style="padding-left: 20px;
|
||||
padding-right: 30px;
|
||||
padding-top: 40px;
|
||||
padding-bottom: 50px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-padding-shorthand"
|
||||
style="padding: 20px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-padding-logical"
|
||||
style="padding-inline-start: 20px;
|
||||
padding-inline-end: 30px;
|
||||
padding-block-start: 40px;
|
||||
padding-block-end: 50px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mrow>
|
||||
<mrow id="mrow-padding-logical-shorthand"
|
||||
style="padding-inline: 20px;
|
||||
padding-block: 30px;">
|
||||
<mspace width="50px" height="50px"></mspace>
|
||||
</mrow>
|
||||
</mrow>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>visibility</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="match" href="visibility-001-ref.html"/>
|
||||
<meta name="assert" content="Verify that visibility=hidden is used for the text of token elements.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px;">
|
||||
<math><mi style="visibility: hidden">1</mi></math>
|
||||
<math><mn style="visibility: hidden">2</mn></math>
|
||||
<math><mo style="visibility: hidden">3</mo></math>
|
||||
<math><mtext style="visibility: hidden">4</mtext></math>
|
||||
<math><ms style="visibility: hidden">5</ms></math>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>visibility (reference)</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; width: 200px; height: 200px;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>visibility</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness">
|
||||
<link rel="match" href="visibility-002-ref.html"/>
|
||||
<meta name="assert" content="Verify that visibility=hidden is used for the text and fraction bar of the mfrac element.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px;">
|
||||
<math><mfrac style="visibility: hidden"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>visibility (reference)</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; width: 200px; height: 200px;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>visibility</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#radical-symbol">
|
||||
<link rel="match" href="visibility-003-ref.html"/>
|
||||
<meta name="assert" content="Verify that visibility=hidden is used for the text and radical symbol of the msqrt and mroot elements.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px;">
|
||||
<math><msqrt style="visibility: hidden"><mn>1</mn></msqrt></math>
|
||||
<math><mroot style="visibility: hidden"><mn>2</mn><mn>3</mn></mroot></math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_msqrt");</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>visibility (reference)</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; width: 200px; height: 200px;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -5,37 +5,29 @@
|
|||
<title>visibility</title>
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#text-mtext">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#fraction-with-nonzero-line-thickness">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#radical-symbol">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#enclose-expression-inside-notation-menclose">
|
||||
<link rel="match" href="visibility-1-ref.html"/>
|
||||
<meta name="assert" content="Verify that visibility=hidden is used for text and graphical elements.">
|
||||
<link rel="match" href="visibility-004-ref.html"/>
|
||||
<meta name="assert" content="Verify that visibility=hidden is used for the text and graphical elements of the menclose element.">
|
||||
</head>
|
||||
<body>
|
||||
<p>Test passes if you see a green square.</p>
|
||||
<div style="background: green; color: red; width: 200px; height: 200px;">
|
||||
<math><mfrac style="visibility: hidden"><mn>1</mn><mn>2</mn></mfrac></math>
|
||||
<math><msqrt style="visibility: hidden"><mn>3</mn></msqrt></math>
|
||||
<math><mroot style="visibility: hidden"><mn>4</mn><mn>5</mn></mroot></math>
|
||||
<math><menclose notation="left" style="visibility: hidden"><mn>6</mn></menclose></math>
|
||||
<math><menclose notation="right" style="visibility: hidden"><mn>7</mn></menclose></math>
|
||||
<math><menclose notation="top" style="visibility: hidden"><mn>8</mn></menclose></math>
|
||||
<math><menclose notation="bottom" style="visibility: hidden"><mn>9</mn></menclose></math>
|
||||
<math><menclose notation="box" style="visibility: hidden"><mn>10</mn></menclose></math>
|
||||
<math><menclose notation="roundedbox" style="visibility: hidden"><mn>11</mn></menclose></math>
|
||||
<math><menclose notation="actuarial" style="visibility: hidden"><mn>12</mn></menclose></math>
|
||||
<math><menclose notation="madruwb" style="visibility: hidden"><mn>13</mn></menclose></math>
|
||||
<math><menclose notation="horizontalstrike" style="visibility: hidden"><mn>14</mn></menclose></math>
|
||||
<math><menclose notation="verticalstrike" style="visibility: hidden"><mn>15</mn></menclose></math>
|
||||
<math><menclose notation="updiagonalstrike" style="visibility: hidden"><mn>16</mn></menclose></math>
|
||||
<math><menclose notation="downdiagonalstrike" style="visibility: hidden"><mn>17</mn></menclose></math>
|
||||
<math><menclose notation="longdiv" style="visibility: hidden"><mn>18</mn></menclose></math>
|
||||
<math><menclose notation="circle" style="visibility: hidden"><mn>19</mn></menclose></math>
|
||||
<math><mi style="visibility: hidden">20</mi></math>
|
||||
<math><mn style="visibility: hidden">21</mn></math>
|
||||
<math><mo style="visibility: hidden">22</mo></math>
|
||||
<math><mtext style="visibility: hidden">23</mtext></math>
|
||||
<math><ms style="visibility: hidden">24</ms></math>
|
||||
<math><menclose notation="left" style="visibility: hidden"><mn>1</mn></menclose></math>
|
||||
<math><menclose notation="right" style="visibility: hidden"><mn>2</mn></menclose></math>
|
||||
<math><menclose notation="top" style="visibility: hidden"><mn>3</mn></menclose></math>
|
||||
<math><menclose notation="bottom" style="visibility: hidden"><mn>4</mn></menclose></math>
|
||||
<math><menclose notation="box" style="visibility: hidden"><mn>5</mn></menclose></math>
|
||||
<math><menclose notation="roundedbox" style="visibility: hidden"><mn>6</mn></menclose></math>
|
||||
<math><menclose notation="actuarial" style="visibility: hidden"><mn>7</mn></menclose></math>
|
||||
<math><menclose notation="madruwb" style="visibility: hidden"><mn>8</mn></menclose></math>
|
||||
<math><menclose notation="horizontalstrike" style="visibility: hidden"><mn>9</mn></menclose></math>
|
||||
<math><menclose notation="verticalstrike" style="visibility: hidden"><mn>10</mn></menclose></math>
|
||||
<math><menclose notation="updiagonalstrike" style="visibility: hidden"><mn>11</mn></menclose></math>
|
||||
<math><menclose notation="downdiagonalstrike" style="visibility: hidden"><mn>12</mn></menclose></math>
|
||||
<math><menclose notation="longdiv" style="visibility: hidden"><mn>13</mn></menclose></math>
|
||||
<math><menclose notation="circle" style="visibility: hidden"><mn>14</mn></menclose></math>
|
||||
</div>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>MathMLFeatureDetection.ensure_for_match_reftest("has_menclose");</script>
|
||||
</body>
|
||||
</html>
|
|
@ -8,6 +8,7 @@
|
|||
<meta name="assert" content="Verify that the display attribute on the math element is supported and impacts centering and line breaking with surrounding content.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<script>
|
||||
function getBox(aId) {
|
||||
return document.getElementById(aId).getBoundingClientRect();
|
||||
|
@ -19,6 +20,7 @@
|
|||
var mspace_block = getBox("mspace_block");
|
||||
var after_block = getBox("after_block");
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_approx_equals(before_block.left, content.left, 1,
|
||||
"content before must be left aligned");
|
||||
assert_approx_equals((mspace_block.left + mspace_block.right) / 2,
|
||||
|
@ -37,6 +39,7 @@
|
|||
var mspace_inline = getBox("mspace_inline");
|
||||
var after_inline = getBox("after_inline");
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_mspace());
|
||||
assert_approx_equals((before_inline.top + before_inline.bottom) / 2,
|
||||
(mspace_inline.top + mspace_inline.bottom) / 2,
|
||||
1,
|
||||
|
|
148
tests/wpt/web-platform-tests/mathml/support/feature-detection.js
Normal file
148
tests/wpt/web-platform-tests/mathml/support/feature-detection.js
Normal file
|
@ -0,0 +1,148 @@
|
|||
// This is a helper for MathML feature detection.
|
||||
// It is indented to be used to prevent false negative test results.
|
||||
|
||||
var MathMLFeatureDetection = {
|
||||
|
||||
has_mspace: function() {
|
||||
// https://mathml-refresh.github.io/mathml-core/#space-mspace
|
||||
if (!this.hasOwnProperty("_has_mspace")) {
|
||||
document.body.insertAdjacentHTML("beforeend", "<math>\
|
||||
<mspace></mspace>\
|
||||
<mspace width='20px'></mspace>\
|
||||
</math>");
|
||||
var math = document.body.lastElementChild;
|
||||
// The width attribute will add 20px per MathML and none if not supported.
|
||||
this._has_mspace =
|
||||
math.lastChild.getBoundingClientRect().width -
|
||||
math.firstChild.getBoundingClientRect().width > 10;
|
||||
document.body.removeChild(math);
|
||||
}
|
||||
return this._has_mspace;
|
||||
},
|
||||
|
||||
has_operator_spacing: function() {
|
||||
// https://mathml-refresh.github.io/mathml-core/#dfn-lspace
|
||||
// https://mathml-refresh.github.io/mathml-core/#layout-of-mrow
|
||||
if (!this.hasOwnProperty("_has_operator_spacing")) {
|
||||
document.body.insertAdjacentHTML("beforeend", "<math>\
|
||||
<mrow>\
|
||||
<mn>1</mn><mo lspace='0px' rspace='0px'>+</mo><mn>2</mn>\
|
||||
</mrow>\
|
||||
<mrow>\
|
||||
<mn>1</mn><mo lspace='8px' rspace='8px'>+</mo><mn>2</mn>\
|
||||
</mrow>\
|
||||
</math>");
|
||||
var math = document.body.lastElementChild;
|
||||
var mrow = math.getElementsByTagName("mrow");
|
||||
// lspace/rspace will add 16px per MathML and none if not supported.
|
||||
this._has_operator_spacing =
|
||||
mrow[1].getBoundingClientRect().width -
|
||||
mrow[0].getBoundingClientRect().width > 10;
|
||||
document.body.removeChild(math);
|
||||
}
|
||||
return this._has_operator_spacing;
|
||||
},
|
||||
|
||||
has_mfrac: function() {
|
||||
if (!this.hasOwnProperty("_has_mfrac")) {
|
||||
// Use tall enough fraction to avoid side effect of min num/denum shifts.
|
||||
document.body.insertAdjacentHTML("beforeend", "<math>\
|
||||
<mfrac>\
|
||||
<mspace height='50px' depth='50px'></mspace>\
|
||||
<mspace height='50px' depth='50px'></mspace>\
|
||||
</mfrac>\
|
||||
<mfrac>\
|
||||
<mspace height='60px' depth='60px'></mspace>\
|
||||
<mspace height='60px' depth='60px'></mspace>\
|
||||
</mfrac>\
|
||||
</math>");
|
||||
var math = document.body.lastElementChild;
|
||||
var mfrac = math.getElementsByTagName("mfrac");
|
||||
// height/depth will add 40px per MathML, 20px if mfrac does not stack its children and none if mspace is not supported.
|
||||
this._has_mfrac =
|
||||
mfrac[1].getBoundingClientRect().height -
|
||||
mfrac[0].getBoundingClientRect().height > 30;
|
||||
document.body.removeChild(math);
|
||||
}
|
||||
return this._has_mfrac;
|
||||
},
|
||||
|
||||
has_msqrt: function() {
|
||||
if (!this.hasOwnProperty("_has_msqrt")) {
|
||||
document.body.insertAdjacentHTML("beforeend", "<math>\
|
||||
<mrow style='font-size: 20px !important'>\
|
||||
<mtext>A</mtext>\
|
||||
</mrow>\
|
||||
<msqrt style='font-size: 20px !important'>\
|
||||
<mtext>A</mtext>\
|
||||
</msqrt>\
|
||||
</math>");
|
||||
var math = document.body.lastElementChild;
|
||||
// The radical symbol will make msqrt wider than mrow, if the former is supported.
|
||||
this._has_msqrt =
|
||||
math.lastElementChild.getBoundingClientRect().width -
|
||||
math.firstElementChild.getBoundingClientRect().width > 5;
|
||||
document.body.removeChild(math);
|
||||
}
|
||||
return this._has_msqrt;
|
||||
},
|
||||
|
||||
has_menclose: function() {
|
||||
if (!this.hasOwnProperty("_has_menclose")) {
|
||||
document.body.insertAdjacentHTML("beforeend", "<math>\
|
||||
<mrow style='font-size: 20px !important'>\
|
||||
<mrow>\
|
||||
<mrow>\
|
||||
<mrow>\
|
||||
<mtext>A</mtext>\
|
||||
</mrow>\
|
||||
</mrow>\
|
||||
</mrow>\
|
||||
</mrow>\
|
||||
<menclose notation='box' style='font-size: 20px !important'>\
|
||||
<menclose notation='box'>\
|
||||
<menclose notation='box'>\
|
||||
<menclose notation='box'>\
|
||||
<mtext>A</mtext>\
|
||||
</menclose>\
|
||||
</menclose>\
|
||||
</menclose>\
|
||||
</menclose>\
|
||||
</math>");
|
||||
var math = document.body.lastElementChild;
|
||||
// The boxes will make menclose wider than mrow, if the former is supported.
|
||||
this._has_menclose =
|
||||
math.lastElementChild.getBoundingClientRect().width -
|
||||
math.firstElementChild.getBoundingClientRect().width > 5;
|
||||
document.body.removeChild(math);
|
||||
}
|
||||
return this._has_menclose;
|
||||
},
|
||||
|
||||
has_dir: function() {
|
||||
if (!this.hasOwnProperty("_has_dir")) {
|
||||
document.body.insertAdjacentHTML("beforeend", "<math style='direction: ltr !important;'>\
|
||||
<mtext dir='rtl'></mtext>\
|
||||
</math>");
|
||||
var math = document.body.lastElementChild;
|
||||
this._has_dir =
|
||||
window.getComputedStyle(math.firstElementChild).
|
||||
getPropertyValue('direction') === 'rtl';
|
||||
document.body.removeChild(math);
|
||||
}
|
||||
return this._has_dir;
|
||||
},
|
||||
|
||||
ensure_for_match_reftest: function(has_function) {
|
||||
if (!document.querySelector("link[rel='match']"))
|
||||
throw "This function must only be used for match reftest";
|
||||
// Add a little red square at the top left corner if the feature is not supported in order to make match reftest fail.
|
||||
if (!this[has_function]()) {
|
||||
document.body.insertAdjacentHTML("beforeend", "\
|
||||
<div style='width: 10px !important; height: 10px !important;\
|
||||
position: absolute !important;\
|
||||
left: 0 !important; top: 0 !important;\
|
||||
background: red !important; z-index: 1000 !important;'></div>");
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue