| <!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 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">⫿</mo> |
| </mstyle> |
| </mtd> |
| <mtd> |
| <mstyle displaystyle="true"> |
| <mo id="cell_true">⫿</mo> |
| </mstyle> |
| </mtd> |
| </mtr> |
| </mtable> |
| </math> |
| <math> |
| <mfrac> |
| <mstyle displaystyle="true"> |
| <mo id="mfrac_numerator">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="mfrac_denominator">⫿</mo> |
| </mstyle> |
| </mfrac> |
| </math> |
| <math displaystyle="true"> |
| <mroot> |
| <mstyle displaystyle="false"> |
| <mo id="mroot_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="mroot_index">⫿</mo> |
| </mstyle> |
| </mroot> |
| </math> |
| <math displaystyle="true"> |
| <msub> |
| <mstyle displaystyle="false"> |
| <mo id="msub_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="msub_subscript">⫿</mo> |
| </mstyle> |
| </msub> |
| </math> |
| <math displaystyle="true"> |
| <msup> |
| <mstyle displaystyle="false"> |
| <mo id="msup_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="msup_superscript">⫿</mo> |
| </mstyle> |
| </msup> |
| </math> |
| <math displaystyle="true"> |
| <msubsup> |
| <mstyle displaystyle="false"> |
| <mo id="msubsup_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="msubsup_subscript">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="msubsup_superscript">⫿</mo> |
| </mstyle> |
| </msubsup> |
| </math> |
| <math displaystyle="true"> |
| <mmultiscripts> |
| <mstyle displaystyle="false"> |
| <mo id="mmultiscripts_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="mmultiscripts_subscript">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="mmultiscripts_superscript">⫿</mo> |
| </mstyle> |
| <mprescripts/> |
| <mstyle displaystyle="true"> |
| <mo id="mmultiscripts_presubscript">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="mmultiscripts_presuperscript">⫿</mo> |
| </mstyle> |
| </mmultiscripts> |
| </math> |
| <math displaystyle="true"> |
| <munder> |
| <mstyle displaystyle="false"> |
| <mo id="munder_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="munder_underscript">⫿</mo> |
| </mstyle> |
| </munder> |
| </math> |
| <math displaystyle="true"> |
| <mover> |
| <mstyle displaystyle="false"> |
| <mo id="mover_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="mover_overscript">⫿</mo> |
| </mstyle> |
| </mover> |
| </math> |
| <math displaystyle="true"> |
| <munderover> |
| <mstyle displaystyle="false"> |
| <mo id="munderover_base">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="munderover_underscript">⫿</mo> |
| </mstyle> |
| <mstyle displaystyle="true"> |
| <mo id="munderover_overscript">⫿</mo> |
| </mstyle> |
| </munderover> |
| </math> |
| </body> |
| </html> |