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