OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Fraction 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 fraction parameter
s from 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-rulethickness1000; |
| 16 src: url("/fonts/math/fraction-axisheight7000-rulethickness1000.woff"); |
| 17 } |
| 18 @font-face { |
| 19 font-family: denominatordisplaystylegapmin5000-rulethickness1000; |
| 20 src: url("/fonts/math/fraction-denominatordisplaystylegapmin5000-rulethickne
ss1000.woff"); |
| 21 } |
| 22 @font-face { |
| 23 font-family: denominatordisplaystyleshiftdown6000-rulethickness1000; |
| 24 src: url("/fonts/math/fraction-denominatordisplaystyleshiftdown6000-rulethic
kness1000.woff"); |
| 25 } |
| 26 @font-face { |
| 27 font-family: denominatorgapmin4000-rulethickness1000; |
| 28 src: url("/fonts/math/fraction-denominatorgapmin4000-rulethickness1000.woff"
); |
| 29 } |
| 30 @font-face { |
| 31 font-family: denominatorshiftdown3000-rulethickness1000; |
| 32 src: url("/fonts/math/fraction-denominatorshiftdown3000-rulethickness1000.wo
ff"); |
| 33 } |
| 34 @font-face { |
| 35 font-family: numeratordisplaystylegapmin8000-rulethickness1000; |
| 36 src: url("/fonts/math/fraction-numeratordisplaystylegapmin8000-rulethickness
1000.woff"); |
| 37 } |
| 38 @font-face { |
| 39 font-family: numeratordisplaystyleshiftup2000-rulethickness1000; |
| 40 src: url("/fonts/math/fraction-numeratordisplaystyleshiftup2000-rulethicknes
s1000.woff"); |
| 41 } |
| 42 @font-face { |
| 43 font-family: numeratorgapmin9000-rulethickness1000; |
| 44 src: url("/fonts/math/fraction-numeratorgapmin9000-rulethickness1000.woff"); |
| 45 } |
| 46 @font-face { |
| 47 font-family: numeratorshiftup11000-rulethickness1000; |
| 48 src: url("/fonts/math/fraction-numeratorshiftup11000-rulethickness1000.woff"
); |
| 49 } |
| 50 @font-face { |
| 51 font-family: rulethickness10000; |
| 52 src: url("/fonts/math/fraction-rulethickness10000.woff"); |
| 53 } |
| 54 </style> |
| 55 <script> |
| 56 var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000 |
| 57 var epsilon = 1; |
| 58 |
| 59 function getBox(aId) { |
| 60 return document.getElementById(aId).getBoundingClientRect(); |
| 61 } |
| 62 |
| 63 setup({ explicit_done: true }); |
| 64 window.addEventListener("load", function() { |
| 65 document.fonts.ready.then(runTests); |
| 66 }); |
| 67 |
| 68 function runTests() { |
| 69 test(function() { |
| 70 var v1 = 7000 * emToPx; |
| 71 var v2 = 1000 * emToPx; |
| 72 assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom, |
| 73 v1 + v2 / 2, epsilon, "mfrac: axis height"); |
| 74 }, "AxisHeight"); |
| 75 |
| 76 test(function() { |
| 77 var v1 = 5000 * emToPx; |
| 78 assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom, |
| 79 v1, epsilon, "mfrac: denominator gap"); |
| 80 }, "DenominatorDisplayStyleGapMin"); |
| 81 |
| 82 test(function() { |
| 83 var v1 = 6000 * emToPx; |
| 84 assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom, |
| 85 v1, epsilon, "mfrac: denominator shift"); |
| 86 }, "DenominatorDisplayStyleShiftDown"); |
| 87 |
| 88 test(function() { |
| 89 var v1 = 4000 * emToPx; |
| 90 assert_approx_equals(getBox("den0004").top - getBox("ref0004").bottom, |
| 91 v1, epsilon, "mfrac: denominator gap"); |
| 92 }, "DenominatorGapMin"); |
| 93 |
| 94 test(function() { |
| 95 var v1 = 3000 * emToPx; |
| 96 assert_approx_equals(getBox("den0005").top - getBox("ref0005").bottom, |
| 97 v1, epsilon, "mfrac: denominator shift"); |
| 98 }, "DenominatorShiftDown"); |
| 99 |
| 100 test(function() { |
| 101 var v1 = 8000 * emToPx; |
| 102 assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom, |
| 103 v1, epsilon, "mfrac: numerator gap"); |
| 104 }, "NumeratorDisplayStyleGapMin"); |
| 105 |
| 106 test(function() { |
| 107 var v1 = 2000 * emToPx; |
| 108 assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom, |
| 109 v1, epsilon, "mfrac: numerator shift"); |
| 110 }, "NumeratorDisplayStyleShiftDown"); |
| 111 |
| 112 test(function() { |
| 113 var v1 = 9000 * emToPx; |
| 114 assert_approx_equals(getBox("ref0008").top - getBox("num0008").bottom, |
| 115 v1, epsilon, "mfrac: numerator gap"); |
| 116 }, "NumeratorGapMin"); |
| 117 |
| 118 test(function() { |
| 119 var v1 = 11000 * emToPx; |
| 120 assert_approx_equals(getBox("ref0009").top - getBox("num0009").bottom, |
| 121 v1, epsilon, "mfrac: numerator shift"); |
| 122 }, "NumeratorShiftDown"); |
| 123 |
| 124 test(function() { |
| 125 var v1 = 10000 * emToPx; |
| 126 assert_approx_equals(getBox("den0010").top - getBox("num0010").bottom, |
| 127 v1, epsilon, "mfrac: rule thickness"); |
| 128 }, "FractionRuleThickness"); |
| 129 |
| 130 done(); |
| 131 } |
| 132 </script> |
| 133 </head> |
| 134 <body> |
| 135 <p> |
| 136 <math style="font-family: axisheight7000-rulethickness1000;"> |
| 137 <mspace id="ref0001" depth="1em" width="3em" mathbackground="green"/> |
| 138 <mfrac> |
| 139 <mspace width="3em" height="1em" id="num0001" mathbackground="blue"/> |
| 140 <mspace width="3em"/> |
| 141 </mfrac> |
| 142 </math> |
| 143 </p> |
| 144 <hr/> |
| 145 <p> |
| 146 <math display="block" style="font-family: denominatordisplaystylegapmin5000-
rulethickness1000;"> |
| 147 <mspace id="ref0002" width="3em" |
| 148 height=".5em" depth=".5em" mathbackground="green"/> |
| 149 <mfrac> |
| 150 <mspace width="3em"/> |
| 151 <mspace width="3em" height="1em" id="den0002" mathbackground="blue"/> |
| 152 </mfrac> |
| 153 </math> |
| 154 </p> |
| 155 <hr/> |
| 156 <p> |
| 157 <math display="block" style="font-family: denominatordisplaystyleshiftdown60
00-rulethickness1000;"> |
| 158 <mspace id="ref0003" width="3em" height="1em" mathbackground="green"/> |
| 159 <mfrac> |
| 160 <mspace width="3em"/> |
| 161 <mspace width="3em" depth="1em" id="den0003" mathbackground="blue"/> |
| 162 </mfrac> |
| 163 </math> |
| 164 </p> |
| 165 <hr/> |
| 166 <p> |
| 167 <math style="font-family: denominatorgapmin4000-rulethickness1000;"> |
| 168 <mspace id="ref0004" width="3em" |
| 169 height=".5em" depth=".5em" mathbackground="green"/> |
| 170 <mfrac> |
| 171 <mspace width="3em"/> |
| 172 <mspace width="3em" height="1em" id="den0004" mathbackground="blue"/> |
| 173 </mfrac> |
| 174 </math> |
| 175 </p> |
| 176 <hr/> |
| 177 <p> |
| 178 <math style="font-family: denominatorshiftdown3000-rulethickness1000;"> |
| 179 <mspace id="ref0005" width="3em" height="1em" mathbackground="green"/> |
| 180 <mfrac> |
| 181 <mspace width="3em"/> |
| 182 <mspace width="3em" depth="1em" id="den0005" mathbackground="blue"/> |
| 183 </mfrac> |
| 184 </math> |
| 185 </p> |
| 186 <hr/> |
| 187 <p> |
| 188 <math display="block" style="font-family: numeratordisplaystylegapmin8000-ru
lethickness1000;"> |
| 189 <mspace id="ref0006" width="3em" |
| 190 height=".5em" depth=".5em" mathbackground="green"/> |
| 191 <mfrac> |
| 192 <mspace width="3em" depth="1em" id="num0006" mathbackground="blue"/> |
| 193 <mspace width="3em"/> |
| 194 </mfrac> |
| 195 </math> |
| 196 </p> |
| 197 <hr/> |
| 198 <p> |
| 199 <math display="block" style="font-family: numeratordisplaystyleshiftup2000-r
ulethickness1000;"> |
| 200 <mspace id="ref0007" width="3em" |
| 201 depth="1em" mathbackground="green"/> |
| 202 <mfrac> |
| 203 <mspace width="3em" height="1em" id="num0007" mathbackground="blue"/> |
| 204 <mspace width="3em"/> |
| 205 </mfrac> |
| 206 </math> |
| 207 </p> |
| 208 <hr/> |
| 209 <p> |
| 210 <math style="font-family: numeratorgapmin9000-rulethickness1000;"> |
| 211 <mspace id="ref0008" width="3em" |
| 212 height=".5em" depth=".5em" mathbackground="green"/> |
| 213 <mfrac> |
| 214 <mspace width="3em" depth="1em" id="num0008" mathbackground="blue"/> |
| 215 <mspace width="3em"/> |
| 216 </mfrac> |
| 217 </math> |
| 218 </p> |
| 219 <hr/> |
| 220 <p> |
| 221 <math style="font-family: numeratorshiftup11000-rulethickness1000;"> |
| 222 <mspace id="ref0009" width="3em" |
| 223 depth="1em" mathbackground="green"/> |
| 224 <mfrac> |
| 225 <mspace width="3em" height="1em" id="num0009" mathbackground="blue"/> |
| 226 <mspace width="3em"/> |
| 227 </mfrac> |
| 228 </math> |
| 229 </p> |
| 230 <hr/> |
| 231 <p> |
| 232 <math style="font-family: rulethickness10000"> |
| 233 <mfrac> |
| 234 <mspace width="3em" height="1em" id="num0010" mathbackground="blue"/> |
| 235 <mspace width="3em" depth="1em" id="den0010" mathbackground="green"/> |
| 236 </mfrac> |
| 237 </math> |
| 238 </p> |
| 239 <hr/> |
| 240 </body> |
| 241 </html> |
OLD | NEW |