summaryrefslogtreecommitdiffstats
path: root/layout/mathml/tests/test_bug330964.html
blob: 84da15194e2ca11fed2b8ff7d080bf77817a5d75 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=330964
-->
<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=330964">Mozilla Bug 330964</a>
<p id="display"></p>

<math>
  <mtable framespacing="7px 20px" frame="solid" rowspacing="11px 27px" columnspacing="5px 16px"
          style="border-width: 2px;" id="mtable0">
    <mtr>
      <mtd id="mtd0">
        <mn>X</mn>
      </mtd>
      <mtd id="mtd1">
        <mn>X</mn>
      </mtd>
      <mtd id="mtd2">
        <mn>X</mn>
      </mtd>
    </mtr>
    <mtr>
      <mtd id="mtd3">
        <mn>X</mn>
      </mtd>
      <mtd id="mtd4">
        <mn>X</mn>
      </mtd>
      <mtd id="mtd5">
        <mn>X</mn>
      </mtd>
    </mtr>
    <mtr>
      <mtd id="mtd6">
        <mn>X</mn>
      </mtd>
      <mtd id="mtd7">
        <mn>X</mn>
      </mtd>
      <mtd id="mtd8">
        <mn>X</mn>
      </mtd>
    </mtr>
  </mtable>
</math>

<pre id="test">
<script type="application/javascript">

  var epsilon = 2;
  function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }

  rectTable = $("mtable0").getBoundingClientRect();
  rect0 = $("mtd0").getBoundingClientRect();
  rect1 = $("mtd1").getBoundingClientRect();
  rect2 = $("mtd2").getBoundingClientRect();
  rect3 = $("mtd3").getBoundingClientRect();
  rect4 = $("mtd4").getBoundingClientRect();
  rect5 = $("mtd5").getBoundingClientRect();
  rect6 = $("mtd6").getBoundingClientRect();
  rect7 = $("mtd7").getBoundingClientRect();
  rect8 = $("mtd8").getBoundingClientRect();
  ok(almostEqual(rect1.left - rect0.right, 5), "columnspacing wonky");
  ok(almostEqual(rect2.left - rect1.right, 16), "columnspacing wonky");
  ok(almostEqual(rect4.left - rect3.right, 5), "columnspacing wonky");
  ok(almostEqual(rect5.left - rect4.right, 16), "columnspacing wonky");
  ok(almostEqual(rect7.left - rect6.right, 5), "columnspacing wonky");
  ok(almostEqual(rect8.left - rect7.right, 16), "columnspacing wonky");
  ok(almostEqual(rect3.top - rect0.bottom, 11), "rowspacing wonky");
  ok(almostEqual(rect4.top - rect1.bottom, 11), "rowspacing wonky");
  ok(almostEqual(rect5.top - rect2.bottom, 11), "rowspacing wonky");
  ok(almostEqual(rect6.top - rect3.bottom, 27), "rowspacing wonky");
  ok(almostEqual(rect7.top - rect4.bottom, 27), "rowspacing wonky");
  ok(almostEqual(rect8.top - rect5.bottom, 27), "rowspacing wonky");
  // Remember to subtract border
  ok(almostEqual(rect0.left - rectTable.left - 2, 7), "framespacing left wonky");
  ok(almostEqual(rect3.left - rectTable.left - 2, 7), "framespacing left wonky");
  ok(almostEqual(rect6.left - rectTable.left - 2, 7), "framespacing left wonky");
  ok(almostEqual(rect0.top - rectTable.top - 2, 20), "framespacing top wonky");
  ok(almostEqual(rect1.top - rectTable.top - 2, 20), "framespacing top wonky");
  ok(almostEqual(rect2.top - rectTable.top - 2, 20), "framespacing top wonky");
  ok(almostEqual(rectTable.bottom - rect6.bottom - 2, 20), "framespacing bottom wonky");
  ok(almostEqual(rectTable.bottom - rect7.bottom - 2, 20), "framespacing bottom wonky");
  ok(almostEqual(rectTable.bottom - rect8.bottom - 2, 20), "framespacing bottom wonky");
  ok(almostEqual(rectTable.right - rect2.right - 2, 7), "framespacing right wonky");
  ok(almostEqual(rectTable.right - rect5.right - 2, 7), "framespacing right wonky");
  ok(almostEqual(rectTable.right - rect8.right - 2, 7), "framespacing right wonky");
</script>
</pre>
</body>
</html>