OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Stack parameters</title> |
| 6 <link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#S
S3.SSS2"> |
| 7 <meta name="assert" content="Element mfrac correctly uses the stack parameters f
rom the MATH table."> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <style> |
| 11 math, mspace { |
| 12 font-size: 10px; |
| 13 } |
| 14 @font-face { |
| 15 font-family: axisheight7000; |
| 16 src: url("/fonts/math/stack-axisheight7000.woff"); |
| 17 } |
| 18 @font-face { |
| 19 font-family: bottomdisplaystyleshiftdown5000; |
| 20 src: url("/fonts/math/stack-bottomdisplaystyleshiftdown5000.woff"); |
| 21 } |
| 22 @font-face { |
| 23 font-family: bottomshiftdown6000; |
| 24 src: url("/fonts/math/stack-bottomshiftdown6000.woff"); |
| 25 } |
| 26 @font-face { |
| 27 font-family: displaystylegapmin4000; |
| 28 src: url("/fonts/math/stack-displaystylegapmin4000.woff"); |
| 29 } |
| 30 @font-face { |
| 31 font-family: gapmin8000; |
| 32 src: url("/fonts/math/stack-gapmin8000.woff"); |
| 33 } |
| 34 @font-face { |
| 35 font-family: topdisplaystyleshiftup3000; |
| 36 src: url("/fonts/math/stack-topdisplaystyleshiftup3000.woff"); |
| 37 } |
| 38 @font-face { |
| 39 font-family: topshiftup9000; |
| 40 src: url("/fonts/math/stack-topshiftup9000.woff"); |
| 41 } |
| 42 </style> |
| 43 <script> |
| 44 var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000 |
| 45 var epsilon = 1; |
| 46 |
| 47 function getBox(aId) { |
| 48 return document.getElementById(aId).getBoundingClientRect(); |
| 49 } |
| 50 |
| 51 setup({ explicit_done: true }); |
| 52 window.addEventListener("load", function() { |
| 53 document.fonts.ready.then(runTests); |
| 54 }); |
| 55 |
| 56 function runTests() { |
| 57 test(function() { |
| 58 var v = 7000 * emToPx; |
| 59 assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom, |
| 60 v, epsilon, "mfrac: axis height"); |
| 61 }, "AxisHeight"); |
| 62 |
| 63 test(function() { |
| 64 var v = 5000 * emToPx; |
| 65 assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom, |
| 66 v, epsilon, "mfrac: denominator shift"); |
| 67 }, "BottomDisplayStyleShiftDown"); |
| 68 |
| 69 test(function() { |
| 70 var v = 6000 * emToPx; |
| 71 assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom, |
| 72 v, epsilon, "mfrac: denominator shift"); |
| 73 }, "BottomShiftDown"); |
| 74 |
| 75 test(function() { |
| 76 var v = 4000 * emToPx; |
| 77 assert_approx_equals(getBox("den0004").top - getBox("num0004").bottom, |
| 78 v, epsilon, "mfrac: gap"); |
| 79 }, "DisplayStyleGapMin"); |
| 80 |
| 81 test(function() { |
| 82 var v = 8000 * emToPx; |
| 83 assert_approx_equals(getBox("den0005").top - getBox("num0005").bottom, |
| 84 v, epsilon, "mfrac: gap"); |
| 85 }, "GapMin"); |
| 86 |
| 87 test(function() { |
| 88 var v = 3000 * emToPx; |
| 89 assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom, |
| 90 v, epsilon, "mfrac: numerator shift"); |
| 91 }, "TopDisplayStyleShiftUp"); |
| 92 |
| 93 test(function() { |
| 94 var v = 9000 * emToPx; |
| 95 assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom, |
| 96 v, epsilon, "mfrac: numerator shift"); |
| 97 }, "ToShiftUp"); |
| 98 |
| 99 done(); |
| 100 } |
| 101 </script> |
| 102 </head> |
| 103 <body> |
| 104 <p> |
| 105 <math style="font-family: axisheight7000;"> |
| 106 <mspace id="ref0001" depth="1em" width="3em" mathbackground="green"/> |
| 107 <mfrac linethickness="0px"> |
| 108 <mspace width="3em" height="1em" id="num0001" mathbackground="blue"/> |
| 109 <mspace width="3em"/> |
| 110 </mfrac> |
| 111 </math> |
| 112 </p> |
| 113 <hr/> |
| 114 <p> |
| 115 <math display="block" style="font-family: bottomdisplaystyleshiftdown5000;"> |
| 116 <mspace id="ref0002" width="3em" height="1em" mathbackground="green"/> |
| 117 <mfrac linethickness="0px"> |
| 118 <mspace width="3em"/> |
| 119 <mspace width="3em" depth="1em" id="den0002" mathbackground="blue"/> |
| 120 </mfrac> |
| 121 </math> |
| 122 </p> |
| 123 <hr/> |
| 124 <p> |
| 125 <math style="font-family: bottomshiftdown6000;"> |
| 126 <mspace id="ref0003" width="3em" height="1em" mathbackground="green"/> |
| 127 <mfrac linethickness="0px"> |
| 128 <mspace width="3em"/> |
| 129 <mspace width="3em" depth="1em" id="den0003" mathbackground="blue"/> |
| 130 </mfrac> |
| 131 </math> |
| 132 </p> |
| 133 <hr/> |
| 134 <p> |
| 135 <math display="block" style="font-family: displaystylegapmin4000;"> |
| 136 <mfrac linethickness="0px"> |
| 137 <mspace width="3em" height="1em" id="num0004" mathbackground="blue"/> |
| 138 <mspace width="3em" depth="1em" id="den0004" mathbackground="green"/> |
| 139 </mfrac> |
| 140 </math> |
| 141 </p> |
| 142 <hr/> |
| 143 <p> |
| 144 <math style="font-family: gapmin8000;"> |
| 145 <mfrac linethickness="0px"> |
| 146 <mspace width="3em" height="1em" id="num0005" mathbackground="blue"/> |
| 147 <mspace width="3em" depth="1em" id="den0005" mathbackground="green"/> |
| 148 </mfrac> |
| 149 </math> |
| 150 </p> |
| 151 <hr/> |
| 152 <p> |
| 153 <math display="block" style="font-family: topdisplaystyleshiftup3000;"> |
| 154 <mspace id="ref0006" width="3em" depth="1em" mathbackground="green"/> |
| 155 <mfrac linethickness="0px"> |
| 156 <mspace width="3em" height="1em" id="num0006" mathbackground="blue"/> |
| 157 <mspace width="3em"/> |
| 158 </mfrac> |
| 159 </math> |
| 160 </p> |
| 161 <hr/> |
| 162 <p> |
| 163 <math style="font-family: topshiftup9000;"> |
| 164 <mspace id="ref0007" width="3em" depth="1em" mathbackground="green"/> |
| 165 <mfrac linethickness="0px"> |
| 166 <mspace width="3em" height="1em" id="num0007" mathbackground="blue"/> |
| 167 <mspace width="3em"/> |
| 168 </mfrac> |
| 169 </math> |
| 170 </p> |
| 171 <hr/> |
| 172 </body> |
| 173 </html> |
OLD | NEW |