Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MathML test for movablelimits and displaystyle #23740

Merged
merged 2 commits into from May 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
83 changes: 83 additions & 0 deletions mathml/relations/css-styling/displaystyle-3.html
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>displaystyle</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/#the-displaystyle-and-scriptlevel-attributes">
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-math-style-property">
<meta name="assert" content="Verify the displaystyle of the underover element is considered (not the one of its base) to determine whether to move limits.">
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
math, math * {
font-family: Ahem;
font-size: 20px;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/feature-detection.js"></script>
<script>
setup({ explicit_done: true });
window.addEventListener("load", () => { document.fonts.ready.then(runTests); });
function runTests() {
["munder", "mover", "munderover"].forEach((tag) => {
Array.from(document.getElementsByTagName(tag)).forEach(e => {
var displaystyle = e.getAttribute('displaystyle') === "true";
test(function() {
assert_true(MathMLFeatureDetection.has_movablelimits());
var elementRight = e.getBoundingClientRect().right;
var baseRight = e.firstElementChild.getBoundingClientRect().right;
if (displaystyle)
assert_approx_equals(elementRight, baseRight, 1);
else
assert_greater_than(elementRight, baseRight + 10);
}, `movablelimits for ${tag} element (displaystyle=${displaystyle})`);
});
});
done();
}
</script>
</head>
<body>
<div id="log"></div>
<math>
<munder displaystyle="false">
<mo displaystyle="true" movablelimits="true">XX</mo>
<mtext>X</mtext>
</munder>
</math>
<math>
<mover displaystyle="false">
<mo displaystyle="true" movablelimits="true">XX</mo>
<mtext>X</mtext>
</mover>
</math>
<math>
<munderover displaystyle="false">
<mo displaystyle="true" movablelimits="true">XX</mo>
<mtext>X</mtext>
<mtext>X</mtext>
</munderover>
</math>
<math>
<munder displaystyle="true">
<mo displaystyle="false" movablelimits="true">XX</mo>
<mtext>X</mtext>
</munder>
</math>
<math>
<mover displaystyle="true">
<mo displaystyle="false" movablelimits="true">XX</mo>
<mtext>X</mtext>
</mover>
</math>
<math>
<munderover displaystyle="true">
<mo displaystyle="false" movablelimits="true">XX</mo>
<mtext>X</mtext>
<mtext>X</mtext>
</munderover>
</math>
</body>
</html>