OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | |
3 <head> | |
4 <title>Geometry Interfaces: DOMMatrixReadOnly flip</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 flipX = matrix2d.flipX(); | 8 var flipX = matrix2d.flipX(); |
13 assert_true(flipX.is2D); | 9 assert_2d_matrix_equals(flipX, [-1, -2, 3, 3.1, 2, 1]); |
14 assert_equals(flipX.a, -1); | |
15 assert_equals(flipX.b, -2); | |
16 assert_equals(flipX.c, 3); | |
17 assert_equals(flipX.d, 3.1); | |
18 assert_equals(flipX.e, 2); | |
19 assert_equals(flipX.f, 1); | |
20 }, "DOMMatrixReadOnly flipX - 2D matrix"); | 10 }, "DOMMatrixReadOnly flipX - 2D matrix"); |
21 | 11 |
22 test(function() { | 12 test(function() { |
23 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 1
2, 13, 14, 15, 16.6]); | 13 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12,
13, 14, 15, 16.6]); |
24 var flipX = matrix3d.flipX(); | 14 var flipX = matrix3d.flipX(); |
25 assert_false(flipX.is2D); | 15 assert_3d_matrix_equals(flipX, [-1, -2, -3, -4, 5, 6, 7, 8, 9, 10.1, 11, 12, 1
3, 14, 15, 16.6]); |
26 assert_equals(flipX.m11, -1); | |
27 assert_equals(flipX.m12, -2); | |
28 assert_equals(flipX.m13, -3); | |
29 assert_equals(flipX.m14, -4); | |
30 assert_equals(flipX.m21, 5); | |
31 assert_equals(flipX.m22, 6); | |
32 assert_equals(flipX.m23, 7); | |
33 assert_equals(flipX.m24, 8); | |
34 assert_equals(flipX.m31, 9); | |
35 assert_equals(flipX.m32, 10.1); | |
36 assert_equals(flipX.m33, 11); | |
37 assert_equals(flipX.m34, 12); | |
38 assert_equals(flipX.m41, 13); | |
39 assert_equals(flipX.m42, 14); | |
40 assert_equals(flipX.m43, 15); | |
41 assert_equals(flipX.m44, 16.6); | |
42 }, "DOMMatrixReadOnly flipX - 3D matrix"); | 16 }, "DOMMatrixReadOnly flipX - 3D matrix"); |
43 | 17 |
44 test(function() { | 18 test(function() { |
45 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1]); | 19 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1]); |
46 var flipY = matrix2d.flipY(); | 20 var flipY = matrix2d.flipY(); |
47 assert_true(flipY.is2D); | 21 assert_2d_matrix_equals(flipY, [1, 2, -3, -3.1, 2, 1]); |
48 assert_equals(flipY.a, 1); | |
49 assert_equals(flipY.b, 2); | |
50 assert_equals(flipY.c, -3); | |
51 assert_equals(flipY.d, -3.1); | |
52 assert_equals(flipY.e, 2); | |
53 assert_equals(flipY.f, 1); | |
54 }, "DOMMatrixReadOnly flipY - 2D matrix"); | 22 }, "DOMMatrixReadOnly flipY - 2D 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 flipY = matrix3d.flipY(); | 26 var flipY = matrix3d.flipY(); |
59 assert_false(flipY.is2D); | 27 assert_3d_matrix_equals(flipY, [1, 2, 3, 4, -5, -6, -7, -8, 9, 10.1, 11, 12, 1
3, 14, 15, 16.6]); |
60 assert_equals(flipY.m11, 1); | |
61 assert_equals(flipY.m12, 2); | |
62 assert_equals(flipY.m13, 3); | |
63 assert_equals(flipY.m14, 4); | |
64 assert_equals(flipY.m21, -5); | |
65 assert_equals(flipY.m22, -6); | |
66 assert_equals(flipY.m23, -7); | |
67 assert_equals(flipY.m24, -8); | |
68 assert_equals(flipY.m31, 9); | |
69 assert_equals(flipY.m32, 10.1); | |
70 assert_equals(flipY.m33, 11); | |
71 assert_equals(flipY.m34, 12); | |
72 assert_equals(flipY.m41, 13); | |
73 assert_equals(flipY.m42, 14); | |
74 assert_equals(flipY.m43, 15); | |
75 assert_equals(flipY.m44, 16.6); | |
76 }, "DOMMatrixReadOnly flipY - 3D matrix"); | 28 }, "DOMMatrixReadOnly flipY - 3D matrix"); |
77 </script> | 29 </script> |
78 </body> | |
79 </html> | |
OLD | NEW |