content/base/test/test_bug414190.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=414190
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 414190</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 10 </head>
michael@0 11 <body>
michael@0 12
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414190">Mozilla Bug 414190</a>
michael@0 14 <p id="display"></p>
michael@0 15
michael@0 16 <table id="table" border="0" cellspacing="0" cellpadding="0"
michael@0 17 style="width:100px; border:10px solid silver;">
michael@0 18 <tr><td id="cell" style="height:100px;"></td></tr>
michael@0 19 <caption id="caption" style="caption-side:bottom; width:50px; height:70px; background:yellow;"></caption>
michael@0 20 </table>
michael@0 21
michael@0 22 <div id="content" style="display: none">
michael@0 23
michael@0 24 </div>
michael@0 25 <pre id="test">
michael@0 26 <script class="testbody" type="text/javascript">
michael@0 27
michael@0 28 function isEqualRect(r1, r2, r1border, s) {
michael@0 29 is(r1.left + r1border, r2.left, s + " (left)");
michael@0 30 is(r1.right - r1border, r2.right, s + " (right)");
michael@0 31 is(r1.top + r1border, r2.top, s + " (top)");
michael@0 32 is(r1.bottom - r1border, r2.bottom, s + " (bottom)");
michael@0 33 }
michael@0 34
michael@0 35 var table = document.getElementById("table");
michael@0 36 var cell = document.getElementById("cell");
michael@0 37 var caption = document.getElementById("caption");
michael@0 38 var tableRects = table.getClientRects();
michael@0 39 var tableBoundingRect = table.getBoundingClientRect();
michael@0 40 var cellBoundingRect = cell.getBoundingClientRect();
michael@0 41 var captionBoundingRect = caption.getBoundingClientRect();
michael@0 42
michael@0 43 is(tableRects.length, 2, "Table should have rects for body and caption");
michael@0 44 isEqualRect(tableRects[0], cellBoundingRect, 10,
michael@0 45 "Table first rect should be cell rect");
michael@0 46 isEqualRect(tableRects[1], captionBoundingRect, 0,
michael@0 47 "Table second rect should be caption rect");
michael@0 48 is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width");
michael@0 49 is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height");
michael@0 50 is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width");
michael@0 51 is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height");
michael@0 52 is(captionBoundingRect.top, cellBoundingRect.bottom + 10, "Discontiguous vertical geometry");
michael@0 53
michael@0 54 is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error");
michael@0 55 is(tableBoundingRect.left, cellBoundingRect.left - 10, "Table left error");
michael@0 56 is(tableBoundingRect.bottom, captionBoundingRect.bottom, "Table bottom error");
michael@0 57 is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error");
michael@0 58
michael@0 59 caption.style.captionSide = "left";
michael@0 60
michael@0 61 tableRects = table.getClientRects();
michael@0 62 tableBoundingRect = table.getBoundingClientRect();
michael@0 63 cellBoundingRect = cell.getBoundingClientRect();
michael@0 64 captionBoundingRect = caption.getBoundingClientRect();
michael@0 65
michael@0 66 is(tableRects.length, 2, "Table should have rects for body and caption");
michael@0 67 isEqualRect(tableRects[0], cellBoundingRect, 10,
michael@0 68 "Table first rect should be cell rect plus border");
michael@0 69 isEqualRect(tableRects[1], captionBoundingRect, 0,
michael@0 70 "Table second rect should be caption rect");
michael@0 71 is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width");
michael@0 72 is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height");
michael@0 73 is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width");
michael@0 74 is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height");
michael@0 75 is(captionBoundingRect.right + 10, cellBoundingRect.left, "Discontiguous horizontal geometry");
michael@0 76 is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error");
michael@0 77 is(tableBoundingRect.left, captionBoundingRect.left, "Table left error");
michael@0 78 is(tableBoundingRect.bottom, cellBoundingRect.bottom + 10, "Table bottom error");
michael@0 79 is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error");
michael@0 80
michael@0 81 </script>
michael@0 82 </pre>
michael@0 83 </body>
michael@0 84
michael@0 85 </html>

mercurial