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 // TODO(hs1217.lee): create the DOMMatrix directly when the sequence constructor
is supported. | |
7 function initMatrix(values) { | |
8 return new DOMMatrixReadOnly(values); | |
9 } | |
10 | 6 |
11 test(function() { | 7 test(function() { |
12 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); | 8 var matrix2d = new DOMMatrix([1, 2, 3, 3.1, 2, 1]); |
13 matrix2d.skewXSelf(); | 9 matrix2d.skewXSelf(); |
14 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 2, 1]); | 10 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 2, 1]); |
15 }, "DOMMatrix skewX() - 2D matrix"); | 11 }, "DOMMatrix skewX() - 2D matrix"); |
16 | 12 |
17 test(function() { | 13 test(function() { |
18 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); | 14 var matrix2d = new DOMMatrix([1, 2, 3, 3.1, 2, 1]); |
19 matrix2d.skewXSelf(45); | 15 matrix2d.skewXSelf(45); |
20 assert_2d_matrix_equals(matrix2d, [1, 2, 4, 5.1, 2, 1]); | 16 assert_2d_matrix_equals(matrix2d, [1, 2, 4, 5.1, 2, 1]); |
21 }, "DOMMatrix skewX(45) - 2D matrix"); | 17 }, "DOMMatrix skewX(45) - 2D matrix"); |
22 | 18 |
23 test(function() { | 19 test(function() { |
24 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11,
12, 13, 14, 15, 16.6])); | 20 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14,
15, 16.6]); |
25 matrix3d.skewXSelf(); | 21 matrix3d.skewXSelf(); |
26 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); | 22 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); |
27 }, "DOMMatrix skewX() - 3D matrix"); | 23 }, "DOMMatrix skewX() - 3D matrix"); |
28 | 24 |
29 test(function() { | 25 test(function() { |
30 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11,
12, 13, 14, 15, 16.6])); | 26 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14,
15, 16.6]); |
31 matrix3d.skewXSelf(45); | 27 matrix3d.skewXSelf(45); |
32 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 6, 8, 10, 12, 9, 10.1, 11, 12,
13, 14, 15, 16.6]); | 28 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 6, 8, 10, 12, 9, 10.1, 11, 12,
13, 14, 15, 16.6]); |
33 }, "DOMMatrix skewX(45) - 3D matrix"); | 29 }, "DOMMatrix skewX(45) - 3D matrix"); |
34 | 30 |
35 test(function() { | 31 test(function() { |
36 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1])); | 32 var matrix2d = new DOMMatrix([1, 2, 3, 3.1, 2, 1]); |
37 matrix2d.skewYSelf(); | 33 matrix2d.skewYSelf(); |
38 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 2, 1]); | 34 assert_2d_matrix_equals(matrix2d, [1, 2, 3, 3.1, 2, 1]); |
39 }, "DOMMatrix skewY() - 2D matrix"); | 35 }, "DOMMatrix skewY() - 2D matrix"); |
40 | 36 |
41 test(function() { | 37 test(function() { |
42 var matrix2d = new DOMMatrix(initMatrix([2, 2, 2, 2, 2, 2])); | 38 var matrix2d = new DOMMatrix([2, 2, 2, 2, 2, 2]); |
43 matrix2d.skewYSelf(45); | 39 matrix2d.skewYSelf(45); |
44 assert_2d_matrix_equals(matrix2d, [4, 4, 2, 2, 2, 2]); | 40 assert_2d_matrix_equals(matrix2d, [4, 4, 2, 2, 2, 2]); |
45 }, "DOMMatrix skewY(45) - 2D matrix"); | 41 }, "DOMMatrix skewY(45) - 2D matrix"); |
46 | 42 |
47 test(function() { | 43 test(function() { |
48 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11,
12, 13, 14, 15, 16.6])); | 44 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14,
15, 16.6]); |
49 matrix3d.skewYSelf(); | 45 matrix3d.skewYSelf(); |
50 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); | 46 assert_3d_matrix_equals(matrix3d, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13
, 14, 15, 16.6]); |
51 }, "DOMMatrix skewY() - 3D matrix"); | 47 }, "DOMMatrix skewY() - 3D matrix"); |
52 | 48 |
53 test(function() { | 49 test(function() { |
54 var matrix3d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1, 1, 1])); | 50 var matrix3d = new DOMMatrix([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
; |
55 matrix3d.skewYSelf(45); | 51 matrix3d.skewYSelf(45); |
56 assert_3d_matrix_equals(matrix3d, [2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1]); | 52 assert_3d_matrix_equals(matrix3d, [2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1]); |
57 }, "DOMMatrix skewY(45) - 3D matrix"); | 53 }, "DOMMatrix skewY(45) - 3D matrix"); |
58 </script> | 54 </script> |
OLD | NEW |