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 |
| 7 test(function() { |
| 8 var matrix = new DOMMatrix(); |
| 9 assert_identity_2d_matrix(matrix); |
| 10 var result = matrix.scale(); |
| 11 assert_identity_2d_matrix(result); |
| 12 assert_identity_2d_matrix(matrix); |
| 13 assert_not_equals(result, matrix, 'result and matrix should be different objec
t'); |
| 14 }, "DOMMatrix.scale()"); |
| 15 |
6 test(function() { | 16 test(function() { |
7 var matrix = new DOMMatrix(); | 17 var matrix = new DOMMatrix(); |
8 assert_identity_2d_matrix(matrix); | 18 assert_identity_2d_matrix(matrix); |
9 var result = matrix.scale(3); | 19 var result = matrix.scale(3); |
10 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); | 20 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
11 assert_identity_2d_matrix(matrix); | 21 assert_identity_2d_matrix(matrix); |
12 }, "DOMMatrix.scale(scale)"); | 22 }, "DOMMatrix.scale(sx)"); |
13 | 23 |
14 test(function() { | 24 test(function() { |
15 var matrix = new DOMMatrix(); | 25 var matrix = new DOMMatrix(); |
16 assert_identity_2d_matrix(matrix); | 26 assert_identity_2d_matrix(matrix); |
17 var result = matrix.scale(3, 4, 2); | 27 var result = matrix.scale(3, 3); |
18 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); | 28 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
19 assert_identity_2d_matrix(matrix); | 29 assert_identity_2d_matrix(matrix); |
20 }, "DOMMatrix.scale(scale, ox, oy)"); | 30 }, "DOMMatrix.scale(sx, sy)"); |
21 | 31 |
22 test(function() { | 32 test(function() { |
23 var matrix = new DOMMatrix(); | 33 var matrix = new DOMMatrix(); |
| 34 assert_identity_2d_matrix(matrix); |
| 35 var result = matrix.scale(3, 8); |
| 36 assert_2d_matrix_equals(result, [3, 0, 0, 8, 0, 0]); |
| 37 assert_identity_2d_matrix(matrix); |
| 38 }, "DOMMatrix.scale(sx, sy)"); |
| 39 |
| 40 test(function() { |
| 41 var matrix = new DOMMatrix(); |
| 42 assert_identity_2d_matrix(matrix); |
| 43 var result = matrix.scale(3, 3, 1, 4, 2); |
| 44 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); |
| 45 assert_identity_2d_matrix(matrix); |
| 46 }, "DOMMatrix.scale(sx, sy, sz, ox, oy)"); |
| 47 |
| 48 test(function() { |
| 49 var matrix = new DOMMatrix(); |
| 50 assert_identity_2d_matrix(matrix); |
| 51 var result = matrix.scale(2, 3, 0.5, 2, -4, -1); |
| 52 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); |
| 53 assert_identity_2d_matrix(matrix); |
| 54 }, "DOMMatrix.scale(sx, sy, sz, ox, oy, oz)"); |
| 55 |
| 56 test(function() { |
| 57 var matrix = new DOMMatrix(); |
24 assert_identity_2d_matrix(matrix); | 58 assert_identity_2d_matrix(matrix); |
25 var result = matrix.scale3d(3); | 59 var result = matrix.scale3d(3); |
26 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0,
1]); | 60 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0,
1]); |
27 assert_identity_2d_matrix(matrix); | 61 assert_identity_2d_matrix(matrix); |
28 }, "DOMMatrix.scale3d(scale)"); | 62 }, "DOMMatrix.scale3d(scale)"); |
29 | 63 |
30 test(function() { | 64 test(function() { |
31 var matrix = new DOMMatrix(); | 65 var matrix = new DOMMatrix(); |
32 assert_identity_2d_matrix(matrix); | 66 assert_identity_2d_matrix(matrix); |
33 var result = matrix.scale3d(3, 2, 7, -1); | 67 var result = matrix.scale3d(3, 2, 7, -1); |
34 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14,
2, 1]); | 68 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14,
2, 1]); |
35 assert_identity_2d_matrix(matrix); | 69 assert_identity_2d_matrix(matrix); |
36 }, "DOMMatrix.scale3d(scale, ox, oy, oz)"); | 70 }, "DOMMatrix.scale3d(scale, ox, oy, oz)"); |
37 | 71 |
38 test(function() { | 72 test(function() { |
39 var matrix = new DOMMatrix(); | 73 var matrix = new DOMMatrix(); |
40 assert_identity_2d_matrix(matrix); | 74 assert_identity_2d_matrix(matrix); |
41 var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1); | 75 var result = matrix.scaleSelf(); |
42 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); | 76 assert_identity_2d_matrix(result); |
43 assert_identity_2d_matrix(matrix); | 77 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
44 }, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)"); | 78 }, "DOMMatrix.scaleSelf()"); |
45 | 79 |
46 test(function() { | 80 test(function() { |
47 var matrix = new DOMMatrix(); | 81 var matrix = new DOMMatrix(); |
48 assert_identity_2d_matrix(matrix); | 82 assert_identity_2d_matrix(matrix); |
49 var result = matrix.scaleSelf(3); | 83 var result = matrix.scaleSelf(3); |
50 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); | 84 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
51 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, 0, 0]); | 85 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
52 }, "DOMMatrix.scaleSelf(scale)"); | 86 }, "DOMMatrix.scaleSelf(sx)"); |
53 | 87 |
54 test(function() { | 88 test(function() { |
55 var matrix = new DOMMatrix(); | 89 var matrix = new DOMMatrix(); |
56 assert_identity_2d_matrix(matrix); | 90 assert_identity_2d_matrix(matrix); |
57 var result = matrix.scaleSelf(3, 4, 2); | 91 var result = matrix.scaleSelf(3, 3); |
| 92 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
| 93 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
| 94 }, "DOMMatrix.scaleSelf(sx, sy)"); |
| 95 |
| 96 test(function() { |
| 97 var matrix = new DOMMatrix(); |
| 98 assert_identity_2d_matrix(matrix); |
| 99 var result = matrix.scaleSelf(3, 7); |
| 100 assert_2d_matrix_equals(result, [3, 0, 0, 7, 0, 0]); |
| 101 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
| 102 }, "DOMMatrix.scaleSelf(sx, sy)"); |
| 103 |
| 104 test(function() { |
| 105 var matrix = new DOMMatrix(); |
| 106 assert_identity_2d_matrix(matrix); |
| 107 var result = matrix.scaleSelf(3, 3, 1, 4, 2); |
58 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); | 108 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); |
59 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, -8, -4]); | 109 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
60 }, "DOMMatrix.scaleSelf(scale)"); | 110 }, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy)"); |
| 111 |
| 112 test(function() { |
| 113 var matrix = new DOMMatrix(); |
| 114 assert_identity_2d_matrix(matrix); |
| 115 var result = matrix.scaleSelf(2, 3, 0.5, 2, -4, -1); |
| 116 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); |
| 117 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
| 118 }, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy, oz)"); |
| 119 |
| 120 // origin value is used to move base point before scale. |
| 121 // after scale, base point is return to negative origin value. |
| 122 // if scale value were 1, value of matrix should be same before scale. |
| 123 test(function() { |
| 124 var matrix = new DOMMatrix(); |
| 125 assert_identity_2d_matrix(matrix); |
| 126 var result = matrix.scaleSelf(1, 1, 1, 2, -4, -1); |
| 127 assert_identity_3d_matrix(result); |
| 128 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
| 129 }, "DOMMatrix.scaleSelf(1, 1, 1, ox, oy, oz)"); |
61 | 130 |
62 test(function() { | 131 test(function() { |
63 var matrix = new DOMMatrix(); | 132 var matrix = new DOMMatrix(); |
64 assert_identity_2d_matrix(matrix); | 133 assert_identity_2d_matrix(matrix); |
65 var result = matrix.scale3dSelf(3); | 134 var result = matrix.scale3dSelf(3); |
66 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0,
1]); | 135 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0,
1]); |
67 assert_3d_matrix_equals(matrix, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0,
1]); | 136 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
68 }, "DOMMatrix.scale3dSelf(scale)"); | 137 }, "DOMMatrix.scale3dSelf(scale)"); |
69 | 138 |
70 test(function() { | 139 test(function() { |
71 var matrix = new DOMMatrix(); | 140 var matrix = new DOMMatrix(); |
72 assert_identity_2d_matrix(matrix); | 141 assert_identity_2d_matrix(matrix); |
73 var result = matrix.scale3dSelf(3, 2, 7, -1); | 142 var result = matrix.scale3dSelf(3, 2, 7, -1); |
74 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14,
2, 1]); | 143 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14,
2, 1]); |
75 assert_3d_matrix_equals(matrix, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14,
2, 1]); | 144 assert_equals(result, matrix, 'result and matrix should be the exact same obje
ct'); |
76 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)"); | 145 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)"); |
77 | 146 |
78 test(function() { | |
79 var matrix = new DOMMatrix(); | |
80 assert_identity_2d_matrix(matrix); | |
81 var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1); | |
82 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); | |
83 assert_3d_matrix_equals(matrix, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); | |
84 }, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)"); | |
85 | |
86 test(function() { | |
87 var matrix = new DOMMatrix(); | |
88 assert_identity_2d_matrix(matrix); | |
89 var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1); | |
90 assert_identity_3d_matrix(result); | |
91 assert_identity_3d_matrix(matrix); | |
92 }, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)"); | |
93 </script> | 147 </script> |
OLD | NEW |