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

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

Issue 2516973002: [GeometryInferface] add Constructor(DOMString transformList). (Closed)
Patch Set: [GeometryInferface] add Constructor(DOMString transformList). Created 4 years 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 28 matching lines...) Expand all
39 }, "DOMMatrixReadOnly fromFloat32Array - 3D matrix"); 39 }, "DOMMatrixReadOnly fromFloat32Array - 3D matrix");
40 40
41 test(() => { 41 test(() => {
42 // 10.1 and 16.6 are not representable as a 32-bit float 42 // 10.1 and 16.6 are not representable as a 32-bit float
43 var float64Array = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]); 43 var float64Array = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]);
44 var matrix3d = DOMMatrixReadOnly.fromFloat64Array(float64Array); 44 var matrix3d = DOMMatrixReadOnly.fromFloat64Array(float64Array);
45 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13 , 14, 15, 16.6]); 45 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13 , 14, 15, 16.6]);
46 }, "DOMMatrixReadOnly fromFloat64Array - 3D matrix"); 46 }, "DOMMatrixReadOnly fromFloat64Array - 3D matrix");
47 47
48 test(() => { 48 test(() => {
49 var matrix = new DOMMatrixReadOnly("");
50 assert_identity_2d_matrix(matrix);
51 }, "DOMMatrixReadOnly(transformList) - emptyString");
52
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)");
55 var expectedMatrix = new DOMMatrixReadOnly();
56 expectedMatrix = expectedMatrix.multiply(new DOMMatrixReadOnly([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]))
57 expectedMatrix = expectedMatrix.translate(44, 55)
58 expectedMatrix = expectedMatrix.skewX(30);
59 assert_matrix_almost_equals(matrix, expectedMatrix);
60 }, "DOMMatrixReadOnly(transformList) - transformList");
61
62 test(() => {
49 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1]); 63 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1]);
50 assert_true(matrix2d.is2D); 64 assert_true(matrix2d.is2D);
51 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)");
52 }, "DOMMatrixReadOnly toString() - 2D matrix"); 66 }, "DOMMatrixReadOnly toString() - 2D matrix");
53 67
54 test(() => { 68 test(() => {
55 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]); 69 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6]);
56 assert_false(matrix3d.is2D); 70 assert_false(matrix3d.is2D);
57 assert_equals(matrix3d.toString(), "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6)"); 71 assert_equals(matrix3d.toString(), "matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6)");
58 }, "DOMMatrixReadOnly toString() - 3D matrix"); 72 }, "DOMMatrixReadOnly toString() - 3D matrix");
(...skipping 28 matching lines...) Expand all
87 assert_object_equals(matrix3d.toJSON(), 101 assert_object_equals(matrix3d.toJSON(),
88 { a : 1, b : 2, c : 5, d : 6, e : 13, f : 14, 102 { a : 1, b : 2, c : 5, d : 6, e : 13, f : 14,
89 is2D : false, isIdentity : false, 103 is2D : false, isIdentity : false,
90 m11 : 1, m12 : 2, m13 : 3, m14 : 4, 104 m11 : 1, m12 : 2, m13 : 3, m14 : 4,
91 m21 : 5, m22 : 6, m23 : 7, m24 : 8, 105 m21 : 5, m22 : 6, m23 : 7, m24 : 8,
92 m31 : 9, m32 : 10.1, m33 : 11, m34 : 12, 106 m31 : 9, m32 : 10.1, m33 : 11, m34 : 12,
93 m41 : 13, m42 : 14, m43 : 15, m44 : 16.6}); 107 m41 : 13, m42 : 14, m43 : 15, m44 : 16.6});
94 }, "DOMMatrixReadOnly toJSON() - 3D matrix"); 108 }, "DOMMatrixReadOnly toJSON() - 3D matrix");
95 109
96 test(() => { 110 test(() => {
97 assert_throws(new TypeError(), () => { new DOMMatrixReadOnly(1, 2, 3, 4, 5, 6) ; }, 111 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly(1, 2, 3, 4, 5, 6); },
98 "DOMMatrixReadOnly constructor only accepts 1 argument"); 112 "DOMMatrixReadOnly(transformList) can't parse unknown keyword - DOMMatrixRea dOnly(1, 2, 3, 4, 5, 6) is same with DOMMatrixReadOnly('1')");
99 assert_throws(new TypeError(), () => { new DOMMatrixReadOnly("myString"); }, 113 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("myString"); },
100 "DOMMatrixReadOnly constructor only accepts 1 number sequence"); 114 "DOMMatrixReadOnly(transformList) can't parse unknown keyword.");
115 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("initial");},
116 "CSS-wide keywords are disallowed.");
117 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("notExistFuncti on()"); },
118 "can't parse not exist function.");
119 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateY(50% )"); },
120 "Must have an absolute unit.");
dominicc (has gone to gerrit) 2016/12/06 08:44:24 Let's make these descriptive about what's being te
Hwanseung Lee 2016/12/07 13:56:59 i checked test harness errors message. your though
121 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(1.2 em)"); },
122 "Must have an absolute unit.");
123 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10e x)"); },
124 "Must have an absolute unit.");
125 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10c h)"); },
126 "Must have an absolute unit.");
127 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10r em)"); },
128 "Must have an absolute unit.");
129 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10v w)"); },
130 "Must have an absolute unit.");
131 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10v h)"); },
132 "Must have an absolute unit.");
133 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10v min)"); },
134 "Must have an absolute unit.");
135 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(10v max)"); },
136 "Must have an absolute unit.");
137 assert_throws(new SyntaxError(), () => { new DOMMatrixReadOnly("translateX(cal c(10px + 1em))"); },
138 "Must have an absolute unit.");
101 assert_throws(new TypeError(), () => { new DOMMatrixReadOnly([1, 2, 3]); }, 139 assert_throws(new TypeError(), () => { new DOMMatrixReadOnly([1, 2, 3]); },
102 "DOMMatrixReadOnly constructor only accepts 1 number sequence with 6 or 16 e lements."); 140 "DOMMatrixReadOnly constructor only accepts 1 number sequence with 6 or 16 e lements.");
103 }, "DOMMatrixReadOnly constructor - invalid arguments"); 141 }, "DOMMatrixReadOnly constructor - invalid arguments");
104 142
105 test(() => { 143 test(() => {
106 assert_throws(new TypeError(), () => { DOMMatrixReadOnly.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5])); }, 144 assert_throws(new TypeError(), () => { DOMMatrixReadOnly.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5])); },
107 "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements ."); 145 "fromFloat32Array function only accepts 1 Float32Array with 6 or 16 elements .");
108 assert_throws(new TypeError(), () => { DOMMatrixReadOnly.fromFloat64Array(new Float64Array([1, 2, 3, 4, 5])); }, 146 assert_throws(new TypeError(), () => { DOMMatrixReadOnly.fromFloat64Array(new Float64Array([1, 2, 3, 4, 5])); },
109 "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements ."); 147 "fromFloat64Array function only accepts 1 Float64Array with 6 or 16 elements .");
110 assert_throws(new TypeError(), () => { DOMMatrixReadOnly.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5, 6 ,7])); }, 148 assert_throws(new TypeError(), () => { DOMMatrixReadOnly.fromFloat32Array(new Float32Array([1, 2, 3, 4, 5, 6 ,7])); },
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 test(() => { 226 test(() => {
189 assert_throws(new TypeError(), () => { 227 assert_throws(new TypeError(), () => {
190 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); 228 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true});
191 }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); 229 }, "The 'is2D' property is set to true but the input matrix is 3d matrix.");
192 assert_throws(new TypeError(), () => { 230 assert_throws(new TypeError(), () => {
193 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m11: 3}); 231 DOMMatrixReadOnly.fromMatrix({a: 1, b: 2, m11: 3});
194 }, "The 'a' property should equal the 'm11' property."); 232 }, "The 'a' property should equal the 'm11' property.");
195 }, "DOMMatrixReadOnly.fromMatrix(): Exception test."); 233 }, "DOMMatrixReadOnly.fromMatrix(): Exception test.");
196 234
197 </script> 235 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698