diff options
Diffstat (limited to 'layout/mathml/imptests')
23 files changed, 636 insertions, 0 deletions
diff --git a/layout/mathml/imptests/LICENSE b/layout/mathml/imptests/LICENSE new file mode 100644 index 0000000000..4047b54398 --- /dev/null +++ b/layout/mathml/imptests/LICENSE @@ -0,0 +1,32 @@ +Tests in this directory have been imported from +https://github.com/MathML/MathMLinHTML5-tests + + +Copyright (c) 2016 MathML Association +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. diff --git a/layout/mathml/imptests/fonts/fraction-axisheight7000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-axisheight7000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..0f2ae3bc12 --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-axisheight7000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..03e9b36885 --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..df6aab016a --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-denominatorgapmin4000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-denominatorgapmin4000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..c5ba7a6a78 --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-denominatorgapmin4000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-denominatorshiftdown3000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-denominatorshiftdown3000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..2c2b3d81b1 --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-denominatorshiftdown3000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..a899cc9d2c --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..d3fa259f9a --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-numeratorgapmin9000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-numeratorgapmin9000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..cceffbb5fa --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-numeratorgapmin9000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-numeratorshiftup11000-rulethickness1000.woff b/layout/mathml/imptests/fonts/fraction-numeratorshiftup11000-rulethickness1000.woff Binary files differnew file mode 100644 index 0000000000..20bd5f7d5e --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-numeratorshiftup11000-rulethickness1000.woff diff --git a/layout/mathml/imptests/fonts/fraction-rulethickness10000.woff b/layout/mathml/imptests/fonts/fraction-rulethickness10000.woff Binary files differnew file mode 100644 index 0000000000..8ac9828348 --- /dev/null +++ b/layout/mathml/imptests/fonts/fraction-rulethickness10000.woff diff --git a/layout/mathml/imptests/fonts/stack-axisheight7000.woff b/layout/mathml/imptests/fonts/stack-axisheight7000.woff Binary files differnew file mode 100644 index 0000000000..fa2e6f3aa6 --- /dev/null +++ b/layout/mathml/imptests/fonts/stack-axisheight7000.woff diff --git a/layout/mathml/imptests/fonts/stack-bottomdisplaystyleshiftdown5000.woff b/layout/mathml/imptests/fonts/stack-bottomdisplaystyleshiftdown5000.woff Binary files differnew file mode 100644 index 0000000000..2addfc4b29 --- /dev/null +++ b/layout/mathml/imptests/fonts/stack-bottomdisplaystyleshiftdown5000.woff diff --git a/layout/mathml/imptests/fonts/stack-bottomshiftdown6000.woff b/layout/mathml/imptests/fonts/stack-bottomshiftdown6000.woff Binary files differnew file mode 100644 index 0000000000..246154e2ea --- /dev/null +++ b/layout/mathml/imptests/fonts/stack-bottomshiftdown6000.woff diff --git a/layout/mathml/imptests/fonts/stack-displaystylegapmin4000.woff b/layout/mathml/imptests/fonts/stack-displaystylegapmin4000.woff Binary files differnew file mode 100644 index 0000000000..02dd515311 --- /dev/null +++ b/layout/mathml/imptests/fonts/stack-displaystylegapmin4000.woff diff --git a/layout/mathml/imptests/fonts/stack-gapmin8000.woff b/layout/mathml/imptests/fonts/stack-gapmin8000.woff Binary files differnew file mode 100644 index 0000000000..173907405b --- /dev/null +++ b/layout/mathml/imptests/fonts/stack-gapmin8000.woff diff --git a/layout/mathml/imptests/fonts/stack-topdisplaystyleshiftup3000.woff b/layout/mathml/imptests/fonts/stack-topdisplaystyleshiftup3000.woff Binary files differnew file mode 100644 index 0000000000..c8db7da1f7 --- /dev/null +++ b/layout/mathml/imptests/fonts/stack-topdisplaystyleshiftup3000.woff diff --git a/layout/mathml/imptests/fonts/stack-topshiftup9000.woff b/layout/mathml/imptests/fonts/stack-topshiftup9000.woff Binary files differnew file mode 100644 index 0000000000..8587906595 --- /dev/null +++ b/layout/mathml/imptests/fonts/stack-topshiftup9000.woff diff --git a/layout/mathml/imptests/fonts/xheight500.woff b/layout/mathml/imptests/fonts/xheight500.woff Binary files differnew file mode 100644 index 0000000000..fe9f88893a --- /dev/null +++ b/layout/mathml/imptests/fonts/xheight500.woff diff --git a/layout/mathml/imptests/mochitest.ini b/layout/mathml/imptests/mochitest.ini new file mode 100644 index 0000000000..ad92b49939 --- /dev/null +++ b/layout/mathml/imptests/mochitest.ini @@ -0,0 +1,26 @@ +[DEFAULT] + +[test_fraction-parameters.html] +support-files = + fonts/fraction-axisheight7000-rulethickness1000.woff + fonts/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff + fonts/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff + fonts/fraction-denominatorgapmin4000-rulethickness1000.woff + fonts/fraction-denominatorshiftdown3000-rulethickness1000.woff + fonts/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff + fonts/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff + fonts/fraction-numeratorgapmin9000-rulethickness1000.woff + fonts/fraction-numeratorshiftup11000-rulethickness1000.woff + fonts/fraction-rulethickness10000.woff +[test_lengths-3.html] +support-files = + fonts/xheight500.woff +[test_stack-parameters.html] +support-files = + fonts/stack-axisheight7000.woff + fonts/stack-bottomdisplaystyleshiftdown5000.woff + fonts/stack-bottomshiftdown6000.woff + fonts/stack-displaystylegapmin4000.woff + fonts/stack-gapmin8000.woff + fonts/stack-topdisplaystyleshiftup3000.woff + fonts/stack-topshiftup9000.woff diff --git a/layout/mathml/imptests/test_fraction-parameters.html b/layout/mathml/imptests/test_fraction-parameters.html new file mode 100644 index 0000000000..d067d01848 --- /dev/null +++ b/layout/mathml/imptests/test_fraction-parameters.html @@ -0,0 +1,244 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Fraction parameters</title> +<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#SS3.SSS2"> +<meta name="assert" content="Element mfrac correctly uses the fraction parameters from the MATH table."> +<!-- Copyright 2016 MathML Association + Licensed under 3-Clause BSD-License --> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + math, mspace { + font-size: 10px; + } + @font-face { + font-family: axisheight7000-rulethickness1000; + src: url("fonts/fraction-axisheight7000-rulethickness1000.woff"); + } + @font-face { + font-family: denominatordisplaystylegapmin5000-rulethickness1000; + src: url("fonts/fraction-denominatordisplaystylegapmin5000-rulethickness1000.woff"); + } + @font-face { + font-family: denominatordisplaystyleshiftdown6000-rulethickness1000; + src: url("fonts/fraction-denominatordisplaystyleshiftdown6000-rulethickness1000.woff"); + } + @font-face { + font-family: denominatorgapmin4000-rulethickness1000; + src: url("fonts/fraction-denominatorgapmin4000-rulethickness1000.woff"); + } + @font-face { + font-family: denominatorshiftdown3000-rulethickness1000; + src: url("fonts/fraction-denominatorshiftdown3000-rulethickness1000.woff"); + } + @font-face { + font-family: numeratordisplaystylegapmin8000-rulethickness1000; + src: url("fonts/fraction-numeratordisplaystylegapmin8000-rulethickness1000.woff"); + } + @font-face { + font-family: numeratordisplaystyleshiftup2000-rulethickness1000; + src: url("fonts/fraction-numeratordisplaystyleshiftup2000-rulethickness1000.woff"); + } + @font-face { + font-family: numeratorgapmin9000-rulethickness1000; + src: url("fonts/fraction-numeratorgapmin9000-rulethickness1000.woff"); + } + @font-face { + font-family: numeratorshiftup11000-rulethickness1000; + src: url("fonts/fraction-numeratorshiftup11000-rulethickness1000.woff"); + } + @font-face { + font-family: rulethickness10000; + src: url("fonts/fraction-rulethickness10000.woff"); + } +</style> +<script> + var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000 + var epsilon = 1; + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + var test_loaded = async_test("Page Loaded"); + window.addEventListener("load", function() { + // FIXME: Use an API to wait for the Web fonts to arrive. + window.setTimeout(runTests, 250); + }); + + function runTests() { + test(function() { + var v1 = 7000 * emToPx; + var v2 = 1000 * emToPx; + assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom, + v1 + v2 / 2, epsilon, "mfrac: axis height"); + }, "AxisHeight"); + + test(function() { + var v1 = 5000 * emToPx; + assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom, + v1, epsilon, "mfrac: denominator gap"); + }, "DenominatorDisplayStyleGapMin"); + + test(function() { + var v1 = 6000 * emToPx; + assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom, + v1, epsilon, "mfrac: denominator shift"); + }, "DenominatorDisplayStyleShiftDown"); + + test(function() { + var v1 = 4000 * emToPx; + assert_approx_equals(getBox("den0004").top - getBox("ref0004").bottom, + v1, epsilon, "mfrac: denominator gap"); + }, "DenominatorGapMin"); + + test(function() { + var v1 = 3000 * emToPx; + assert_approx_equals(getBox("den0005").top - getBox("ref0005").bottom, + v1, epsilon, "mfrac: denominator shift"); + }, "DenominatorShiftDown"); + + test(function() { + var v1 = 8000 * emToPx; + assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom, + v1, epsilon, "mfrac: numerator gap"); + }, "NumeratorDisplayStyleGapMin"); + + test(function() { + var v1 = 2000 * emToPx; + assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom, + v1, epsilon, "mfrac: numerator shift"); + }, "NumeratorDisplayStyleShiftDown"); + + test(function() { + var v1 = 9000 * emToPx; + assert_approx_equals(getBox("ref0008").top - getBox("num0008").bottom, + v1, epsilon, "mfrac: numerator gap"); + }, "NumeratorGapMin"); + + test(function() { + var v1 = 11000 * emToPx; + assert_approx_equals(getBox("ref0009").top - getBox("num0009").bottom, + v1, epsilon, "mfrac: numerator shift"); + }, "NumeratorShiftDown"); + + test(function() { + var v1 = 10000 * emToPx; + assert_approx_equals(getBox("den0010").top - getBox("num0010").bottom, + v1, epsilon, "mfrac: rule thickness"); + }, "FractionRuleThickness"); + + test_loaded.done(); + } +</script> +</head> +<body> + <p> + <math style="font-family: axisheight7000-rulethickness1000;"> + <mspace id="ref0001" depth="1em" width="3em" mathbackground="green"/> + <mfrac> + <mspace width="3em" height="1em" id="num0001" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math display="block" style="font-family: denominatordisplaystylegapmin5000-rulethickness1000;"> + <mspace id="ref0002" width="3em" + height=".5em" depth=".5em" mathbackground="green"/> + <mfrac> + <mspace width="3em"/> + <mspace width="3em" height="1em" id="den0002" mathbackground="blue"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math display="block" style="font-family: denominatordisplaystyleshiftdown6000-rulethickness1000;"> + <mspace id="ref0003" width="3em" height="1em" mathbackground="green"/> + <mfrac> + <mspace width="3em"/> + <mspace width="3em" depth="1em" id="den0003" mathbackground="blue"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: denominatorgapmin4000-rulethickness1000;"> + <mspace id="ref0004" width="3em" + height=".5em" depth=".5em" mathbackground="green"/> + <mfrac> + <mspace width="3em"/> + <mspace width="3em" height="1em" id="den0004" mathbackground="blue"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: denominatorshiftdown3000-rulethickness1000;"> + <mspace id="ref0005" width="3em" height="1em" mathbackground="green"/> + <mfrac> + <mspace width="3em"/> + <mspace width="3em" depth="1em" id="den0005" mathbackground="blue"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math display="block" style="font-family: numeratordisplaystylegapmin8000-rulethickness1000;"> + <mspace id="ref0006" width="3em" + height=".5em" depth=".5em" mathbackground="green"/> + <mfrac> + <mspace width="3em" depth="1em" id="num0006" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math display="block" style="font-family: numeratordisplaystyleshiftup2000-rulethickness1000;"> + <mspace id="ref0007" width="3em" + depth="1em" mathbackground="green"/> + <mfrac> + <mspace width="3em" height="1em" id="num0007" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: numeratorgapmin9000-rulethickness1000;"> + <mspace id="ref0008" width="3em" + height=".5em" depth=".5em" mathbackground="green"/> + <mfrac> + <mspace width="3em" depth="1em" id="num0008" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: numeratorshiftup11000-rulethickness1000;"> + <mspace id="ref0009" width="3em" + depth="1em" mathbackground="green"/> + <mfrac> + <mspace width="3em" height="1em" id="num0009" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: rulethickness10000"> + <mfrac> + <mspace width="3em" height="1em" id="num0010" mathbackground="blue"/> + <mspace width="3em" depth="1em" id="den0010" mathbackground="green"/> + </mfrac> + </math> + </p> + <hr/> +</body> +</html> diff --git a/layout/mathml/imptests/test_lengths-3.html b/layout/mathml/imptests/test_lengths-3.html new file mode 100644 index 0000000000..03a249a92b --- /dev/null +++ b/layout/mathml/imptests/test_lengths-3.html @@ -0,0 +1,158 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>MathML lengths</title> +<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S2.html#SS3.SSS1"/> +<meta name="assert" content="Verify various cases of the MathML length syntax."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + @font-face { + font-family: TestFont; + src: url("fonts/xheight500.woff"); + } + math { + font-family: TestFont; + font-size: 10px; + } +</style> +<script> + var epsilon = 2; + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + setup({ explicit_done: true }); + window.addEventListener("load", function() { + document.fonts.ready.then(runTests); + }); + + function runTests() { + test(function() { + assert_approx_equals(getBox("unitCm").width, 96, epsilon, "cm"); + assert_approx_equals(getBox("unitEm").width, 120, epsilon, "em"); + assert_approx_equals(getBox("unitEx").width, 500, epsilon, "ex"); + assert_approx_equals(getBox("unitIn").width, 288, epsilon, "in"); + assert_approx_equals(getBox("unitNamed").width, 389, epsilon, "namedspace"); + assert_approx_equals(getBox("unitMm").width, 576, epsilon, "mm"); + assert_approx_equals(getBox("unitPc").width, 96, epsilon, "pc"); + assert_approx_equals(getBox("unitPercentage").width, 60, epsilon, "%"); + assert_approx_equals(getBox("unitPt").width, 96, epsilon, "pt"); + assert_approx_equals(getBox("unitPx").width, 123, epsilon, "px"); + assert_approx_equals(getBox("unitNone").width, 150, epsilon, "Unitless"); + }, "Units"); + + test(function() { + assert_approx_equals(getBox("spaceCm").width, 96, epsilon, "cm"); + assert_approx_equals(getBox("spaceEm").width, 120, epsilon, "em"); + assert_approx_equals(getBox("spaceEx").width, 500, epsilon, "ex"); + assert_approx_equals(getBox("spaceIn").width, 288, epsilon, "in"); + assert_approx_equals(getBox("spaceNamed").width, 389, epsilon, "namedspace"); + assert_approx_equals(getBox("spaceMm").width, 576, epsilon, "mm"); + assert_approx_equals(getBox("spacePc").width, 96, epsilon, "pc"); + assert_approx_equals(getBox("spacePercentage").width, 60, epsilon, "%"); + assert_approx_equals(getBox("spacePt").width, 96, epsilon, "pt"); + assert_approx_equals(getBox("spacePx").width, 123, epsilon, "px"); + assert_approx_equals(getBox("spaceNone").width, 150, epsilon, "Unitless"); + }, "Trimming of space"); + + test(function() { + assert_approx_equals(getBox("n0").width, 0, epsilon, "n0"); + assert_approx_equals(getBox("n1").width, 90, epsilon, "n1"); + assert_approx_equals(getBox("n2").width, 8, epsilon, "n2"); + assert_approx_equals(getBox("n3").width, 70, epsilon, "n3"); + assert_approx_equals(getBox("n4").width, 650, epsilon, "n4"); + assert_approx_equals(getBox("n5").width, 4320, epsilon, "n5"); + assert_approx_equals(getBox("n6").width, 1, epsilon, "n6"); + assert_approx_equals(getBox("n7").width, 8, epsilon, "n7"); + assert_approx_equals(getBox("n8").width, 65, epsilon, "n8"); + assert_approx_equals(getBox("n9").width, 432, epsilon, "n9"); + assert_approx_equals(getBox("n10").width, 123, epsilon, "n10"); + }, "Non-negative numbers"); + + test(function() { + var topRef = getBox("ref").top; + assert_approx_equals(getBox("N0").top - topRef, -0, epsilon, "N0"); + assert_approx_equals(topRef - getBox("N1").top, -90, epsilon, "N1"); + assert_approx_equals(topRef - getBox("N2").top, -8, epsilon, "N2"); + assert_approx_equals(topRef - getBox("N3").top, -70, epsilon, "N3"); + assert_approx_equals(topRef - getBox("N4").top, -650, epsilon, "N4"); + assert_approx_equals(topRef - getBox("N5").top, -4320, epsilon, "N5"); + assert_approx_equals(topRef - getBox("N6").top, -1, epsilon, "N6"); + assert_approx_equals(topRef - getBox("N7").top, -8, epsilon, "N7"); + assert_approx_equals(topRef - getBox("N8").top, -65, epsilon, "N8"); + assert_approx_equals(topRef - getBox("N9").top, -432, epsilon, "N9"); + assert_approx_equals(topRef - getBox("N10").top, -123, epsilon, "N10"); + }, "Non-positive numbers"); + + done(); + } +</script> +</head> +<body> + <p> + <math> + <mspace id="unitCm" width="2.54cm"/> + <mspace id="unitEm" width="12em"/> + <mspace id="unitEx" width="100ex"/> + <mspace id="unitIn" width="3in"/> + <mspace style="font-size: 1000px" id="unitNamed" width="veryverythickmathspace"/> + <mspace id="unitMm" width="152.4mm"/> + <mspace id="unitPc" width="6pc"/> + <mstyle mathsize="200%"><mspace id="unitPercentage" width="3em"/></mstyle> + <mspace id="unitPt" width="72pt"/> + <mspace id="unitPx" width="123px"/> + <mstyle mathsize="5"><mspace id="unitNone" width="3em"/></mstyle> + </math> + </p> + <p> + <math> + <mspace id="spaceCm" width=" 	

 	

2.54cm 	

 	

"/> + <mspace id="spaceEm" width=" 	

 	

12em 	

 	

"/> + <mspace id="spaceEx" width=" 	

 	

100ex 	

 	

"/> + <mspace id="spaceIn" width=" 	

 	

3in 	

 	

"/> + <mspace style="font-size: 1000px" id="spaceNamed" width=" 	

 	

veryverythickmathspace 	

 	

"/> + <mspace id="spaceMm" width=" 	

 	

152.4mm 	

 	

"/> + <mspace id="spacePc" width=" 	

 	

6pc 	

 	

"/> + <mstyle mathsize="200%"><mspace id="spacePercentage" width=" 	

 	

3em 	

 	

"/></mstyle> + <mspace id="spacePt" width=" 	

 	

72pt 	

 	

"/> + <mspace id="spacePx" width=" 	

 	

123px 	

 	

"/> + <mstyle mathsize="5"><mspace id="spaceNone" width=" 	

 	

3em 	

 	

"/></mstyle> + </math> + </p> + <p> + <math> + <mspace id="n0" width="0em"/> + <mspace id="n1" width="9em"/> + <mspace id="n2" width=".8em"/> + <mspace id="n3" width="7.em"/> + <mspace id="n4" width="65em"/> + <mspace id="n5" width="432em"/> + <mspace id="n6" width=".10em"/> + <mspace id="n7" width=".789em"/> + <mspace id="n8" width="6.5em"/> + <mspace id="n9" width="43.21em"/> + <mspace id="n10" width="012.345em"/> + </math> + </p> + <p> + <math> + <mspace id="ref"></mspace> + <mpadded voffset="-0em"><mspace id="N0"/></mpadded> + <mpadded voffset="-9em"><mspace id="N1"/></mpadded> + <mpadded voffset="-.8em"><mspace id="N2"/></mpadded> + <mpadded voffset="-7.em"><mspace id="N3"/></mpadded> + <mpadded voffset="-65em"><mspace id="N4"/></mpadded> + <mpadded voffset="-432em"><mspace id="N5"/></mpadded> + <mpadded voffset="-.10em"><mspace id="N6"/></mpadded> + <mpadded voffset="-.789em"><mspace id="N7"/></mpadded> + <mpadded voffset="-6.5em"><mspace id="N8"/></mpadded> + <mpadded voffset="-43.21em"><mspace id="N9"/></mpadded> + <mpadded voffset="-012.345em"><mspace id="N10"/></mpadded> + </math> + </p> + <hr/> +</body> +</html> diff --git a/layout/mathml/imptests/test_stack-parameters.html b/layout/mathml/imptests/test_stack-parameters.html new file mode 100644 index 0000000000..784e7dfe8d --- /dev/null +++ b/layout/mathml/imptests/test_stack-parameters.html @@ -0,0 +1,176 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Stack parameters</title> +<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#SS3.SSS2"> +<meta name="assert" content="Element mfrac correctly uses the stack parameters from the MATH table."> +<!-- Copyright 2016 MathML Association + Licensed under 3-Clause BSD-License --> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + math, mspace { + font-size: 10px; + } + @font-face { + font-family: axisheight7000; + src: url("fonts/stack-axisheight7000.woff"); + } + @font-face { + font-family: bottomdisplaystyleshiftdown5000; + src: url("fonts/stack-bottomdisplaystyleshiftdown5000.woff"); + } + @font-face { + font-family: bottomshiftdown6000; + src: url("fonts/stack-bottomshiftdown6000.woff"); + } + @font-face { + font-family: displaystylegapmin4000; + src: url("fonts/stack-displaystylegapmin4000.woff"); + } + @font-face { + font-family: gapmin8000; + src: url("fonts/stack-gapmin8000.woff"); + } + @font-face { + font-family: topdisplaystyleshiftup3000; + src: url("fonts/stack-topdisplaystyleshiftup3000.woff"); + } + @font-face { + font-family: topshiftup9000; + src: url("fonts/stack-topshiftup9000.woff"); + } +</style> +<script> + var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000 + var epsilon = 1; + + function getBox(aId) { + return document.getElementById(aId).getBoundingClientRect(); + } + + var test_loaded = async_test("Page Loaded"); + window.addEventListener("load", function() { + // FIXME: Use an API to wait for the Web fonts to arrive. + window.setTimeout(runTests, 250); + }); + + function runTests() { + test(function() { + var v = 7000 * emToPx; + assert_approx_equals(getBox("ref0001").top - getBox("num0001").bottom, + v, epsilon, "mfrac: axis height"); + }, "AxisHeight"); + + test(function() { + var v = 5000 * emToPx; + assert_approx_equals(getBox("den0002").top - getBox("ref0002").bottom, + v, epsilon, "mfrac: denominator shift"); + }, "BottomDisplayStyleShiftDown"); + + test(function() { + var v = 6000 * emToPx; + assert_approx_equals(getBox("den0003").top - getBox("ref0003").bottom, + v, epsilon, "mfrac: denominator shift"); + }, "BottomShiftDown"); + + test(function() { + var v = 4000 * emToPx; + assert_approx_equals(getBox("den0004").top - getBox("num0004").bottom, + v, epsilon, "mfrac: gap"); + }, "DisplayStyleGapMin"); + + test(function() { + var v = 8000 * emToPx; + assert_approx_equals(getBox("den0005").top - getBox("num0005").bottom, + v, epsilon, "mfrac: gap"); + }, "GapMin"); + + test(function() { + var v = 3000 * emToPx; + assert_approx_equals(getBox("ref0006").top - getBox("num0006").bottom, + v, epsilon, "mfrac: numerator shift"); + }, "TopDisplayStyleShiftUp"); + + test(function() { + var v = 9000 * emToPx; + assert_approx_equals(getBox("ref0007").top - getBox("num0007").bottom, + v, epsilon, "mfrac: numerator shift"); + }, "ToShiftUp"); + + test_loaded.done(); + } +</script> +</head> +<body> + <p> + <math style="font-family: axisheight7000;"> + <mspace id="ref0001" depth="1em" width="3em" mathbackground="green"/> + <mfrac linethickness="0px"> + <mspace width="3em" height="1em" id="num0001" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math display="block" style="font-family: bottomdisplaystyleshiftdown5000;"> + <mspace id="ref0002" width="3em" height="1em" mathbackground="green"/> + <mfrac linethickness="0px"> + <mspace width="3em"/> + <mspace width="3em" depth="1em" id="den0002" mathbackground="blue"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: bottomshiftdown6000;"> + <mspace id="ref0003" width="3em" height="1em" mathbackground="green"/> + <mfrac linethickness="0px"> + <mspace width="3em"/> + <mspace width="3em" depth="1em" id="den0003" mathbackground="blue"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math display="block" style="font-family: displaystylegapmin4000;"> + <mfrac linethickness="0px"> + <mspace width="3em" height="1em" id="num0004" mathbackground="blue"/> + <mspace width="3em" depth="1em" id="den0004" mathbackground="green"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: gapmin8000;"> + <mfrac linethickness="0px"> + <mspace width="3em" height="1em" id="num0005" mathbackground="blue"/> + <mspace width="3em" depth="1em" id="den0005" mathbackground="green"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math display="block" style="font-family: topdisplaystyleshiftup3000;"> + <mspace id="ref0006" width="3em" depth="1em" mathbackground="green"/> + <mfrac linethickness="0px"> + <mspace width="3em" height="1em" id="num0006" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> + <p> + <math style="font-family: topshiftup9000;"> + <mspace id="ref0007" width="3em" depth="1em" mathbackground="green"/> + <mfrac linethickness="0px"> + <mspace width="3em" height="1em" id="num0007" mathbackground="blue"/> + <mspace width="3em"/> + </mfrac> + </math> + </p> + <hr/> +</body> +</html> |