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 |
11 test(() => { | 11 test(() => { |
12 var other = new DOMMatrix(); | |
13 other.m11 = 10; | |
14 other.m12 = 20; | |
15 other.m24 = 2; | |
16 other.m33 = 3; | |
17 other.m42 = 3; | |
18 other.m44 = 9; | |
19 var matrix = new DOMMatrix(other); | |
20 assert_3d_matrix_equals(matrix, [10, 20, 0, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 3, 0
, 9]); | |
21 }, "DOMMatrix(other) constructor"); | |
22 | |
23 test(() => { | |
24 var float32Array = new Float32Array([1, 2, 3, 4, 5, 6]); | 12 var float32Array = new Float32Array([1, 2, 3, 4, 5, 6]); |
25 var matrix2d = DOMMatrix.fromFloat32Array(float32Array); | 13 var matrix2d = DOMMatrix.fromFloat32Array(float32Array); |
26 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 4, 5, 6]); | 14 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 4, 5, 6]); |
27 }, "DOMMatrix fromFloat32Array - 2D matrix"); | 15 }, "DOMMatrix fromFloat32Array - 2D matrix"); |
28 | 16 |
29 test(() => { | 17 test(() => { |
30 // 3.1 is not representable as a 32-bit float | 18 // 3.1 is not representable as a 32-bit float |
31 var float64Array = new Float64Array([1, 2, 3, 3.1, 4, 5]); | 19 var float64Array = new Float64Array([1, 2, 3, 3.1, 4, 5]); |
32 var matrix2d = DOMMatrix.fromFloat64Array(float64Array); | 20 var matrix2d = DOMMatrix.fromFloat64Array(float64Array); |
33 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 4, 5]); | 21 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 4, 5]); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 186 |
199 test(() => { | 187 test(() => { |
200 assert_throws(new TypeError(), () => { | 188 assert_throws(new TypeError(), () => { |
201 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); | 189 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m33: 3, m44: 4, is2D: true}); |
202 }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); | 190 }, "The 'is2D' property is set to true but the input matrix is 3d matrix."); |
203 assert_throws(new TypeError(), () => { | 191 assert_throws(new TypeError(), () => { |
204 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3}); | 192 var matrix = DOMMatrix.fromMatrix({a: 1, b: 2, m11: 3}); |
205 }, "The 'a' property should equal the 'm11' property."); | 193 }, "The 'a' property should equal the 'm11' property."); |
206 }, "DOMMatrix.fromMatrix(): Exception test."); | 194 }, "DOMMatrix.fromMatrix(): Exception test."); |
207 </script> | 195 </script> |
OLD | NEW |