OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Underscripts and Overscripts parameters</title> |
| 6 <link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#S
S4"> |
| 7 <meta name="assert" content="Elements munder, mover, munderover correctly use th
e stretch stack parameters from the MATH table."> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <style> |
| 11 math, mspace, mo { |
| 12 font-size: 10px; |
| 13 } |
| 14 @font-face { |
| 15 font-family: bottomshiftdown3000; |
| 16 src: url("/fonts/math/stretchstack-bottomshiftdown3000.woff"); |
| 17 } |
| 18 @font-face { |
| 19 font-family: gapbelowmin11000; |
| 20 src: url("/fonts/math/stretchstack-gapbelowmin11000.woff"); |
| 21 } |
| 22 @font-face { |
| 23 font-family: topshiftup5000; |
| 24 src: url("/fonts/math/stretchstack-topshiftup5000.woff"); |
| 25 } |
| 26 @font-face { |
| 27 font-family: gapabovemin7000; |
| 28 src: url("/fonts/math/stretchstack-gapabovemin7000.woff"); |
| 29 } |
| 30 </style> |
| 31 <script> |
| 32 var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000 |
| 33 var epsilon = 1; |
| 34 |
| 35 function getBox(aId) { |
| 36 return document.getElementById(aId).getBoundingClientRect(); |
| 37 } |
| 38 |
| 39 setup({ explicit_done: true }); |
| 40 window.addEventListener("load", function() { |
| 41 document.fonts.ready.then(runTests); |
| 42 }); |
| 43 |
| 44 function runTests() { |
| 45 test(function() { |
| 46 var v = 3000 * emToPx; |
| 47 assert_approx_equals(getBox("under00011").top - getBox("ref0001").bottom, |
| 48 v, epsilon, "munder: under shift"); |
| 49 assert_approx_equals(getBox("under00012").top - getBox("ref0001").bottom, |
| 50 v, epsilon, "munderover: under shift"); |
| 51 }, "StretchStackBottomShiftDown"); |
| 52 |
| 53 test(function() { |
| 54 var v = 11000 * emToPx; |
| 55 assert_approx_equals(getBox("under00021").top - getBox("ref0002").bottom, |
| 56 v, epsilon, "munder: under gap"); |
| 57 assert_approx_equals(getBox("under00022").top - getBox("ref0002").bottom, |
| 58 v, epsilon, "munderover: under gap"); |
| 59 }, "StretchStackGapBelowMin"); |
| 60 |
| 61 test(function() { |
| 62 var v = 5000 * emToPx; |
| 63 assert_approx_equals(getBox("ref0003").top - getBox("over00031").bottom, |
| 64 v, epsilon, "mover: over shift"); |
| 65 assert_approx_equals(getBox("ref0003").top - getBox("over00032").bottom, |
| 66 v, epsilon, "munderover: over shift"); |
| 67 }, "StretchStackTopShiftUp"); |
| 68 |
| 69 test(function() { |
| 70 var v = 7000 * emToPx; |
| 71 assert_approx_equals(getBox("ref0004").top - getBox("over00041").bottom, |
| 72 v, epsilon, "mover: over shift"); |
| 73 assert_approx_equals(getBox("ref0004").top - getBox("over00042").bottom, |
| 74 v, epsilon, "munderover: over shift"); |
| 75 }, "StretchStackGapAboveMin"); |
| 76 |
| 77 done(); |
| 78 } |
| 79 </script> |
| 80 </head> |
| 81 <body> |
| 82 <p> |
| 83 <math style="font-family: bottomshiftdown3000;"> |
| 84 <mspace id="ref0001" height="1em" width="3em" mathbackground="green"/> |
| 85 <munder> |
| 86 <mo>→</mo> |
| 87 <mspace id="under00011" depth="1em" width="3em" mathbackground="blue"/
> |
| 88 </munder> |
| 89 <munderover> |
| 90 <mo>→</mo> |
| 91 <mspace id="under00012" depth="1em" width="3em" mathbackground="blue"/
> |
| 92 <mspace height="1em" width="3em" mathbackground="black"/> |
| 93 </munderover> |
| 94 </math> |
| 95 </p> |
| 96 <hr/> |
| 97 <p> |
| 98 <math style="font-family: gapbelowmin11000;"> |
| 99 <mspace id="ref0002" height="1em" width="3em" mathbackground="green"/> |
| 100 <munder> |
| 101 <mo>→</mo> |
| 102 <mspace id="under00021" depth="1em" width="3em" mathbackground="blue"/
> |
| 103 </munder> |
| 104 <munderover> |
| 105 <mo>→</mo> |
| 106 <mspace id="under00022" depth="1em" width="3em" mathbackground="blue"/
> |
| 107 <mspace height="1em" width="3em" mathbackground="black"/> |
| 108 </munderover> |
| 109 </math> |
| 110 </p> |
| 111 <hr/> |
| 112 <p> |
| 113 <math style="font-family: topshiftup5000;"> |
| 114 <mspace id="ref0003" height="1em" width="3em" mathbackground="green"/> |
| 115 <mover> |
| 116 <mo>→</mo> |
| 117 <mspace id="over00031" height="1em" width="3em" mathbackground="blue"/
> |
| 118 </mover> |
| 119 <munderover> |
| 120 <mo>→</mo> |
| 121 <mspace height="1em" width="3em" mathbackground="black"/> |
| 122 <mspace id="over00032" height="1em" width="3em" mathbackground="blue"/
> |
| 123 </munderover> |
| 124 </math> |
| 125 </p> |
| 126 <hr/> |
| 127 <p> |
| 128 <math style="font-family: gapabovemin7000;"> |
| 129 <mspace id="ref0004" height="1em" width="3em" mathbackground="green"/> |
| 130 <mover> |
| 131 <mo>→</mo> |
| 132 <mspace id="over00041" depth="1em" width="3em" mathbackground="blue"/> |
| 133 </mover> |
| 134 <munderover> |
| 135 <mo>→</mo> |
| 136 <mspace height="1em" width="3em" mathbackground="black"/> |
| 137 <mspace id="over00042" depth="1em" width="3em" mathbackground="blue"/> |
| 138 </munderover> |
| 139 </math> |
| 140 </p> |
| 141 <hr/> |
| 142 </body> |
| 143 </html> |
OLD | NEW |