Mypal/layout/mathml/tests/test_bug330964.html

99 lines
3.6 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=330964
-->
<head>
<title>Test for Bug 706406</title>
<script type="application/javascript" 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>