summaryrefslogtreecommitdiffstats
path: root/layout/tables/test
diff options
context:
space:
mode:
Diffstat (limited to 'layout/tables/test')
-rw-r--r--layout/tables/test/mochitest.toml7
-rw-r--r--layout/tables/test/test_bug1832110.html112
-rw-r--r--layout/tables/test/test_bug337124.html32
-rw-r--r--layout/tables/test/test_bug541668_table_event_delivery.html48
4 files changed, 199 insertions, 0 deletions
diff --git a/layout/tables/test/mochitest.toml b/layout/tables/test/mochitest.toml
new file mode 100644
index 0000000000..21b541cd75
--- /dev/null
+++ b/layout/tables/test/mochitest.toml
@@ -0,0 +1,7 @@
+[DEFAULT]
+
+["test_bug337124.html"]
+
+["test_bug541668_table_event_delivery.html"]
+
+["test_bug1832110.html"]
diff --git a/layout/tables/test/test_bug1832110.html b/layout/tables/test/test_bug1832110.html
new file mode 100644
index 0000000000..bc18df2fdb
--- /dev/null
+++ b/layout/tables/test/test_bug1832110.html
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML>
+<title>Test for Bug 1832110</title>
+<style>
+:root {
+ --bw: 1px;
+}
+
+div {
+ display: inline-block;
+}
+
+table {
+ border-collapse: collapse;
+}
+
+td {
+ border: var(--bw) solid black;
+ line-height: 0;
+ padding: 0;
+}
+
+span {
+ display: inline-block;
+ width: 10px;
+ height: 10px;
+ background: grey;
+}
+
+.hide {
+ display: none;
+}
+</style>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/WindowSnapshot.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script class="testbody" type="text/javascript">
+function set_td_border(width) {
+ document.documentElement.style.setProperty("--bw", width + "px");
+}
+
+function raf() {
+ return new Promise(resolve => {
+ requestAnimationFrame(resolve);
+ });
+}
+
+async function show_table(table, other) {
+ // TODO(dshin): Once bug 1825384 resolves, this should not be needed.
+ table.classList.remove("hide");
+ other.classList.add("hide");
+ getComputedStyle(table).getPropertyValue("display");
+ await raf();
+}
+
+async function run_test(relativeZoom, width) {
+ SpecialPowers.setFullZoom(window, relativeZoom);
+ set_td_border(width);
+ show_table(emptyrows, normal);
+ const s1 = await snapshotRect(window, emptyrows.getBoundingClientRect());
+ show_table(normal, emptyrows);
+ const s2 = await snapshotRect(window, normal.getBoundingClientRect());
+ assertSnapshots(s1, s2, true, null, "emptyrows", "normal " + relativeZoom + " " + width);
+}
+
+SimpleTest.waitForExplicitFinish();
+const zoomsToTest = [
+ 100,
+ 110,
+ 120,
+ 130,
+ 140,
+ 150,
+ 200,
+ 250,
+ 300,
+];
+const originalZoom = SpecialPowers.getFullZoom(window);
+
+const widthsToTest = [
+ 1,
+ 3,
+ 7,
+ 11,
+ 23,
+];
+for (let i = 0; i < zoomsToTest.length; ++i) {
+ let relativeZoom = originalZoom * zoomsToTest[i] / 100;
+ for (let j = 0; j < widthsToTest.length; ++j) {
+ add_task(async () => { await run_test(relativeZoom, widthsToTest[j]); });
+ }
+}
+add_task(async () => { SpecialPowers.setFullZoom(window, originalZoom); });
+</script>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1832110">Mozilla Bug 1832110</a><br>
+<div id="emptyrows" class="hide">
+<table>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+<tr></tr>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+<tr></tr>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+<tr></tr>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+</table>
+</div><div id="normal" class="hide">
+<table>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+<tr><td><span></span></td><td><span></span></td><td><span></span></td></tr>
+</table>
+</div>
diff --git a/layout/tables/test/test_bug337124.html b/layout/tables/test/test_bug337124.html
new file mode 100644
index 0000000000..d92a7e31f9
--- /dev/null
+++ b/layout/tables/test/test_bug337124.html
@@ -0,0 +1,32 @@
+<html><head>
+<title>Test for Bug 337124</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=337124">Mozilla Bug 337124</a>
+
+<span style="display: table-row-group;">
+ <input type="text">
+ </span>
+ <div style="display: table-column-group;">
+ <script>document.body.offsetHeight;</script>
+ </div><span style="display: table-row-group;">
+ <input id="i1" type="text">
+ </span><fieldset id="f1" style="display: table-column-group;">
+ </fieldset>
+</fieldset>
+
+<pre id="test">
+<script class="testbody" type="text/javascript">
+var passed = false;
+if ( document.getElementById("f1").offsetTop > document.getElementById("i1").offsetTop) {
+ passed = true;
+}
+
+ok(passed, "right layout order");
+
+</script>
+</pre>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/tables/test/test_bug541668_table_event_delivery.html b/layout/tables/test/test_bug541668_table_event_delivery.html
new file mode 100644
index 0000000000..902b4c140d
--- /dev/null
+++ b/layout/tables/test/test_bug541668_table_event_delivery.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=541668
+-->
+<head>
+ <title>Test for Bug 541668</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.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=541668">Mozilla Bug 541668</a>
+<table id="display">
+ <tr>
+ <td rowspan="2">
+ <div id="target" style="background:fuchsia;height:200px;width:200px"></div>
+ </td>
+ <td>Cell</td>
+ </tr>
+ <tr>
+ <td>Cell</td>
+ </tr>
+</table>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 541668 **/
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(run_test);
+
+function run_test()
+{
+ var target = document.getElementById("target");
+
+ var got_mousemove = false;
+ target.addEventListener("mousemove",
+ function(event) { got_mousemove = true });
+ synthesizeMouse(target, 150, 150, { type: "mousemove" });
+ is(got_mousemove, true, "should get mousemove on block");
+ SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+</html>