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

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

Issue 2611713002: Rewrite the layout test for DOMRect interface. (Closed)
Patch Set: Rewrite the layout test for DOMRect interface. 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/fast/dom/geometry-interfaces-dom-rect-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 <html> 2 <meta charset="utf-8">
3 <head> 3
4 <title>Geometry Interfaces: DOMRect</title> 4 <title>Geometry Interfaces: DOMRect</title>
5 <script src="../../resources/js-test.js"></script> 5 <link rel="help" href="https://drafts.fxtf.org/geometry/#domrect">
6 </head> 6 <script src="../../resources/testharness.js"></script>
7 <body> 7 <script src="../../resources/testharnessreport.js"></script>
8 <script src="./resources/geometry-interfaces-test-helpers.js"></script>
8 <script> 9 <script>
10 'use strict';
9 11
10 debug("# DOMRect()"); 12 test(() => {
11 var rect = new DOMRect(); 13 var rect = new DOMRect();
12 shouldBe("rect.x", "0"); 14 assert_dom_rect_equals(rect, [0, 0, 0, 0, 0, 0, 0, 0]);
13 shouldBe("rect.y", "0"); 15 }, 'DOMRect constructor without parameter');
14 shouldBe("rect.width", "0");
15 shouldBe("rect.height", "0");
16 shouldBe("rect.top", "0");
17 shouldBe("rect.right", "0");
18 shouldBe("rect.bottom", "0");
19 shouldBe("rect.left", "0");
20 shouldBe("rect.top", "rect.y");
21 shouldBe("rect.right", "rect.x + rect.width");
22 shouldBe("rect.bottom", "rect.y + rect.height");
23 shouldBe("rect.left", "rect.x");
24 debug("");
25 16
26 debug("# DOMRect(10)"); 17 test(() => {
27 rect = new DOMRect(10); 18 var rect = new DOMRect(10);
28 shouldBe("rect.x", "10"); 19 assert_dom_rect_equals(rect, [10, 0, 0, 0, 0, 10, 0, 10]);
29 shouldBe("rect.y", "0"); 20 }, 'DOMRect constructor with x parameter');
30 shouldBe("rect.width", "0");
31 shouldBe("rect.height", "0");
32 shouldBe("rect.top", "0");
33 shouldBe("rect.right", "10");
34 shouldBe("rect.bottom", "0");
35 shouldBe("rect.left", "10");
36 shouldBe("rect.top", "rect.y");
37 shouldBe("rect.right", "rect.x + rect.width");
38 shouldBe("rect.bottom", "rect.y + rect.height");
39 shouldBe("rect.left", "rect.x");
40 debug("");
41 21
42 debug("# DOMRect(10, 20)"); 22 test(() => {
43 rect = new DOMRect(10, 20); 23 var rect = new DOMRect(10, 20);
44 shouldBe("rect.x", "10"); 24 assert_dom_rect_equals(rect, [10, 20, 0, 0, 20, 10, 20, 10]);
45 shouldBe("rect.y", "20"); 25 }, 'DOMRect constructor with x, y parameters');
46 shouldBe("rect.width", "0");
47 shouldBe("rect.height", "0");
48 shouldBe("rect.top", "20");
49 shouldBe("rect.right", "10");
50 shouldBe("rect.bottom", "20");
51 shouldBe("rect.left", "10");
52 shouldBe("rect.top", "rect.y");
53 shouldBe("rect.right", "rect.x + rect.width");
54 shouldBe("rect.bottom", "rect.y + rect.height");
55 shouldBe("rect.left", "rect.x");
56 debug("");
57 26
58 debug("# DOMRect(10, 20, 80)"); 27 test(() => {
59 rect = new DOMRect(10, 20, 80); 28 var rect = new DOMRect(10, 20, 80);
60 shouldBe("rect.x", "10"); 29 assert_dom_rect_equals(rect, [10, 20, 80, 0, 20, 90, 20, 10]);
61 shouldBe("rect.y", "20"); 30 }, 'DOMRect constructor with x, y, width parameters');
62 shouldBe("rect.width", "80");
63 shouldBe("rect.height", "0");
64 shouldBe("rect.top", "20");
65 shouldBe("rect.right", "90");
66 shouldBe("rect.bottom", "20");
67 shouldBe("rect.left", "10");
68 shouldBe("rect.top", "rect.y");
69 shouldBe("rect.right", "rect.x + rect.width");
70 shouldBe("rect.bottom", "rect.y + rect.height");
71 shouldBe("rect.left", "rect.x");
72 debug("");
73 31
74 debug("# DOMRect(10, 20, 80, 50)"); 32 test(() => {
75 rect = new DOMRect(10, 20, 80, 50); 33 var rect = new DOMRect(10, 20, 80, 50);
76 shouldBe("rect.x", "10"); 34 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]);
77 shouldBe("rect.y", "20"); 35 }, 'DOMRect constructor with x, y, width, height parameters');
78 shouldBe("rect.width", "80");
79 shouldBe("rect.height", "50");
80 shouldBe("rect.top", "20");
81 shouldBe("rect.right", "90");
82 shouldBe("rect.bottom", "70");
83 shouldBe("rect.left", "10");
84 shouldBe("rect.top", "rect.y");
85 shouldBe("rect.right", "rect.x + rect.width");
86 shouldBe("rect.bottom", "rect.y + rect.height");
87 shouldBe("rect.left", "rect.x");
88 debug("");
89 36
90 debug("# DOMRect setter"); 37 test(() => {
91 rect.x = 30; 38 var rect = new DOMRect(10, 20, -80, -50);
92 shouldBe("rect.x", "30"); 39 assert_dom_rect_equals(rect, [10, 20, -80, -50, -30, 10, 20, -70]);
93 shouldBe("rect.left", "30"); 40 }, 'DOMRect constructor with negative width and height parameters');
94 shouldBe("rect.width", "80");
95 shouldBe("rect.right", "110");
96 rect.y = -10;
97 shouldBe("rect.y", "-10");
98 shouldBe("rect.top", "-10");
99 shouldBe("rect.height", "50");
100 shouldBe("rect.bottom", "40");
101 rect.width = 20;
102 shouldBe("rect.x", "30");
103 shouldBe("rect.left", "30");
104 shouldBe("rect.width", "20");
105 shouldBe("rect.right", "50");
106 rect.height = 40;
107 shouldBe("rect.y", "-10");
108 shouldBe("rect.top", "-10");
109 shouldBe("rect.height", "40");
110 shouldBe("rect.bottom", "30");
111 debug("");
112 41
113 debug("# DOMRect(10, 20, -80, -50) negative width and height"); 42 test(() => {
114 rect = new DOMRect(10, 20, -80, -50); 43 var rect = new DOMRect(10, 20, 80, 50);
115 shouldBe("rect.x", "10"); 44 rect.x = 30;
116 shouldBe("rect.y", "20"); 45 assert_dom_rect_equals(rect, [30, 20, 80, 50, 20, 110, 70, 30]);
117 shouldBe("rect.width", "-80"); 46 rect.y = -10;
118 shouldBe("rect.height", "-50"); 47 assert_dom_rect_equals(rect, [30, -10, 80, 50, -10, 110, 40, 30]);
119 shouldBe("rect.top", "-30"); 48 rect.width = 20;
120 shouldBe("rect.right", "10"); 49 assert_dom_rect_equals(rect, [30, -10, 20, 50, -10, 50, 40, 30]);
121 shouldBe("rect.bottom", "20"); 50 rect.height = 40;
122 shouldBe("rect.left", "-70"); 51 assert_dom_rect_equals(rect, [30, -10, 20, 40, -10, 50, 30, 30]);
123 shouldBe("rect.top", "rect.y + rect.height"); 52 }, 'DOMRect setter');
124 shouldBe("rect.right", "rect.x");
125 shouldBe("rect.bottom", "rect.y");
126 shouldBe("rect.left", "rect.x + rect.width");
127 debug("");
128 53
129 debug("# DOMRectReadOnly(10, 20, 80, 50)"); 54 test(() => {
130 rect = new DOMRectReadOnly(10, 20, 80, 50); 55 var rect = new DOMRectReadOnly(10, 20, 80, 50);
131 shouldBe("rect.x", "10"); 56 assert_dom_rect_equals(rect, [10, 20, 80, 50, 20, 90, 70, 10]);
132 shouldBe("rect.y", "20"); 57 }, 'DOMRectReadOnly constructor with x, y, width, height parameters');
133 shouldBe("rect.width", "80");
134 shouldBe("rect.height", "50");
135 shouldBe("rect.top", "20");
136 shouldBe("rect.right", "90");
137 shouldBe("rect.bottom", "70");
138 shouldBe("rect.left", "10");
139 shouldBe("rect.top", "rect.y");
140 shouldBe("rect.right", "rect.x + rect.width");
141 shouldBe("rect.bottom", "rect.y + rect.height");
142 shouldBe("rect.left", "rect.x");
143 debug("");
144 58
145 debug("# DOMRectReadOnly readonly test"); 59 test(() => {
146 rect.x = 40; 60 var rect = new DOMRectReadOnly(10, 20, 80, 50);
147 rect.y = 90; 61 assert_readonly(rect, 'x');
148 rect.width = 200; 62 assert_readonly(rect, 'y');
149 rect.height = 200; 63 assert_readonly(rect, 'width');
150 shouldBe("rect.x", "10"); 64 assert_readonly(rect, 'height');
151 shouldBe("rect.y", "20"); 65 }, 'DOMRectReadOnly readonly test');
152 shouldBe("rect.width", "80");
153 shouldBe("rect.height", "50");
154 shouldBe("rect.top", "20");
155 shouldBe("rect.right", "90");
156 shouldBe("rect.bottom", "70");
157 shouldBe("rect.left", "10");
158 shouldBe("rect.top", "rect.y");
159 shouldBe("rect.right", "rect.x + rect.width");
160 shouldBe("rect.bottom", "rect.y + rect.height");
161 shouldBe("rect.left", "rect.x");
162 debug("");
163 66
164 </script> 67 </script>
165 </body>
166 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-rect-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698