layout/mathml/tests/test_bug827713.html
author Frederic Wang <fred.wang@free.fr>
Wed, 16 Oct 2019 11:57:13 +0000
changeset 559190 fe2312ad6c4fd03510106cfdbe51480ffcff031d
parent 559170 5808d51ab6cba029cb5aef64762cf395180f3123
permissions -rw-r--r--
Bug 1587570 - Remove support for the subscriptshift and superscriptshift attributes. r=emilio See https://groups.google.com/forum/#!topic/mozilla.dev.platform/CAqw0Nxw6Pg Differential Revision: https://phabricator.services.mozilla.com/D48766

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=706406
-->
<head>
  <title>Test for Bug 706406</title>
  <script src="/tests/SimpleTest/SimpleTest.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=827713">Mozilla Bug 827713</a>
<p id="display"></p>
  <p><math>
    <msub subscriptshift="50px">
      <mspace width="50px" height="25px" depth="25px" mathbackground="blue" id ="subbase"></mspace>
      <mspace width="50px" height="25px" depth="25px" mathbackground="red" id="subsub"></mspace>
    </msub>
  </math></p>

  <p><math>
    <msup superscriptshift="50px">
      <mspace width="50px" height="25px" depth="25px" mathbackground="blue" id="supbase"></mspace>
      <mspace width="50px" height="25px" depth="25px" mathbackground="green" id="supsup"></mspace>
    </msup>
  </math></p>

  <p><math>
    <msubsup subscriptshift="50px" superscriptshift="50px">
      <mspace width="50px" height="25px" depth="25px" mathbackground="blue" id="ssbase"></mspace>
      <mspace width="50px" height="25px" depth="25px" mathbackground="red" id="sssub"></mspace>
      <mspace width="50px" height="25px" depth="25px" mathbackground="green" id="sssup"></mspace>
    </msubsup>
  </math></p>
<pre id="test">
<script type="application/javascript">
    /** Test for the scriptshift aspect of bug 827713 **/
    SimpleTest.waitForExplicitFinish();

    if (SpecialPowers.getBoolPref('mathml.script_shift_attributes.disabled')) {
      ok(true, "Script shifts disabled");
    } else {
      subBaseRect = $("subbase").getBoundingClientRect();
      subSubRect = $("subsub").getBoundingClientRect();
      is(subBaseRect.bottom, subSubRect.top, "Bad subscript shift for msub");

      supBaseRect = $("supbase").getBoundingClientRect();
      supSupRect = $("supsup").getBoundingClientRect();
      is(supBaseRect.top, supSupRect.bottom, "Bad superscript shift for msup");

      ssBaseRect = $("ssbase").getBoundingClientRect();
      ssSubRect = $("sssub").getBoundingClientRect();
      ssSupRect = $("sssup").getBoundingClientRect();
      is(ssBaseRect.bottom, ssSubRect.top, "Bad subscript shift for msubusp");
      is(ssBaseRect.top, ssSupRect.bottom, "Bad superscript shift for msubusp");
    }

    SimpleTest.finish();

</script>
</pre>
</body>
</html>