Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Geometry Interfaces: DOMMatrix invert</title> | |
| 5 <script src="../../resources/testharness.js"></script> | |
| 6 <script src="../../resources/testharnessreport.js"></script> | |
| 7 </head> | |
| 8 <body> | |
| 9 <script> | |
| 10 test(function() { | |
| 11 /* TODO create the DOMMatrix directly when the sequence constructor is suppo rted. */ | |
|
dominicc (has gone to gerrit)
2016/08/31 02:12:24
Use // TODO(your.alias): ...
The text of your TOD
| |
| 12 var matrix2d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6])); | |
| 13 matrix2d.invertSelf(); | |
| 14 assert_true(matrix2d.is2D); | |
| 15 assert_equals(matrix2d.a, -2); | |
| 16 assert_equals(matrix2d.b, 1); | |
| 17 assert_equals(matrix2d.c, 1.5); | |
| 18 assert_equals(matrix2d.d, -0.5); | |
| 19 assert_equals(matrix2d.e, 1); | |
| 20 assert_equals(matrix2d.f, -2); | |
| 21 }, "DOMMatrix invertSelf() - invertible - 2D matrix"); | |
| 22 | |
| 23 test(function() { | |
| 24 /* TODO create the DOMMatrix directly when the sequence constructor is suppo rted. */ | |
| 25 var matrix2d = new DOMMatrix(new DOMMatrixReadOnly([1, 1, 1, 1, 1, 1])); | |
| 26 matrix2d.invertSelf(); | |
| 27 assert_false(matrix2d.is2D); | |
| 28 assert_equals(matrix2d.a, NaN); | |
| 29 assert_equals(matrix2d.b, NaN); | |
| 30 assert_equals(matrix2d.c, NaN); | |
| 31 assert_equals(matrix2d.d, NaN); | |
| 32 assert_equals(matrix2d.e, NaN); | |
| 33 assert_equals(matrix2d.f, NaN); | |
| 34 }, "DOMMatrix invertSelf() - uninvertible - 2D matrix"); | |
| 35 | |
| 36 test(function() { | |
| 37 /* TODO create the DOMMatrix directly when the sequence constructor is suppo rted. */ | |
| 38 var matrix3d = new DOMMatrix(new DOMMatrixReadOnly([10, 20, 30, 40, 40, 40, 30, 20, 10, 20, 40, 30, 20, 40, 50, 100])); | |
| 39 matrix3d.invertSelf(); | |
| 40 assert_false(matrix3d.is2D); | |
| 41 assert_equals(matrix3d.m11, -1.6); | |
| 42 assert_equals(matrix3d.m12, 0.05); | |
| 43 assert_equals(matrix3d.m13, 0.6); | |
| 44 assert_equals(matrix3d.m14, 0.45); | |
| 45 assert_equals(matrix3d.m21, 2.05); | |
| 46 assert_equals(matrix3d.m22, -0.025); | |
| 47 assert_equals(matrix3d.m23, -0.8); | |
| 48 assert_equals(matrix3d.m24, -0.575); | |
| 49 assert_equals(matrix3d.m31, -0.4); | |
| 50 assert_equals(matrix3d.m32, 0); | |
| 51 assert_equals(matrix3d.m33, 0.2); | |
| 52 assert_equals(matrix3d.m34, 0.1); | |
| 53 assert_equals(matrix3d.m41, -0.3); | |
| 54 assert_equals(matrix3d.m42, -0); | |
| 55 assert_equals(matrix3d.m43, 0.1); | |
| 56 assert_equals(matrix3d.m44, 0.1); | |
| 57 }, "DOMMatrix invertSelf() - 3D matrix"); | |
| 58 | |
| 59 test(function() { | |
| 60 /* TODO create the DOMMatrix directly when the sequence constructor is suppo rted. */ | |
| 61 var matrix3d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])); | |
| 62 matrix3d.invertSelf(); | |
| 63 assert_false(matrix3d.is2D); | |
| 64 assert_equals(matrix3d.m11, NaN); | |
| 65 assert_equals(matrix3d.m12, NaN); | |
| 66 assert_equals(matrix3d.m13, NaN); | |
| 67 assert_equals(matrix3d.m14, NaN); | |
| 68 assert_equals(matrix3d.m21, NaN); | |
| 69 assert_equals(matrix3d.m22, NaN); | |
| 70 assert_equals(matrix3d.m23, NaN); | |
| 71 assert_equals(matrix3d.m24, NaN); | |
| 72 assert_equals(matrix3d.m31, NaN); | |
| 73 assert_equals(matrix3d.m32, NaN); | |
| 74 assert_equals(matrix3d.m33, NaN); | |
| 75 assert_equals(matrix3d.m34, NaN); | |
| 76 assert_equals(matrix3d.m41, NaN); | |
| 77 assert_equals(matrix3d.m42, NaN); | |
| 78 assert_equals(matrix3d.m43, NaN); | |
| 79 assert_equals(matrix3d.m44, NaN); | |
| 80 }, "DOMMatrix invertSelf() - uninvertible - 3D matrix"); | |
| 81 </script> | |
| 82 </body> | |
| 83 </html> | |
| OLD | NEW |