diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/mathml/tests/test_bug975681.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/mathml/tests/test_bug975681.html')
-rw-r--r-- | layout/mathml/tests/test_bug975681.html | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/layout/mathml/tests/test_bug975681.html b/layout/mathml/tests/test_bug975681.html new file mode 100644 index 000000000..854693ead --- /dev/null +++ b/layout/mathml/tests/test_bug975681.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=975681 +--> + <head> + <meta charset="utf-8"> + <title> Test for Bug 975681 </title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"> </script> + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"> </script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + </head> + <body> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=975681"> Mozilla Bug 975681 </a> + <p id="display"></p> + + <p> + <math> + <mfrac id="test_mfrac"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac linethickness="30px" id="mfrac_linethickness"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac numalign="left" id="mfrac_numalign"> + <mspace width="50px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac denomalign="right" id="mfrac_denomalign"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="50px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <p> + <math> + <mfrac bevelled="true" id="mfrac_bevelled"> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + <mspace width="100px" height="20px" mathbackground="red"></mspace> + </mfrac> + </math> + </p> + + <pre id="test"> + <script type="application/javascript"> + + /** Test for Bug 975681 **/ + SimpleTest.waitForExplicitFinish(); + + var epsilon = 1; // allow a small relative error + var delta = .25; // used to indicate a small shift + + function almostEqualAbs(x, y) { + var e = Math.abs(x - y); + return (e <= epsilon); + } + + function almostLessThanAbs(x, y) { + var e = x - y; + return (e <= epsilon); + } + + // test: mfrac + var mfracNum = document.getElementById("test_mfrac").firstElementChild.getBoundingClientRect(); + var mfracDenom = document.getElementById("test_mfrac").lastElementChild.getBoundingClientRect(); + + ok(almostEqualAbs(mfracNum.left, mfracDenom.left) && + almostEqualAbs(mfracNum.right, mfracDenom.right), "Numerator and denominator should be vertical aligned"); + + ok(almostLessThanAbs(mfracNum.bottom, mfracDenom.top), "Numerator should be above denominator"); + + // test: mfrac attributes + var mfrac = document.getElementById("mfrac_linethickness").getBoundingClientRect(); + var num = document.getElementById("mfrac_linethickness").firstElementChild.getBoundingClientRect(); + var denom = document.getElementById("mfrac_linethickness").lastElementChild.getBoundingClientRect(); + + ok(almostLessThanAbs(num.height + 30 + denom.height, mfrac.height) && + almostLessThanAbs(num.bottom + 30, denom.top), "numerator and denominator should be separated by linethickness"); + + num = document.getElementById("mfrac_numalign").firstElementChild.getBoundingClientRect(); + mfrac = document.getElementById("mfrac_numalign").getBoundingClientRect(); + + ok(almostEqualAbs(num.left, mfrac.left), "numerator should be aligned left"); + + mfrac = document.getElementById("mfrac_denomalign").getBoundingClientRect(); + denom = document.getElementById("mfrac_denomalign").lastElementChild.getBoundingClientRect(); + + ok(almostEqualAbs(mfrac.right, denom.right), "denominator should be aligned right"); + + num = document.getElementById("mfrac_bevelled").firstElementChild.getBoundingClientRect(); + denom = document.getElementById("mfrac_bevelled").lastElementChild.getBoundingClientRect(); + + ok(almostLessThanAbs(num.right, denom.left) && + almostLessThanAbs(num.top*(1-delta)+num.bottom*delta, denom.top), "incorrect position of mfrac children"); + + SimpleTest.finish(); + + </script> + </body> +</html> |