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 |
6 test(function() { | 7 test(function() { |
7 var matrix = new DOMMatrix(); | 8 var matrix = new DOMMatrix(); |
8 assert_identity_2d_matrix(matrix); | 9 assert_identity_2d_matrix(matrix); |
| 10 var result = matrix.translate(); |
| 11 assert_identity_2d_matrix(result); |
| 12 assert_identity_2d_matrix(matrix); |
| 13 }, "DOMMatrix.translate()"); |
| 14 |
| 15 test(function() { |
| 16 var matrix = new DOMMatrix(); |
| 17 assert_identity_2d_matrix(matrix); |
| 18 var result = matrix.translate(6); |
| 19 assert_2d_matrix_equals(result, [1, 0, 0, 1, 6, 0]); |
| 20 assert_identity_2d_matrix(matrix); |
| 21 }, "DOMMatrix.translate(tx)"); |
| 22 |
| 23 test(function() { |
| 24 var matrix = new DOMMatrix(); |
| 25 assert_identity_2d_matrix(matrix); |
9 var result = matrix.translate(2, 3); | 26 var result = matrix.translate(2, 3); |
10 assert_2d_matrix_equals(result, [1, 0, 0, 1, 2, 3]); | 27 assert_2d_matrix_equals(result, [1, 0, 0, 1, 2, 3]); |
11 assert_identity_2d_matrix(matrix); | 28 assert_identity_2d_matrix(matrix); |
12 }, "DOMMatrix.translate(tx, ty)"); | 29 }, "DOMMatrix.translate(tx, ty)"); |
13 | 30 |
14 test(function() { | 31 test(function() { |
15 var matrix = new DOMMatrix(); | 32 var matrix = new DOMMatrix(); |
16 matrix.translateSelf(2, 3); | 33 matrix.translateSelf(2, 3); |
17 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]); | 34 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]); |
18 var result = matrix.translate(4, 2); | 35 var result = matrix.translate(4, 2); |
19 assert_2d_matrix_equals(result, [1, 0, 0, 1, 6, 5]); | 36 assert_2d_matrix_equals(result, [1, 0, 0, 1, 6, 5]); |
20 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]); | 37 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]); |
21 }, "DOMMatrix.translate(tx, ty) with non-identity"); | 38 }, "DOMMatrix.translate(tx, ty) with non-identity"); |
22 | 39 |
23 test(function() { | 40 test(function() { |
24 var matrix = new DOMMatrix(); | 41 var matrix = new DOMMatrix(); |
25 assert_identity_2d_matrix(matrix); | 42 assert_identity_2d_matrix(matrix); |
| 43 var result = matrix.translateSelf(); |
| 44 assert_identity_2d_matrix(result); |
| 45 assert_identity_2d_matrix(matrix); |
| 46 }, "DOMMatrix.translateSelf()"); |
| 47 |
| 48 test(function() { |
| 49 var matrix = new DOMMatrix(); |
| 50 assert_identity_2d_matrix(matrix); |
| 51 var result = matrix.translateSelf(5); |
| 52 assert_2d_matrix_equals(result, [1, 0, 0, 1, 5, 0]); |
| 53 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 5, 0]); |
| 54 }, "DOMMatrix.translateSelf(tx)"); |
| 55 |
| 56 test(function() { |
| 57 var matrix = new DOMMatrix(); |
| 58 assert_identity_2d_matrix(matrix); |
26 var result = matrix.translateSelf(4, 2); | 59 var result = matrix.translateSelf(4, 2); |
27 assert_2d_matrix_equals(result, [1, 0, 0, 1, 4, 2]); | 60 assert_2d_matrix_equals(result, [1, 0, 0, 1, 4, 2]); |
28 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 4, 2]); | 61 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 4, 2]); |
29 }, "DOMMatrix.translateSelf(tx, ty)"); | 62 }, "DOMMatrix.translateSelf(tx, ty)"); |
30 | 63 |
31 test(function() { | 64 test(function() { |
32 var matrix = new DOMMatrix(); | 65 var matrix = new DOMMatrix(); |
33 assert_identity_2d_matrix(matrix); | 66 assert_identity_2d_matrix(matrix); |
34 var result = matrix.translate(2, 3, 4); | 67 var result = matrix.translate(2, 3, 4); |
35 assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4,
1]); | 68 assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4,
1]); |
(...skipping 22 matching lines...) Expand all Loading... |
58 assert_identity_2d_matrix(matrix); | 91 assert_identity_2d_matrix(matrix); |
59 matrix.m14 = 2; | 92 matrix.m14 = 2; |
60 matrix.m24 = 3; | 93 matrix.m24 = 3; |
61 matrix.m34 = 4; | 94 matrix.m34 = 4; |
62 matrix.m44 = 7; | 95 matrix.m44 = 7; |
63 assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 0, 0, 0,
7]); | 96 assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 0, 0, 0,
7]); |
64 matrix.translateSelf(7, -8, 2); | 97 matrix.translateSelf(7, -8, 2); |
65 assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 7, -8, 2,
5]); | 98 assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 7, -8, 2,
5]); |
66 }, "DOMMatrix.translateSelf(tx, ty, tz) Homogeneous Coordinates"); | 99 }, "DOMMatrix.translateSelf(tx, ty, tz) Homogeneous Coordinates"); |
67 </script> | 100 </script> |
OLD | NEW |