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

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

Issue 2846523002: Update the stringifier behavior for DOMMatrixReadOnly (Closed)
Patch Set: Update the stringifier behavior for DOMMatrixReadOnly Created 3 years, 7 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
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 6
7 test(() => { 7 test(() => {
8 var matrix = new DOMMatrixReadOnly(); 8 var matrix = new DOMMatrixReadOnly();
9 assert_identity_2d_matrix(matrix); 9 assert_identity_2d_matrix(matrix);
10 }, "DOMMatrixReadOnly constructor"); 10 }, "DOMMatrixReadOnly constructor");
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 test(() => { 53 test(() => {
54 var matrix = new DOMMatrixReadOnly("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) trans late(44px, 55px) skewX(30deg)"); 54 var matrix = new DOMMatrixReadOnly("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) trans late(44px, 55px) skewX(30deg)");
55 var expectedMatrix = new DOMMatrixReadOnly(); 55 var expectedMatrix = new DOMMatrixReadOnly();
56 expectedMatrix = expectedMatrix.multiply(new DOMMatrixReadOnly([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) 56 expectedMatrix = expectedMatrix.multiply(new DOMMatrixReadOnly([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]))
57 expectedMatrix = expectedMatrix.translate(44, 55) 57 expectedMatrix = expectedMatrix.translate(44, 55)
58 expectedMatrix = expectedMatrix.skewX(30); 58 expectedMatrix = expectedMatrix.skewX(30);
59 assert_matrix_almost_equals(matrix, expectedMatrix); 59 assert_matrix_almost_equals(matrix, expectedMatrix);
60 }, "DOMMatrixReadOnly(transformList) - transformList"); 60 }, "DOMMatrixReadOnly(transformList) - transformList");
61 61
62 test(() => { 62 test(() => {
63 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1]); 63 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1.123456789]);
64 assert_true(matrix2d.is2D); 64 assert_true(matrix2d.is2D);
65 assert_equals(matrix2d.toString(), "matrix(1, 2, 3, 3.1, 2, 1)"); 65 assert_equals(matrix2d.toString(), "matrix(1, 2, 3, 3.1, 2, 1.123456789)");
66 }, "DOMMatrixReadOnly toString() - 2D matrix"); 66 }, "DOMMatrixReadOnly toString() - 2D matrix");
67 67
68 test(() => { 68 test(() => {
69 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]); 69 var matrix2d = new DOMMatrixReadOnly([NaN, NaN, NaN, NaN, NaN, NaN]);
fserb 2017/05/18 17:10:54 tests like this are very misleading. Because you a
Byoungkwon Ko 2017/05/20 08:41:29 As you know, I am newbie for chromium. I tried to
70 assert_true(matrix2d.is2D);
71 assert_throws(null, () => { matrix2d.toString() });
72 }, "DOMMatrixReadOnly toString() - 2D matrix with NaN");
73
74 test(() => {
75 var matrix2d = new DOMMatrixReadOnly([Infinity, Infinity, Infinity, Infinity, Infinity, Infinity]);
76 assert_true(matrix2d.is2D);
77 assert_throws(null, () => { matrix2d.toString() });
78 }, "DOMMatrixReadOnly toString() - 2D matrix with Infinity");
79
80 test(() => {
81 var matrix2d = new DOMMatrixReadOnly([-Infinity, -Infinity, -Infinity, -Infini ty, -Infinity, -Infinity]);
82 assert_true(matrix2d.is2D);
83 assert_throws(null, () => { matrix2d.toString() });
84 }, "DOMMatrixReadOnly toString() - 2D matrix with -Infinity");
85
86 test(() => {
87 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.123456789]);
70 assert_false(matrix3d.is2D); 88 assert_false(matrix3d.is2D);
71 assert_equals(matrix3d.toString(), "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6)"); 89
90 assert_equals(matrix3d.toString(), "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.123456789)");
72 }, "DOMMatrixReadOnly toString() - 3D matrix"); 91 }, "DOMMatrixReadOnly toString() - 3D matrix");
73 92
74 test(() => { 93 test(() => {
75 var identity_matrix = DOMMatrixReadOnly.fromMatrix(); 94 var matrix3d = new DOMMatrixReadOnly([NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
95 assert_false(matrix3d.is2D);
96 assert_throws(null, () => { matrix3d.toString() });
97 }, "DOMMatrixReadOnly toString() - 3D matrix with NaN");
98
99 test(() => {
100 var matrix3d = new DOMMatrixReadOnly([Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity]);
101 assert_false(matrix3d.is2D);
102 assert_throws(null, () => { matrix3d.toString() });
103 }, "DOMMatrixReadOnly toString() - 3D matrix with Infinity");
104
105 test(() => {
106 var matrix3d = new DOMMatrixReadOnly([-Infinity, -Infinity, -Infinity, -Infini ty, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity, -Infinity]);
107 assert_false(matrix3d.is2D);
108 assert_throws(null, () => { matrix3d.toString() });
109 }, "DOMMatrixReadOnly toString() - 3D matrix with -Infinity");
110
111 test(() => { var identity_matrix = DOMMatrixReadOnly.fromMatrix();
76 assert_true(identity_matrix.is2D); 112 assert_true(identity_matrix.is2D);
77 assert_object_equals(identity_matrix.toJSON(), 113 assert_object_equals(identity_matrix.toJSON(),
78 { a : 1, b : 0, c : 0, d : 1, e : 0, f : 0, 114 { a : 1, b : 0, c : 0, d : 1, e : 0, f : 0,
79 is2D : true, isIdentity : true, 115 is2D : true, isIdentity : true,
80 m11 : 1, m12 : 0, m13 : 0, m14 : 0, 116 m11 : 1, m12 : 0, m13 : 0, m14 : 0,
81 m21 : 0, m22 : 1, m23 : 0, m24 : 0, 117 m21 : 0, m22 : 1, m23 : 0, m24 : 0,
82 m31 : 0, m32 : 0, m33 : 1, m34 : 0, 118 m31 : 0, m32 : 0, m33 : 1, m34 : 0,
83 m41 : 0, m42 : 0, m43 : 0, m44 : 1}); 119 m41 : 0, m42 : 0, m43 : 0, m44 : 1});
84 }, "DOMMatrixReadOnly toJSON() - identity matrix"); 120 }, "DOMMatrixReadOnly toJSON() - identity matrix");
85 121
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 test(() => { 271 test(() => {
236 assert_throws(new TypeError(), () => { 272 assert_throws(new TypeError(), () => {
237 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); 273 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true});
238 }, "The 'is2D' property is set to true but the input matrix is 3d matrix"); 274 }, "The 'is2D' property is set to true but the input matrix is 3d matrix");
239 assert_throws(new TypeError(), () => { 275 assert_throws(new TypeError(), () => {
240 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m11: 3}); 276 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m11: 3});
241 }, "The 'a' property should equal the 'm11' property"); 277 }, "The 'a' property should equal the 'm11' property");
242 }, "DOMMatrixReadOnly.fromMatrix(): Exception test"); 278 }, "DOMMatrixReadOnly.fromMatrix(): Exception test");
243 279
244 </script> 280 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698