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

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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..78e9871a05c686342ed23d02aa099a7e8a04b68a 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,35 @@ 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 rect = DOMRect.fromRect({x: 10, y: 20, width: 80, height: 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.fromRect({x: 10, y: 20, width: 80, height: 50}) should create a DOMRect and the values can be changed');
+
+test(() => {
+ var rect1 = DOMRect.fromRect();
+ var rect2 = DOMRect.fromRect();
+ assert_false(rect1 == rect2);
+ assert_dom_rect_equals(rect1, rect2);
+}, '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 +123,29 @@ 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]);
+}, '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_dom_rect_equals(rect1, rect2);
+}, 'DOMRectReadOnly.fromRect() should create a new DOMRectReadOnly');
+
+test(() => {
+ var rect = DOMRectReadOnly.fromRect();
+ assert_readonly(rect, 'x');
+ assert_readonly(rect, 'y');
+ assert_readonly(rect, 'width');
+ assert_readonly(rect, 'height');
+}, "DOMRectReadOnly.fromRect() should create DOMRectReadOnly");
+
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698