| Index: LayoutTests/fast/dom/geometry-interfaces-dom-quad.html
|
| diff --git a/LayoutTests/fast/dom/geometry-interfaces-dom-quad.html b/LayoutTests/fast/dom/geometry-interfaces-dom-quad.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fa15a9961004b561373e389dfeeac515797ad47b
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/geometry-interfaces-dom-quad.html
|
| @@ -0,0 +1,210 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<title>Geometry Interfaces: DOMRect</title>
|
| +<script src="../../resources/js-test.js"></script>
|
| +</head>
|
| +<body>
|
| +<script>
|
| +
|
| +debug("# DOMQuad()");
|
| +var quad = new DOMQuad();
|
| +shouldBe("quad.p1.x", "0");
|
| +shouldBe("quad.p1.y", "0");
|
| +shouldBe("quad.p2.x", "0");
|
| +shouldBe("quad.p2.y", "0");
|
| +shouldBe("quad.p3.x", "0");
|
| +shouldBe("quad.p3.y", "0");
|
| +shouldBe("quad.p4.x", "0");
|
| +shouldBe("quad.p4.y", "0");
|
| +shouldBe("quad.bounds.x", "0");
|
| +shouldBe("quad.bounds.y", "0");
|
| +shouldBe("quad.bounds.width", "0");
|
| +shouldBe("quad.bounds.height", "0");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad({ x : 10, y : 10, width : 20, height : 30 }) - DOMRectInit");
|
| +quad = new DOMQuad({ x : 10, y : 10, width : 20, height : 30 });
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "30");
|
| +shouldBe("quad.p3.y", "40");
|
| +shouldBe("quad.p4.x", "10");
|
| +shouldBe("quad.p4.y", "40");
|
| +shouldBe("quad.bounds.x", "10");
|
| +shouldBe("quad.bounds.y", "10");
|
| +shouldBe("quad.bounds.width", "20");
|
| +shouldBe("quad.bounds.height", "30");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad(new DOMRectReadOnly(10, 10, 20, 30)) - DOMRectReadOnly");
|
| +quad = new DOMQuad(new DOMRectReadOnly(10, 10, 20, 30));
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "30");
|
| +shouldBe("quad.p3.y", "40");
|
| +shouldBe("quad.p4.x", "10");
|
| +shouldBe("quad.p4.y", "40");
|
| +shouldBe("quad.bounds.x", "10");
|
| +shouldBe("quad.bounds.y", "10");
|
| +shouldBe("quad.bounds.width", "20");
|
| +shouldBe("quad.bounds.height", "30");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad(new DOMRect(10, 10, 20, 30)) - DOMRect");
|
| +quad = new DOMQuad(new DOMRect(10, 10, 20, 30));
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "30");
|
| +shouldBe("quad.p3.y", "40");
|
| +shouldBe("quad.p4.x", "10");
|
| +shouldBe("quad.p4.y", "40");
|
| +shouldBe("quad.bounds.x", "10");
|
| +shouldBe("quad.bounds.y", "10");
|
| +shouldBe("quad.bounds.width", "20");
|
| +shouldBe("quad.bounds.height", "30");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad(p1, p2) - DOMPointInit");
|
| +quad = new DOMQuad(
|
| + { x : 10, y : 10 },
|
| + { x : 30, y : 10 }
|
| +);
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "0");
|
| +shouldBe("quad.p3.y", "0");
|
| +shouldBe("quad.p4.x", "0");
|
| +shouldBe("quad.p4.y", "0");
|
| +shouldBe("quad.bounds.x", "0");
|
| +shouldBe("quad.bounds.y", "0");
|
| +shouldBe("quad.bounds.width", "30");
|
| +shouldBe("quad.bounds.height", "10");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad(p1, p2, p3) - DOMPointInit");
|
| +quad = new DOMQuad(
|
| + { x : 10, y : 10 },
|
| + { x : 30, y : 10 },
|
| + { x : 40, y : 40 }
|
| +);
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "40");
|
| +shouldBe("quad.p3.y", "40");
|
| +shouldBe("quad.p4.x", "0");
|
| +shouldBe("quad.p4.y", "0");
|
| +shouldBe("quad.bounds.x", "0");
|
| +shouldBe("quad.bounds.y", "0");
|
| +shouldBe("quad.bounds.width", "40");
|
| +shouldBe("quad.bounds.height", "40");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad(p1, p2, p3, p4) - DOMPointInit");
|
| +quad = new DOMQuad(
|
| + { x : 10, y : 10 },
|
| + { x : 30, y : 10 },
|
| + { x : 40, y : 40 },
|
| + { x : 20, y : 50 }
|
| +);
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "40");
|
| +shouldBe("quad.p3.y", "40");
|
| +shouldBe("quad.p4.x", "20");
|
| +shouldBe("quad.p4.y", "50");
|
| +shouldBe("quad.bounds.x", "10");
|
| +shouldBe("quad.bounds.y", "10");
|
| +shouldBe("quad.bounds.width", "30");
|
| +shouldBe("quad.bounds.height", "40");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad(p1, p2, p3, p4) - DOMPointInit/DOMPoint");
|
| +quad = new DOMQuad(
|
| + { x : 10, y : 10 },
|
| + new DOMPoint(30, 10),
|
| + { x : 40, y : 40 },
|
| + new DOMPoint(20, 50)
|
| +);
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "40");
|
| +shouldBe("quad.p3.y", "40");
|
| +shouldBe("quad.p4.x", "20");
|
| +shouldBe("quad.p4.y", "50");
|
| +shouldBe("quad.bounds.x", "10");
|
| +shouldBe("quad.bounds.y", "10");
|
| +shouldBe("quad.bounds.width", "30");
|
| +shouldBe("quad.bounds.height", "40");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad.pX is readonly.");
|
| +quad.p1 = new DOMPoint(0, 0);
|
| +quad.p2 = new DOMPoint(20, 90);
|
| +quad.p3 = new DOMPoint(80, 70);
|
| +quad.p4 = new DOMPoint(40, 50);
|
| +shouldBe("quad.p1.x", "10");
|
| +shouldBe("quad.p1.y", "10");
|
| +shouldBe("quad.p2.x", "30");
|
| +shouldBe("quad.p2.y", "10");
|
| +shouldBe("quad.p3.x", "40");
|
| +shouldBe("quad.p3.y", "40");
|
| +shouldBe("quad.p4.x", "20");
|
| +shouldBe("quad.p4.y", "50");
|
| +shouldBe("quad.bounds.x", "10");
|
| +shouldBe("quad.bounds.y", "10");
|
| +shouldBe("quad.bounds.width", "30");
|
| +shouldBe("quad.bounds.height", "40");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad.pX.Attr is not readonly.");
|
| +quad.p1.x = 0;
|
| +quad.p1.y = 0;
|
| +quad.p2.x = 20;
|
| +quad.p2.y = 90;
|
| +quad.p3.x = 80;
|
| +quad.p3.y = 70;
|
| +quad.p4.x = 40;
|
| +quad.p4.y = 50;
|
| +shouldBe("quad.p1.x", "0");
|
| +shouldBe("quad.p1.y", "0");
|
| +shouldBe("quad.p2.x", "20");
|
| +shouldBe("quad.p2.y", "90");
|
| +shouldBe("quad.p3.x", "80");
|
| +shouldBe("quad.p3.y", "70");
|
| +shouldBe("quad.p4.x", "40");
|
| +shouldBe("quad.p4.y", "50");
|
| +shouldBe("quad.bounds.x", "0");
|
| +shouldBe("quad.bounds.y", "0");
|
| +shouldBe("quad.bounds.width", "80");
|
| +shouldBe("quad.bounds.height", "90");
|
| +debug("");
|
| +
|
| +debug("# DOMQuad.bounds must be updated automatically.");
|
| +var bounds = quad.bounds;
|
| +quad.p1.x = 10;
|
| +quad.p3.x = 100;
|
| +shouldBe("bounds.x", "10");
|
| +shouldBe("bounds.width", "90");
|
| +shouldBe("quad.bounds.x", "10");
|
| +shouldBe("quad.bounds.width", "90");
|
| +shouldBeTrue("quad.bounds == bounds");
|
| +debug("");
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|