Index: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-rect.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-rect.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-rect.html |
index f02fb4435d5c0fa5dc3ae2953d71cb0dcee3b1e3..432ef6c9d1c977c19852aded1ff407206413721a 100644 |
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-rect.html |
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-rect.html |
@@ -1,166 +1,67 @@ |
<!DOCTYPE html> |
-<html> |
-<head> |
+<meta charset="utf-8"> |
+ |
<title>Geometry Interfaces: DOMRect</title> |
-<script src="../../resources/js-test.js"></script> |
-</head> |
-<body> |
+<link rel="help" href="https://drafts.fxtf.org/geometry/#domrect"> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="./resources/geometry-interfaces-test-helpers.js"></script> |
<script> |
+'use strict'; |
-debug("# DOMRect()"); |
-var rect = new DOMRect(); |
-shouldBe("rect.x", "0"); |
-shouldBe("rect.y", "0"); |
-shouldBe("rect.width", "0"); |
-shouldBe("rect.height", "0"); |
-shouldBe("rect.top", "0"); |
-shouldBe("rect.right", "0"); |
-shouldBe("rect.bottom", "0"); |
-shouldBe("rect.left", "0"); |
-shouldBe("rect.top", "rect.y"); |
-shouldBe("rect.right", "rect.x + rect.width"); |
-shouldBe("rect.bottom", "rect.y + rect.height"); |
-shouldBe("rect.left", "rect.x"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRect(); |
+ assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]); |
+}, 'DOMRect constructor without parameter'); |
-debug("# DOMRect(10)"); |
-rect = new DOMRect(10); |
-shouldBe("rect.x", "10"); |
-shouldBe("rect.y", "0"); |
-shouldBe("rect.width", "0"); |
-shouldBe("rect.height", "0"); |
-shouldBe("rect.top", "0"); |
-shouldBe("rect.right", "10"); |
-shouldBe("rect.bottom", "0"); |
-shouldBe("rect.left", "10"); |
-shouldBe("rect.top", "rect.y"); |
-shouldBe("rect.right", "rect.x + rect.width"); |
-shouldBe("rect.bottom", "rect.y + rect.height"); |
-shouldBe("rect.left", "rect.x"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRect(10); |
+ assert_dom_rect_equals(rect, [10, 0, 0, 0, 0, 10, 0, 10]); |
+}, 'DOMRect constructor with x parameter'); |
-debug("# DOMRect(10, 20)"); |
-rect = new DOMRect(10, 20); |
-shouldBe("rect.x", "10"); |
-shouldBe("rect.y", "20"); |
-shouldBe("rect.width", "0"); |
-shouldBe("rect.height", "0"); |
-shouldBe("rect.top", "20"); |
-shouldBe("rect.right", "10"); |
-shouldBe("rect.bottom", "20"); |
-shouldBe("rect.left", "10"); |
-shouldBe("rect.top", "rect.y"); |
-shouldBe("rect.right", "rect.x + rect.width"); |
-shouldBe("rect.bottom", "rect.y + rect.height"); |
-shouldBe("rect.left", "rect.x"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRect(10, 20); |
+ assert_dom_rect_equals(rect, [10, 20, 0, 0, 20, 10, 20, 10]); |
+}, 'DOMRect constructor with x, y parameters'); |
-debug("# DOMRect(10, 20, 80)"); |
-rect = new DOMRect(10, 20, 80); |
-shouldBe("rect.x", "10"); |
-shouldBe("rect.y", "20"); |
-shouldBe("rect.width", "80"); |
-shouldBe("rect.height", "0"); |
-shouldBe("rect.top", "20"); |
-shouldBe("rect.right", "90"); |
-shouldBe("rect.bottom", "20"); |
-shouldBe("rect.left", "10"); |
-shouldBe("rect.top", "rect.y"); |
-shouldBe("rect.right", "rect.x + rect.width"); |
-shouldBe("rect.bottom", "rect.y + rect.height"); |
-shouldBe("rect.left", "rect.x"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRect(10, 20, 80); |
+ assert_dom_rect_equals(rect, [10, 20, 80, 0, 20, 90, 20, 10]); |
+}, 'DOMRect constructor with x, y, width parameters'); |
-debug("# DOMRect(10, 20, 80, 50)"); |
-rect = new DOMRect(10, 20, 80, 50); |
-shouldBe("rect.x", "10"); |
-shouldBe("rect.y", "20"); |
-shouldBe("rect.width", "80"); |
-shouldBe("rect.height", "50"); |
-shouldBe("rect.top", "20"); |
-shouldBe("rect.right", "90"); |
-shouldBe("rect.bottom", "70"); |
-shouldBe("rect.left", "10"); |
-shouldBe("rect.top", "rect.y"); |
-shouldBe("rect.right", "rect.x + rect.width"); |
-shouldBe("rect.bottom", "rect.y + rect.height"); |
-shouldBe("rect.left", "rect.x"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRect(10, 20, 80, 50); |
+ assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]); |
+}, 'DOMRect constructor with x, y, width, height parameters'); |
-debug("# DOMRect setter"); |
-rect.x = 30; |
-shouldBe("rect.x", "30"); |
-shouldBe("rect.left", "30"); |
-shouldBe("rect.width", "80"); |
-shouldBe("rect.right", "110"); |
-rect.y = -10; |
-shouldBe("rect.y", "-10"); |
-shouldBe("rect.top", "-10"); |
-shouldBe("rect.height", "50"); |
-shouldBe("rect.bottom", "40"); |
-rect.width = 20; |
-shouldBe("rect.x", "30"); |
-shouldBe("rect.left", "30"); |
-shouldBe("rect.width", "20"); |
-shouldBe("rect.right", "50"); |
-rect.height = 40; |
-shouldBe("rect.y", "-10"); |
-shouldBe("rect.top", "-10"); |
-shouldBe("rect.height", "40"); |
-shouldBe("rect.bottom", "30"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRect(10, 20, -80, -50); |
+ assert_dom_rect_equals(rect, [10, 20, -80, -50, -30, 10, 20, -70]); |
+}, 'DOMRect constructor with negative width and height parameters'); |
-debug("# DOMRect(10, 20, -80, -50) negative width and height"); |
-rect = new DOMRect(10, 20, -80, -50); |
-shouldBe("rect.x", "10"); |
-shouldBe("rect.y", "20"); |
-shouldBe("rect.width", "-80"); |
-shouldBe("rect.height", "-50"); |
-shouldBe("rect.top", "-30"); |
-shouldBe("rect.right", "10"); |
-shouldBe("rect.bottom", "20"); |
-shouldBe("rect.left", "-70"); |
-shouldBe("rect.top", "rect.y + rect.height"); |
-shouldBe("rect.right", "rect.x"); |
-shouldBe("rect.bottom", "rect.y"); |
-shouldBe("rect.left", "rect.x + rect.width"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRect(10, 20, 80, 50); |
+ rect.x = 30; |
+ assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]); |
+ rect.y = -10; |
+ assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]); |
+ rect.width = 20; |
+ assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]); |
+ rect.height = 40; |
+ assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]); |
+}, 'DOMRect setter'); |
-debug("# DOMRectReadOnly(10, 20, 80, 50)"); |
-rect = new DOMRectReadOnly(10, 20, 80, 50); |
-shouldBe("rect.x", "10"); |
-shouldBe("rect.y", "20"); |
-shouldBe("rect.width", "80"); |
-shouldBe("rect.height", "50"); |
-shouldBe("rect.top", "20"); |
-shouldBe("rect.right", "90"); |
-shouldBe("rect.bottom", "70"); |
-shouldBe("rect.left", "10"); |
-shouldBe("rect.top", "rect.y"); |
-shouldBe("rect.right", "rect.x + rect.width"); |
-shouldBe("rect.bottom", "rect.y + rect.height"); |
-shouldBe("rect.left", "rect.x"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRectReadOnly(10, 20, 80, 50); |
+ assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]); |
+}, 'DOMRectReadOnly constructor with x, y, width, height parameters'); |
-debug("# DOMRectReadOnly readonly test"); |
-rect.x = 40; |
-rect.y = 90; |
-rect.width = 200; |
-rect.height = 200; |
-shouldBe("rect.x", "10"); |
-shouldBe("rect.y", "20"); |
-shouldBe("rect.width", "80"); |
-shouldBe("rect.height", "50"); |
-shouldBe("rect.top", "20"); |
-shouldBe("rect.right", "90"); |
-shouldBe("rect.bottom", "70"); |
-shouldBe("rect.left", "10"); |
-shouldBe("rect.top", "rect.y"); |
-shouldBe("rect.right", "rect.x + rect.width"); |
-shouldBe("rect.bottom", "rect.y + rect.height"); |
-shouldBe("rect.left", "rect.x"); |
-debug(""); |
+test(() => { |
+ var rect = new DOMRectReadOnly(10, 20, 80, 50); |
+ assert_readonly(rect, 'x'); |
+ assert_readonly(rect, 'y'); |
+ assert_readonly(rect, 'width'); |
+ assert_readonly(rect, 'height'); |
+}, 'DOMRectReadOnly readonly test'); |
</script> |
-</body> |
-</html> |