OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>displaystyle</title> |
| 6 <link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S2.html#S
S3.SSS1"> |
| 7 <meta name="assert" content="Verify that the correct inheritance of the displays
tyle value by measuring the size of large operators."> |
| 8 <style> |
| 9 @font-face { |
| 10 font-family: TestFont; |
| 11 src: url("/fonts/math/largeop-displayoperatorminheight5000.woff"); |
| 12 } |
| 13 math { |
| 14 font-family: TestFont; |
| 15 font-size: 10px; |
| 16 } |
| 17 </style> |
| 18 <script src="/resources/testharness.js"></script> |
| 19 <script src="/resources/testharnessreport.js"></script> |
| 20 <script> |
| 21 setup({ explicit_done: true }); |
| 22 var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000 |
| 23 var epsilon = 5; |
| 24 function verify_displaystyle(element, displaystyle, description) { |
| 25 if (typeof element === "string") |
| 26 element = document.getElementById(element); |
| 27 var elementSize = element.getBoundingClientRect().height; |
| 28 if (displaystyle) |
| 29 assert_approx_equals(elementSize, 5000 * emToPx, epsilon, description); |
| 30 else |
| 31 assert_approx_equals(elementSize, 1000 * emToPx, epsilon, description); |
| 32 } |
| 33 |
| 34 window.addEventListener("load", function() { |
| 35 document.fonts.ready.then(runTests); |
| 36 }); |
| 37 |
| 38 function runTests() { |
| 39 test(function() { |
| 40 verify_displaystyle("math_default", false, "default"); |
| 41 verify_displaystyle("math_inline", false, "explicit display inline"); |
| 42 verify_displaystyle("math_block", true, "explicit display block"); |
| 43 verify_displaystyle("math_false", false, "explicit displaystyle false"); |
| 44 verify_displaystyle("math_true", true, "explicit displaystyle true"); |
| 45 }, "math element"); |
| 46 test(function() { |
| 47 verify_displaystyle("mstyle_false", false, "explicit displaystyle false"); |
| 48 verify_displaystyle("mstyle_true", true, "explicit displaystyle true"); |
| 49 }, "mstyle element"); |
| 50 test(function() { |
| 51 verify_displaystyle("mtable_default", false, "default"); |
| 52 verify_displaystyle("mtable_false", false, "explicit displaystyle false"); |
| 53 verify_displaystyle("mtable_true", true, "explicit displaystyle true"); |
| 54 }, "mtable element"); |
| 55 test(function() { |
| 56 verify_displaystyle("mfrac_numerator", false, "numerator"); |
| 57 verify_displaystyle("mfrac_denominator", false, "denominator"); |
| 58 }, "mfrac element"); |
| 59 test(function() { |
| 60 verify_displaystyle("mroot_base", true, "base"); |
| 61 verify_displaystyle("mroot_index", false, "index"); |
| 62 }, "mroot element"); |
| 63 test(function() { |
| 64 verify_displaystyle("msub_base", true, "base"); |
| 65 verify_displaystyle("msub_subscript", false, "subscript"); |
| 66 }, "msub element"); |
| 67 test(function() { |
| 68 verify_displaystyle("msup_base", true, "base"); |
| 69 verify_displaystyle("msup_supscript", false, "supscript"); |
| 70 }, "msup element"); |
| 71 test(function() { |
| 72 verify_displaystyle("msubsup_base", true, "base"); |
| 73 verify_displaystyle("msubsup_subscript", false, "subscript"); |
| 74 verify_displaystyle("msubsup_supscript", false, "supscript"); |
| 75 }, "msubsup element"); |
| 76 test(function() { |
| 77 verify_displaystyle("munder_base", true, "base"); |
| 78 verify_displaystyle("munder_underscript", false, "underscript"); |
| 79 }, "munder element"); |
| 80 test(function() { |
| 81 verify_displaystyle("mover_base", true, "base"); |
| 82 verify_displaystyle("mover_overscript", false, "overscript"); |
| 83 }, "mover element"); |
| 84 test(function() { |
| 85 verify_displaystyle("munderover_base", true, "base"); |
| 86 verify_displaystyle("munderover_underscript", false, "underscript"); |
| 87 verify_displaystyle("munderover_overscript", false, "overscript"); |
| 88 }, "munderover element"); |
| 89 done(); |
| 90 } |
| 91 </script> |
| 92 </head> |
| 93 <body> |
| 94 <math><mo id="math_default">⫿</mo></math> |
| 95 <math display="inline"><mo id="math_inline">⫿</mo></math> |
| 96 <math display="block"><mo id="math_block">⫿</mo></math> |
| 97 <math displaystyle="false"><mo id="math_false">⫿</mo></math> |
| 98 <math displaystyle="true"><mo id="math_true">⫿</mo></math> |
| 99 <math><mstyle displaystyle="false"><mo id="mstyle_false">⫿</mo></mstyle
></math> |
| 100 <math><mstyle displaystyle="true"><mo id="mstyle_true">⫿</mo></mstyle><
/math> |
| 101 <math displaystyle="true"><mtable><mtr><mtd><mo id="mtable_default">⫿</
mo></mtd></mtr></mtable></math> |
| 102 <math><mtable displaystyle="true"><mtr><mtd><mo id="mtable_true">⫿</mo>
</mtd></mtr></mtable></math> |
| 103 <math displaystyle="true"><mtable displaystyle="false"><mtr><mtd><mo id="mtabl
e_false">⫿</mo></mtd></mtr></mtable></math> |
| 104 <math displaystyle="true"><mfrac><mo id="mfrac_numerator">⫿</mo><mo id=
"mfrac_denominator">⫿</mo></mfrac></math> |
| 105 <math displaystyle="true"><mroot><mo id="mroot_base">⫿</mo><mo id="mroo
t_index">⫿</mo></mroot></math> |
| 106 <math displaystyle="true"><msub><mo id="msub_base">⫿</mo><mo id="msub_s
ubscript">⫿</mo></msub></math> |
| 107 <math displaystyle="true"><msup><mo id="msup_base">⫿</mo><mo id="msup_s
upscript">⫿</mo></msup></math> |
| 108 <math displaystyle="true"><msubsup><mo id="msubsup_base">⫿</mo><mo id="
msubsup_subscript">⫿</mo><mo id="msubsup_supscript">⫿</mo></msubsu
p></math> |
| 109 <math displaystyle="true"><mmultiscripts><mo id="mmultiscripts_base">⫿<
/mo><mo id="mmultiscripts_subscript">⫿</mo><mo id="mmultiscripts_supscrip
t">⫿</mo><mprescripts/><mo id="mmultiscripts_presubscript">⫿</mo><
mo id="mmultiscripts_presupscript">⫿</mo></mmultiscripts></math> |
| 110 <math displaystyle="true"><munder><mo id="munder_base">⫿</mo><mo id="mu
nder_underscript">⫿</mo></munder></math> |
| 111 <math displaystyle="true"><mover><mo id="mover_base">⫿</mo><mo id="move
r_overscript">⫿</mo></mover></math> |
| 112 <math displaystyle="true"><munderover><mo id="munderover_base">⫿</mo><m
o id="munderover_underscript">⫿</mo><mo id="munderover_overscript">ʯ
F;</mo></munderover></math> |
| 113 </body> |
| 114 </html> |
OLD | NEW |