| 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 | 6 |
| 7 test(function() { | 7 test(function() { |
| 8 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 8 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 9 matrix2d.invertSelf(); | 9 matrix2d.invertSelf(); |
| 10 assert_2d_matrix_equals(matrix2d, [-2, 1, 1.5, -0.5, 1, -2]); | 10 assert_2d_matrix_equals(matrix2d, [-2, 1, 1.5, -0.5, 1, -2]); |
| 11 }, "DOMMatrix invertSelf() - invertible - 2D matrix"); | 11 }, "DOMMatrix invertSelf() - invertible - 2D matrix"); |
| 12 | 12 |
| 13 test(function() { | 13 test(function() { |
| 14 var matrix2d = new DOMMatrix([1, 1, 1, 1, 1, 1]); | 14 var matrix2d = new DOMMatrix([1, 1, 1, 1, 1, 1]); |
| 15 matrix2d.invertSelf(); | 15 matrix2d.invertSelf(); |
| 16 //when non invertible matrix execute invertSelf(), result matrix is not 2d. | 16 //when non invertible matrix execute invertSelf(), result matrix is not 2d. |
| 17 assert_3d_matrix_equals(matrix2d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN
, NaN, NaN, NaN, NaN, NaN, NaN, NaN]); | 17 assert_3d_matrix_equals(matrix2d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN
, NaN, NaN, NaN, NaN, NaN, NaN, NaN]); |
| 18 }, "DOMMatrix invertSelf() - non-invertible - 2D matrix"); | 18 }, "DOMMatrix invertSelf() - non-invertible - 2D matrix"); |
| 19 | 19 |
| 20 test(function() { | 20 test(function() { |
| 21 var matrix3d = new DOMMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 20, 40, 30,
20, 40, 50, 100]); | 21 var matrix3d = new DOMMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 20, 40, 30,
20, 40, 50, 100]); |
| 22 matrix3d.invertSelf(); | 22 matrix3d.invertSelf(); |
| 23 assert_3d_matrix_equals(matrix3d, [-1.6, 0.05, 0.6, 0.45, 2.05, -0.025, -0.8,
-0.575, -0.4, 0, 0.2, 0.1, -0.3, 0, 0.1, 0.1]); | 23 assert_matrix_almost_equals(matrix3d, new DOMMatrix([-1.6, 0.05, 0.6, 0.45, 2.
05, -0.025, -0.8, -0.575, -0.4, 0, 0.2, 0.1, -0.3, 0, 0.1, 0.1])); |
| 24 }, "DOMMatrix invertSelf() - 3D matrix"); | 24 }, "DOMMatrix invertSelf() - 3D matrix"); |
| 25 | 25 |
| 26 test(function() { | 26 test(function() { |
| 27 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 27 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
| 28 matrix3d.invertSelf(); | 28 matrix3d.invertSelf(); |
| 29 assert_3d_matrix_equals(matrix3d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN
, NaN, NaN, NaN, NaN, NaN, NaN, NaN]); | 29 assert_3d_matrix_equals(matrix3d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN
, NaN, NaN, NaN, NaN, NaN, NaN, NaN]); |
| 30 }, "DOMMatrix invertSelf() - non-invertible - 3D matrix"); | 30 }, "DOMMatrix invertSelf() - non-invertible - 3D matrix"); |
| 31 </script> | 31 </script> |
| OLD | NEW |