summaryrefslogtreecommitdiffstats
path: root/layout/mathml/tests/test_bug827713.html
blob: e7bf6b5d2e816d9dcc9d554bbd8003ce856b92b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!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>