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 }, "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, 3, 1, 4, 2); |
| 35 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); |
| 36 assert_identity_2d_matrix(matrix); |
| 37 }, "DOMMatrix.scale(sx, sy, sz, ox, oy)"); |
| 38 |
| 39 test(function() { |
| 40 var matrix = new DOMMatrix(); |
| 41 assert_identity_2d_matrix(matrix); |
| 42 var result = matrix.scale(2, 3, 0.5, 2, -4, -1); |
| 43 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); |
| 44 assert_identity_2d_matrix(matrix); |
| 45 }, "DOMMatrix.scale(sx, sy, sz, ox, oy, oz)"); |
| 46 |
| 47 test(function() { |
| 48 var matrix = new DOMMatrix(); |
24 assert_identity_2d_matrix(matrix); | 49 assert_identity_2d_matrix(matrix); |
25 var result = matrix.scale3d(3); | 50 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]); | 51 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); | 52 assert_identity_2d_matrix(matrix); |
28 }, "DOMMatrix.scale3d(scale)"); | 53 }, "DOMMatrix.scale3d(scale)"); |
29 | 54 |
30 test(function() { | 55 test(function() { |
31 var matrix = new DOMMatrix(); | 56 var matrix = new DOMMatrix(); |
32 assert_identity_2d_matrix(matrix); | 57 assert_identity_2d_matrix(matrix); |
33 var result = matrix.scale3d(3, 2, 7, -1); | 58 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]); | 59 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); | 60 assert_identity_2d_matrix(matrix); |
36 }, "DOMMatrix.scale3d(scale, ox, oy, oz)"); | 61 }, "DOMMatrix.scale3d(scale, ox, oy, oz)"); |
37 | 62 |
38 test(function() { | 63 test(function() { |
39 var matrix = new DOMMatrix(); | 64 var matrix = new DOMMatrix(); |
40 assert_identity_2d_matrix(matrix); | 65 assert_identity_2d_matrix(matrix); |
41 var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1); | 66 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]); | 67 assert_identity_2d_matrix(result); |
43 assert_identity_2d_matrix(matrix); | 68 assert_identity_2d_matrix(matrix); |
44 }, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)"); | 69 }, "DOMMatrix.scaleSelf()"); |
45 | 70 |
46 test(function() { | 71 test(function() { |
47 var matrix = new DOMMatrix(); | 72 var matrix = new DOMMatrix(); |
48 assert_identity_2d_matrix(matrix); | 73 assert_identity_2d_matrix(matrix); |
49 var result = matrix.scaleSelf(3); | 74 var result = matrix.scaleSelf(3); |
50 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); | 75 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
51 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, 0, 0]); | 76 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, 0, 0]); |
52 }, "DOMMatrix.scaleSelf(scale)"); | 77 }, "DOMMatrix.scaleSelf(sx)"); |
53 | 78 |
54 test(function() { | 79 test(function() { |
55 var matrix = new DOMMatrix(); | 80 var matrix = new DOMMatrix(); |
56 assert_identity_2d_matrix(matrix); | 81 assert_identity_2d_matrix(matrix); |
57 var result = matrix.scaleSelf(3, 4, 2); | 82 var result = matrix.scaleSelf(3, 3); |
58 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); | 83 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]); |
59 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, -8, -4]); | 84 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, 0, 0]); |
60 }, "DOMMatrix.scaleSelf(scale)"); | 85 }, "DOMMatrix.scaleSelf(sx, sy)"); |
61 | 86 |
62 test(function() { | 87 test(function() { |
63 var matrix = new DOMMatrix(); | 88 var matrix = new DOMMatrix(); |
| 89 assert_identity_2d_matrix(matrix); |
| 90 var result = matrix.scaleSelf(3, 3, 1, 4, 2); |
| 91 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]); |
| 92 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, -8, -4]); |
| 93 }, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy)"); |
| 94 |
| 95 test(function() { |
| 96 var matrix = new DOMMatrix(); |
| 97 assert_identity_2d_matrix(matrix); |
| 98 var result = matrix.scaleSelf(2, 3, 0.5, 2, -4, -1); |
| 99 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); |
| 100 assert_3d_matrix_equals(matrix, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8,
-0.5, 1]); |
| 101 }, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy, oz)"); |
| 102 |
| 103 test(function() { |
| 104 var matrix = new DOMMatrix(); |
| 105 assert_identity_2d_matrix(matrix); |
| 106 var result = matrix.scaleSelf(1, 1, 1, 2, -4, -1); |
| 107 assert_identity_3d_matrix(result); |
| 108 assert_identity_3d_matrix(matrix); |
| 109 }, "DOMMatrix.scaleSelf(1, 1, 1, ox, oy, oz)"); |
| 110 |
| 111 test(function() { |
| 112 var matrix = new DOMMatrix(); |
64 assert_identity_2d_matrix(matrix); | 113 assert_identity_2d_matrix(matrix); |
65 var result = matrix.scale3dSelf(3); | 114 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]); | 115 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]); | 116 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)"); | 117 }, "DOMMatrix.scale3dSelf(scale)"); |
69 | 118 |
70 test(function() { | 119 test(function() { |
71 var matrix = new DOMMatrix(); | 120 var matrix = new DOMMatrix(); |
72 assert_identity_2d_matrix(matrix); | 121 assert_identity_2d_matrix(matrix); |
73 var result = matrix.scale3dSelf(3, 2, 7, -1); | 122 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]); | 123 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]); | 124 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)"); | 125 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)"); |
77 | 126 |
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> | 127 </script> |
OLD | NEW |