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

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

Issue 2482743002: [GeometryInterface] add toJson() function in DOMMatrixReadOnly. (Closed)
Patch Set: add test for DOMMatrix Created 4 years, 1 month 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-matrix-readonly.html » ('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 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="./resources/geometry-interfaces-test-helpers.js"></script> 4 <script src="./resources/geometry-interfaces-test-helpers.js"></script>
5 <script> 5 <script>
6 test(() => { 6 test(() => {
7 var matrix = new DOMMatrix(); 7 var matrix = new DOMMatrix();
8 assert_identity_2d_matrix(matrix); 8 assert_identity_2d_matrix(matrix);
9 }, "DOMMatrix() constructor"); 9 }, "DOMMatrix() constructor");
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 m11: NaN, m12: NaN, m13: NaN, m14: NaN, 154 m11: NaN, m12: NaN, m13: NaN, m14: NaN,
155 m21: NaN, m22: NaN, m23: NaN, m24: NaN, 155 m21: NaN, m22: NaN, m23: NaN, m24: NaN,
156 m31: NaN, m32: NaN, m33: NaN, m34: NaN, 156 m31: NaN, m32: NaN, m33: NaN, m34: NaN,
157 m41: NaN, m42: NaN, m43: NaN, m44: NaN, 157 m41: NaN, m42: NaN, m43: NaN, m44: NaN,
158 is2D: false 158 is2D: false
159 }); 159 });
160 assert_3d_matrix_equals(matrix, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]); 160 assert_3d_matrix_equals(matrix, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
161 }, "DOMMatrix.fromMatrix(): NaN test"); 161 }, "DOMMatrix.fromMatrix(): NaN test");
162 162
163 test(() => { 163 test(() => {
164 var identity_matrix = DOMMatrix.fromMatrix();
165 assert_true(identity_matrix.is2D);
166 assert_object_equals(identity_matrix.toJSON(),
167 { a : 1, b : 0, c : 0, d : 1, e : 0, f : 0,
168 is2D : true, isIdentity : true,
169 m11 : 1, m12 : 0, m13 : 0, m14 : 0,
170 m21 : 0, m22 : 1, m23 : 0, m24 : 0,
171 m31 : 0, m32 : 0, m33 : 1, m34 : 0,
172 m41 : 0, m42 : 0, m43 : 0, m44 : 1});
173 }, "DOMMatrix toJSON() - identity matrix");
174
175 test(() => {
176 var matrix2d = new DOMMatrix([1, 2, 3, 3.1, 2, 1]);
177 assert_true(matrix2d.is2D);
178 assert_object_equals(matrix2d.toJSON(),
179 { a : 1, b : 2, c : 3, d : 3.1, e : 2, f : 1,
180 is2D : true, isIdentity : false,
181 m11 : 1, m12 : 2, m13 : 0, m14 : 0,
182 m21 : 3, m22 : 3.1, m23 : 0, m24 : 0,
183 m31 : 0, m32 : 0, m33 : 1, m34 : 0,
184 m41 : 2, m42 : 1, m43 : 0, m44 : 1});
185 }, "DOMMatrix toJSON() - 2D matrix");
186
187 test(() => {
188 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]);
189 assert_false(matrix3d.is2D);
190 assert_object_equals(matrix3d.toJSON(),
191 { a : 1, b : 2, c : 5, d : 6, e : 13, f : 14,
192 is2D : false, isIdentity : false,
193 m11 : 1, m12 : 2, m13 : 3, m14 : 4,
194 m21 : 5, m22 : 6, m23 : 7, m24 : 8,
195 m31 : 9, m32 : 10.1, m33 : 11, m34 : 12,
196 m41 : 13, m42 : 14, m43 : 15, m44 : 16.6});
197 }, "DOMMatrix toJSON() - 3D matrix");
198
199 test(() => {
164 assert_throws(new TypeError(), () => { 200 assert_throws(new TypeError(), () => {
165 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); 201 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true});
166 }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); 202 }, "The 'is2D' property is set to true but the input matrix is 3d matrix.");
167 assert_throws(new TypeError(), () => { 203 assert_throws(new TypeError(), () => {
168 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3}); 204 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3});
169 }, "The 'a' property should equal the 'm11' property."); 205 }, "The 'a' property should equal the 'm11' property.");
170 }, "DOMMatrix.fromMatrix(): Exception test."); 206 }, "DOMMatrix.fromMatrix(): Exception test.");
171 </script> 207 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698