OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | |
3 <head> | |
4 <title>Geometry Interfaces: DOMMatrix skew</title> | |
5 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
7 </head> | 4 <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
8 <body> | |
9 <script> | 5 <script> |
10 | |
11 // TODO(hs1217.lee): create the DOMMatrix directly when the sequence constructor
is supported. | 6 // TODO(hs1217.lee): create the DOMMatrix directly when the sequence constructor
is supported. |
12 function initMatrix(values) { | 7 function initMatrix(values) { |
13 return new DOMMatrixReadOnly(values); | 8 return new DOMMatrixReadOnly(values); |
14 } | 9 } |
15 | 10 |
16 test(function() { | 11 test(function() { |
17 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); | 12 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); |
18 matrix2d.skewXSelf(); | 13 matrix2d.skewXSelf(); |
19 assert_true(matrix2d.is2D); | 14 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 2, 1]); |
20 assert_equals(matrix2d.a, 1); | |
21 assert_equals(matrix2d.b, 2); | |
22 assert_equals(matrix2d.c, 3); | |
23 assert_equals(matrix2d.d, 3.1); | |
24 assert_equals(matrix2d.e, 2); | |
25 assert_equals(matrix2d.f, 1); | |
26 }, "DOMMatrix skewX() - 2D matrix"); | 15 }, "DOMMatrix skewX() - 2D matrix"); |
27 | 16 |
28 test(function() { | 17 test(function() { |
29 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); | 18 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); |
30 matrix2d.skewXSelf(45); | 19 matrix2d.skewXSelf(45); |
31 assert_true(matrix2d.is2D); | 20 assert_2d_matrix_equals(matrix2d, [1, 2, 4, 5.1, 2, 1]); |
32 assert_equals(matrix2d.a, 1); | |
33 assert_equals(matrix2d.b, 2); | |
34 assert_equals(matrix2d.c, 4); | |
35 assert_equals(matrix2d.d, 5.1); | |
36 assert_equals(matrix2d.e, 2); | |
37 assert_equals(matrix2d.f, 1); | |
38 }, "DOMMatrix skewX(45) - 2D matrix"); | 21 }, "DOMMatrix skewX(45) - 2D matrix"); |
39 | 22 |
40 test(function() { | 23 test(function() { |
41 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11
, 12, 13, 14, 15, 16.6])); | 24 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11,
12, 13, 14, 15, 16.6])); |
42 matrix3d.skewXSelf(); | 25 matrix3d.skewXSelf(); |
43 assert_false(matrix3d.is2D); | 26 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); |
44 assert_equals(matrix3d.m11, 1); | |
45 assert_equals(matrix3d.m12, 2); | |
46 assert_equals(matrix3d.m13, 3); | |
47 assert_equals(matrix3d.m14, 4); | |
48 assert_equals(matrix3d.m21, 5); | |
49 assert_equals(matrix3d.m22, 6); | |
50 assert_equals(matrix3d.m23, 7); | |
51 assert_equals(matrix3d.m24, 8); | |
52 assert_equals(matrix3d.m31, 9); | |
53 assert_equals(matrix3d.m32, 10.1); | |
54 assert_equals(matrix3d.m33, 11); | |
55 assert_equals(matrix3d.m34, 12); | |
56 assert_equals(matrix3d.m41, 13); | |
57 assert_equals(matrix3d.m42, 14); | |
58 assert_equals(matrix3d.m43, 15); | |
59 assert_equals(matrix3d.m44, 16.6); | |
60 }, "DOMMatrix skewX() - 3D matrix"); | 27 }, "DOMMatrix skewX() - 3D matrix"); |
61 | 28 |
62 test(function() { | 29 test(function() { |
63 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11
, 12, 13, 14, 15, 16.6])); | 30 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11,
12, 13, 14, 15, 16.6])); |
64 matrix3d.skewXSelf(45); | 31 matrix3d.skewXSelf(45); |
65 assert_false(matrix3d.is2D); | 32 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 6, 8, 10, 12, 9, 10.1, 11, 12,
13, 14, 15, 16.6]); |
66 assert_equals(matrix3d.m11, 1); | |
67 assert_equals(matrix3d.m12, 2); | |
68 assert_equals(matrix3d.m13, 3); | |
69 assert_equals(matrix3d.m14, 4); | |
70 assert_equals(matrix3d.m21, 6); | |
71 assert_equals(matrix3d.m22, 8); | |
72 assert_equals(matrix3d.m23, 10); | |
73 assert_equals(matrix3d.m24, 12); | |
74 assert_equals(matrix3d.m31, 9); | |
75 assert_equals(matrix3d.m32, 10.1); | |
76 assert_equals(matrix3d.m33, 11); | |
77 assert_equals(matrix3d.m34, 12); | |
78 assert_equals(matrix3d.m41, 13); | |
79 assert_equals(matrix3d.m42, 14); | |
80 assert_equals(matrix3d.m43, 15); | |
81 assert_equals(matrix3d.m44, 16.6); | |
82 }, "DOMMatrix skewX(45) - 3D matrix"); | 33 }, "DOMMatrix skewX(45) - 3D matrix"); |
83 | 34 |
84 test(function() { | 35 test(function() { |
85 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); | 36 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); |
86 matrix2d.skewYSelf(); | 37 matrix2d.skewYSelf(); |
87 assert_true(matrix2d.is2D); | 38 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 2, 1]); |
88 assert_equals(matrix2d.a, 1); | |
89 assert_equals(matrix2d.b, 2); | |
90 assert_equals(matrix2d.c, 3); | |
91 assert_equals(matrix2d.d, 3.1); | |
92 assert_equals(matrix2d.e, 2); | |
93 assert_equals(matrix2d.f, 1); | |
94 }, "DOMMatrix skewY() - 2D matrix"); | 39 }, "DOMMatrix skewY() - 2D matrix"); |
95 | 40 |
96 test(function() { | 41 test(function() { |
97 var matrix2d = new DOMMatrix(initMatrix([2, 2, 2, 2, 2, 2])); | 42 var matrix2d = new DOMMatrix(initMatrix([2, 2, 2, 2, 2, 2])); |
98 matrix2d.skewYSelf(45); | 43 matrix2d.skewYSelf(45); |
99 assert_true(matrix2d.is2D); | 44 assert_2d_matrix_equals(matrix2d, [4, 4, 2, 2, 2, 2]); |
100 assert_equals(matrix2d.a, 4); | |
101 assert_equals(matrix2d.b, 4); | |
102 assert_equals(matrix2d.c, 2); | |
103 assert_equals(matrix2d.d, 2); | |
104 assert_equals(matrix2d.e, 2); | |
105 assert_equals(matrix2d.f, 2); | |
106 }, "DOMMatrix skewY(45) - 2D matrix"); | 45 }, "DOMMatrix skewY(45) - 2D matrix"); |
107 | 46 |
108 test(function() { | 47 test(function() { |
109 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11
, 12, 13, 14, 15, 16.6])); | 48 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11,
12, 13, 14, 15, 16.6])); |
110 matrix3d.skewYSelf(); | 49 matrix3d.skewYSelf(); |
111 assert_false(matrix3d.is2D); | 50 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); |
112 assert_equals(matrix3d.m11, 1); | |
113 assert_equals(matrix3d.m12, 2); | |
114 assert_equals(matrix3d.m13, 3); | |
115 assert_equals(matrix3d.m14, 4); | |
116 assert_equals(matrix3d.m21, 5); | |
117 assert_equals(matrix3d.m22, 6); | |
118 assert_equals(matrix3d.m23, 7); | |
119 assert_equals(matrix3d.m24, 8); | |
120 assert_equals(matrix3d.m31, 9); | |
121 assert_equals(matrix3d.m32, 10.1); | |
122 assert_equals(matrix3d.m33, 11); | |
123 assert_equals(matrix3d.m34, 12); | |
124 assert_equals(matrix3d.m41, 13); | |
125 assert_equals(matrix3d.m42, 14); | |
126 assert_equals(matrix3d.m43, 15); | |
127 assert_equals(matrix3d.m44, 16.6); | |
128 }, "DOMMatrix skewY() - 3D matrix"); | 51 }, "DOMMatrix skewY() - 3D matrix"); |
129 | 52 |
130 test(function() { | 53 test(function() { |
131 var matrix3d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1])); | 54 var matrix3d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1, 1, 1])); |
132 matrix3d.skewYSelf(45); | 55 matrix3d.skewYSelf(45); |
133 assert_false(matrix3d.is2D); | 56 assert_3d_matrix_equals(matrix3d, [2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1]); |
134 assert_equals(matrix3d.m11, 2); | |
135 assert_equals(matrix3d.m12, 2); | |
136 assert_equals(matrix3d.m13, 2); | |
137 assert_equals(matrix3d.m14, 2); | |
138 assert_equals(matrix3d.m21, 1); | |
139 assert_equals(matrix3d.m22, 1); | |
140 assert_equals(matrix3d.m23, 1); | |
141 assert_equals(matrix3d.m24, 1); | |
142 assert_equals(matrix3d.m31, 1); | |
143 assert_equals(matrix3d.m32, 1); | |
144 assert_equals(matrix3d.m33, 1); | |
145 assert_equals(matrix3d.m34, 1); | |
146 assert_equals(matrix3d.m41, 1); | |
147 assert_equals(matrix3d.m42, 1); | |
148 assert_equals(matrix3d.m43, 1); | |
149 assert_equals(matrix3d.m44, 1); | |
150 }, "DOMMatrix skewY(45) - 3D matrix"); | 57 }, "DOMMatrix skewY(45) - 3D matrix"); |
151 </script> | 58 </script> |
152 </body> | |
153 </html> | |
OLD | NEW |