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