Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-rect.html

Issue 2612263002: Adding fromRect to DOMRect and DOMRectReadOnly interfaces following spec. (Closed)
Patch Set: Adding fromRect to DOMRect and DOMRectReadOnly interfaces following spec. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 611e2b774797af65c7648d88ac0252efd2fd7604..7707eb2c0e84fbbc6b85f2b441a01851e0a2a2c5 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
@@ -57,6 +57,26 @@ test(() => {
}, 'DOMRect setter');
test(() => {
+ var rect = DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50});
+ assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]);
+}, 'DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50}) should create a DOMRect');
+
+test(() => {
+ var rect = DOMRect.fromRect();
+ assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]);
+}, 'DOMRect.fromRect({x: 0, y: 0, width: 0, height: 0}) should create a DOMRect');
+
+test(() => {
+ var rect1 = DOMRect.fromRect();
+ var rect2 = DOMRect.fromRect();
+ assert_false(rect1 == rect2);
+ assert_true(rect1.x == rect2.x);
+ assert_true(rect1.y == rect2.y);
+ assert_true(rect1.width == rect2.width);
+ assert_true(rect1.height == rect2.height);
+}, 'DOMRect.fromRect() should create a new DOMRect');
+
+test(() => {
var rect = new DOMRectReadOnly();
assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]);
}, 'DOMRectReadOnly constructor without parameter');
@@ -94,4 +114,24 @@ test(() => {
assert_object_equals(rect.toJSON(), {x: 10, y: 20, width: 80, height: 50, top: 20, right: 90, bottom: 70, left: 10});
}, 'DOMRectReadOnly toJSON');
+test(() => {
+ var rect = DOMRectReadOnly.fromRect({x: 10, y: 20, width: 80, height: 50});
+ assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]);
zino 2017/01/11 18:43:35 How can we know which this is DOMRect or DOMRectRe
Byoungkwon Ko 2017/01/12 17:24:17 I added one more test function to check whether it
zino 2017/01/12 19:05:25 Sorry for the confused explanation. DOMRect is DO
+}, 'DOMRectReadOnly.fromRect({x: 10, y: 20, width: 80, height: 50}) should create a DOMRectReadOnly');
+
+test(() => {
+ var rect = DOMRectReadOnly.fromRect();
+ assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]);
+}, 'DOMRectReadOnly.fromRect({x: 0, y: 0, width: 0, height: 0}) should create a DOMRectReadOnly');
+
+test(() => {
+ var rect1 = DOMRectReadOnly.fromRect();
+ var rect2 = DOMRectReadOnly.fromRect();
+ assert_false(rect1 == rect2);
+ assert_true(rect1.x == rect2.x);
+ assert_true(rect1.y == rect2.y);
+ assert_true(rect1.width == rect2.width);
+ assert_true(rect1.height == rect2.height);
+}, 'DOMRectReadOnly.fromRect() should create a new DOMRectReadOnly');
+
</script>

Powered by Google App Engine
This is Rietveld 408576698