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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 3
4 <title>Geometry Interfaces: DOMRect</title> 4 <title>Geometry Interfaces: DOMRect</title>
5 <link rel="help" href="https://drafts.fxtf.org/geometry/#domrect"> 5 <link rel="help" href="https://drafts.fxtf.org/geometry/#domrect">
6 <script src="../../resources/testharness.js"></script> 6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script> 7 <script src="../../resources/testharnessreport.js"></script>
8 <script src="./resources/geometry-interfaces-test-helpers.js"></script> 8 <script src="./resources/geometry-interfaces-test-helpers.js"></script>
9 <script> 9 <script>
10 'use strict'; 10 'use strict';
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]); 50 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]);
51 rect.y = -10; 51 rect.y = -10;
52 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]); 52 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]);
53 rect.width = 20; 53 rect.width = 20;
54 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]); 54 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]);
55 rect.height = 40; 55 rect.height = 40;
56 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]); 56 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]);
57 }, 'DOMRect setter'); 57 }, 'DOMRect setter');
58 58
59 test(() => { 59 test(() => {
60 var rect = DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50});
61 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]);
62 }, 'DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50}) should create a DOMR ect');
63
64 test(() => {
65 var rect = DOMRect.fromRect();
66 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]);
67 }, 'DOMRect.fromRect({x: 0, y: 0, width: 0, height: 0}) should create a DOMRect' );
68
69 test(() => {
70 var rect = DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50});
71 rect.x = 30;
72 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]);
73 rect.y = -10;
74 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]);
75 rect.width = 20;
76 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]);
77 rect.height = 40;
78 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]);
79 }, 'DOMRect.fromRect({x: 10, y: 20, width: 80, height: 50}) should create a DOMR ect and the values can be changed');
80
81 test(() => {
82 var rect1 = DOMRect.fromRect();
83 var rect2 = DOMRect.fromRect();
84 assert_false(rect1 == rect2);
85 assert_dom_rect_equals(rect1, rect2);
86 }, 'DOMRect.fromRect() should create a new DOMRect');
87
88 test(() => {
60 var rect = new DOMRectReadOnly(); 89 var rect = new DOMRectReadOnly();
61 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]); 90 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]);
62 }, 'DOMRectReadOnly constructor without parameter'); 91 }, 'DOMRectReadOnly constructor without parameter');
63 92
64 test(() => { 93 test(() => {
65 var rect = new DOMRectReadOnly(10); 94 var rect = new DOMRectReadOnly(10);
66 assert_dom_rect_equals(rect, [10, 0, 0, 0, 0, 10, 0, 10]); 95 assert_dom_rect_equals(rect, [10, 0, 0, 0, 0, 10, 0, 10]);
67 }, 'DOMRectReadOnly constructor with x parameter'); 96 }, 'DOMRectReadOnly constructor with x parameter');
68 97
69 test(() => { 98 test(() => {
(...skipping 17 matching lines...) Expand all
87 assert_readonly(rect, 'y'); 116 assert_readonly(rect, 'y');
88 assert_readonly(rect, 'width'); 117 assert_readonly(rect, 'width');
89 assert_readonly(rect, 'height'); 118 assert_readonly(rect, 'height');
90 }, 'DOMRectReadOnly readonly test'); 119 }, 'DOMRectReadOnly readonly test');
91 120
92 test(() => { 121 test(() => {
93 var rect = new DOMRectReadOnly(10, 20, 80, 50); 122 var rect = new DOMRectReadOnly(10, 20, 80, 50);
94 assert_object_equals(rect.toJSON(), {x: 10, y: 20, width: 80, height: 50, top: 20, right: 90, bottom: 70, left: 10}); 123 assert_object_equals(rect.toJSON(), {x: 10, y: 20, width: 80, height: 50, top: 20, right: 90, bottom: 70, left: 10});
95 }, 'DOMRectReadOnly toJSON'); 124 }, 'DOMRectReadOnly toJSON');
96 125
126 test(() => {
127 var rect = DOMRectReadOnly.fromRect({x: 10, y: 20, width: 80, height: 50});
128 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]);
129 }, 'DOMRectReadOnly.fromRect({x: 10, y: 20, width: 80, height: 50}) should creat e a DOMRectReadOnly');
130
131 test(() => {
132 var rect = DOMRectReadOnly.fromRect();
133 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]);
134 }, 'DOMRectReadOnly.fromRect({x: 0, y: 0, width: 0, height: 0}) should create a DOMRectReadOnly');
135
136 test(() => {
137 var rect1 = DOMRectReadOnly.fromRect();
138 var rect2 = DOMRectReadOnly.fromRect();
139 assert_false(rect1 == rect2);
140 assert_dom_rect_equals(rect1, rect2);
141 }, 'DOMRectReadOnly.fromRect() should create a new DOMRectReadOnly');
142
143 test(() => {
144 var rect = DOMRectReadOnly.fromRect();
145 assert_readonly(rect, 'x');
146 assert_readonly(rect, 'y');
147 assert_readonly(rect, 'width');
148 assert_readonly(rect, 'height');
149 }, "DOMRectReadOnly.fromRect() should create DOMRectReadOnly");
150
97 </script> 151 </script>
OLDNEW
« 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