OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 }, "DOMMatrix fromFloat32Array - 3D matrix"); | 28 }, "DOMMatrix fromFloat32Array - 3D matrix"); |
29 | 29 |
30 test(() => { | 30 test(() => { |
31 // 10.1 and 16.6 are not representable as a 32-bit float | 31 // 10.1 and 16.6 are not representable as a 32-bit float |
32 var float64Array = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12,
13, 14, 15, 16.6]); | 32 var float64Array = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12,
13, 14, 15, 16.6]); |
33 var matrix3d = DOMMatrix.fromFloat64Array(float64Array); | 33 var matrix3d = DOMMatrix.fromFloat64Array(float64Array); |
34 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); | 34 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); |
35 }, "DOMMatrix fromFloat64Array - 3D matrix"); | 35 }, "DOMMatrix fromFloat64Array - 3D matrix"); |
36 | 36 |
37 test(() => { | 37 test(() => { |
| 38 var matrix = new DOMMatrix(""); |
| 39 assert_identity_2d_matrix(matrix); |
| 40 }, "DOMMatrix(transformList) - emptyString"); |
| 41 |
| 42 test(() => { |
| 43 var matrix = new DOMMatrix("matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0) translate(44p
x, 55px) skewX(30deg)"); |
| 44 var expectedMatrix = new DOMMatrix(); |
| 45 expectedMatrix.multiplySelf(new DOMMatrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) |
| 46 expectedMatrix.translateSelf(44, 55) |
| 47 expectedMatrix.skewXSelf(30); |
| 48 assert_matrix_almost_equals(matrix, expectedMatrix); |
| 49 }, "DOMMatrix(transformList) - transformList"); |
| 50 |
| 51 test(() => { |
38 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 52 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
39 assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]); | 53 assert_2d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6]); |
40 }, "DOMMatrix(numberSequence) constructor"); | 54 }, "DOMMatrix(numberSequence) constructor"); |
41 | 55 |
42 test(() => { | 56 test(() => { |
43 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16]); | 57 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16]); |
44 assert_3d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
, 15, 16]); | 58 assert_3d_matrix_equals(matrix, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
, 15, 16]); |
45 }, "DOMMatrix(numberSequence) constructor"); | 59 }, "DOMMatrix(numberSequence) constructor"); |
46 | 60 |
47 test(() => { | 61 test(() => { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 }, "DOMMatrix toJSON() - 3D matrix"); | 199 }, "DOMMatrix toJSON() - 3D matrix"); |
186 | 200 |
187 test(() => { | 201 test(() => { |
188 assert_throws(new TypeError(), () => { | 202 assert_throws(new TypeError(), () => { |
189 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); | 203 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); |
190 }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); | 204 }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); |
191 assert_throws(new TypeError(), () => { | 205 assert_throws(new TypeError(), () => { |
192 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3}); | 206 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3}); |
193 }, "The 'a' property should equal the 'm11' property."); | 207 }, "The 'a' property should equal the 'm11' property."); |
194 }, "DOMMatrix.fromMatrix(): Exception test."); | 208 }, "DOMMatrix.fromMatrix(): Exception test."); |
| 209 |
195 </script> | 210 </script> |
OLD | NEW |