Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>displaystyle</title>
<meta name="assert" content="Verify interaction between automatic displaystyle and specified displaystyle on descendants.">
<style>
@font-face {
font-family: TestFont;
src: url("/fonts/math/largeop-displayoperatorminheight5000.woff");
}
math, math * {
font-family: TestFont;
font-size: 10px;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/attribute-values.js"></script>
<script src="/mathml/support/fonts.js"></script>
<script>
setup({ explicit_done: true });
var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
var epsilon = 5;
function verify_displaystyle(elementId, displaystyle, description) {
var expectedSize = (displaystyle ? 5000 : 1000) * emToPx;
var elementSize = document.getElementById(elementId).
getBoundingClientRect().height;
assert_approx_equals(elementSize, expectedSize, epsilon, description);
}
window.addEventListener("load", () => { loadAllFonts().then(runTests); });
function runTests() {
for (transform in AttributeValueTransforms) {
TransformAttributeValues(transform, ["display", "displaystyle"]);
test(function() {
verify_displaystyle("cell_false", false, "cell with displaystyle false");
verify_displaystyle("cell_true", true, "cell with displaystyle true");
}, `mtable element (${transform})`);
test(function() {
verify_displaystyle("mfrac_numerator", true, "numerator");
verify_displaystyle("mfrac_denominator", true, "denominator");
}, `mfrac element (${transform})`);
test(function() {
verify_displaystyle("mroot_base", false, "base");
verify_displaystyle("mroot_index", true, "index");
}, `mroot element (${transform})`);
test(function() {
verify_displaystyle("msub_base", false, "base");
verify_displaystyle("msub_subscript", true, "subscript");
}, `msub element (${transform})`);
test(function() {
verify_displaystyle("msup_base", false, "base");
verify_displaystyle("msup_superscript", true, "superscript");
}, `msup element (${transform})`);
test(function() {
verify_displaystyle("msubsup_base", false, "base");
verify_displaystyle("msubsup_subscript", true, "subscript");
verify_displaystyle("msubsup_superscript", true, "superscript");
}, `msubsup element (${transform})`);
test(function() {
verify_displaystyle("munder_base", false, "base");
verify_displaystyle("munder_underscript", true, "underscript");
}, `munder element (${transform})`);
test(function() {
verify_displaystyle("mover_base", false, "base");
verify_displaystyle("mover_overscript", true, "overscript");
}, `mover element (${transform})`);
test(function() {
verify_displaystyle("munderover_base", false, "base");
verify_displaystyle("munderover_underscript", true, "underscript");
verify_displaystyle("munderover_overscript", true, "overscript");
}, `munderover element (${transform})`);
}
done();
}
</script>
</head>
<body>
<div id="log"></div>
<math displaystyle="true">
<mtable>
<mtr>
<mtd>
<mstyle displaystyle="false">
<mo id="cell_false">&#x2AFF;</mo>
</mstyle>
</mtd>
<mtd>
<mstyle displaystyle="true">
<mo id="cell_true">&#x2AFF;</mo>
</mstyle>
</mtd>
</mtr>
</mtable>
</math>
<math>
<mfrac>
<mstyle displaystyle="true">
<mo id="mfrac_numerator">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mfrac_denominator">&#x2AFF;</mo>
</mstyle>
</mfrac>
</math>
<math displaystyle="true">
<mroot>
<mstyle displaystyle="false">
<mo id="mroot_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mroot_index">&#x2AFF;</mo>
</mstyle>
</mroot>
</math>
<math displaystyle="true">
<msub>
<mstyle displaystyle="false">
<mo id="msub_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msub_subscript">&#x2AFF;</mo>
</mstyle>
</msub>
</math>
<math displaystyle="true">
<msup>
<mstyle displaystyle="false">
<mo id="msup_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msup_superscript">&#x2AFF;</mo>
</mstyle>
</msup>
</math>
<math displaystyle="true">
<msubsup>
<mstyle displaystyle="false">
<mo id="msubsup_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msubsup_subscript">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="msubsup_superscript">&#x2AFF;</mo>
</mstyle>
</msubsup>
</math>
<math displaystyle="true">
<mmultiscripts>
<mstyle displaystyle="false">
<mo id="mmultiscripts_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mmultiscripts_subscript">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mmultiscripts_superscript">&#x2AFF;</mo>
</mstyle>
<mprescripts/>
<mstyle displaystyle="true">
<mo id="mmultiscripts_presubscript">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mmultiscripts_presuperscript">&#x2AFF;</mo>
</mstyle>
</mmultiscripts>
</math>
<math displaystyle="true">
<munder>
<mstyle displaystyle="false">
<mo id="munder_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="munder_underscript">&#x2AFF;</mo>
</mstyle>
</munder>
</math>
<math displaystyle="true">
<mover>
<mstyle displaystyle="false">
<mo id="mover_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="mover_overscript">&#x2AFF;</mo>
</mstyle>
</mover>
</math>
<math displaystyle="true">
<munderover>
<mstyle displaystyle="false">
<mo id="munderover_base">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="munderover_underscript">&#x2AFF;</mo>
</mstyle>
<mstyle displaystyle="true">
<mo id="munderover_overscript">&#x2AFF;</mo>
</mstyle>
</munderover>
</math>
</body>
</html>