Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-invert.html

Issue 2370623003: [GeometryInterface] Clean-up layout tests for geometry interfaces. (Closed)
Patch Set: [GeometryInterface] Fix a indentation and clean up. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Geometry Interfaces: DOMMatrix invert</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
11 // TODO(hs1217.lee): create the DOMMatrix directly when the sequence constructor is supported. 6 // TODO(hs1217.lee): create the DOMMatrix directly when the sequence constructor is supported.
12 function initMatrix(values) { 7 function initMatrix(values) {
13 return new DOMMatrixReadOnly(values); 8 return new DOMMatrixReadOnly(values);
14 } 9 }
15 10
16 test(function() { 11 test(function() {
17 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6])); 12 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6]));
18 matrix2d.invertSelf(); 13 matrix2d.invertSelf();
19 assert_true(matrix2d.is2D); 14 assert_2d_matrix_equals(matrix2d, [-2, 1, 1.5, -0.5, 1, -2]);
20 assert_equals(matrix2d.a, -2);
21 assert_equals(matrix2d.b, 1);
22 assert_equals(matrix2d.c, 1.5);
23 assert_equals(matrix2d.d, -0.5);
24 assert_equals(matrix2d.e, 1);
25 assert_equals(matrix2d.f, -2);
26 }, "DOMMatrix invertSelf() - invertible - 2D matrix"); 15 }, "DOMMatrix invertSelf() - invertible - 2D matrix");
27 16
28 test(function() { 17 test(function() {
29 var matrix2d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1])); 18 var matrix2d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1]));
30 matrix2d.invertSelf(); 19 matrix2d.invertSelf();
31 assert_false(matrix2d.is2D); 20 //when non invertible matrix execute invertSelf(), result matrix is not 2d.
32 assert_equals(matrix2d.a, NaN); 21 assert_3d_matrix_equals(matrix2d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN , NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
33 assert_equals(matrix2d.b, NaN); 22 }, "DOMMatrix invertSelf() - non-invertible - 2D matrix");
34 assert_equals(matrix2d.c, NaN);
35 assert_equals(matrix2d.d, NaN);
36 assert_equals(matrix2d.e, NaN);
37 assert_equals(matrix2d.f, NaN);
38 }, "DOMMatrix invertSelf() - uninvertible - 2D matrix");
39 23
40 test(function() { 24 test(function() {
41 var matrix3d = new DOMMatrix(initMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 20, 40, 30, 20, 40, 50, 100])); 25 var matrix3d = new DOMMatrix(initMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 2 0, 40, 30, 20, 40, 50, 100]));
42 matrix3d.invertSelf(); 26 matrix3d.invertSelf();
43 assert_false(matrix3d.is2D); 27 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]);
44 assert_equals(matrix3d.m11, -1.6);
45 assert_equals(matrix3d.m12, 0.05);
46 assert_equals(matrix3d.m13, 0.6);
47 assert_equals(matrix3d.m14, 0.45);
48 assert_equals(matrix3d.m21, 2.05);
49 assert_equals(matrix3d.m22, -0.025);
50 assert_equals(matrix3d.m23, -0.8);
51 assert_equals(matrix3d.m24, -0.575);
52 assert_equals(matrix3d.m31, -0.4);
53 assert_equals(matrix3d.m32, 0);
54 assert_equals(matrix3d.m33, 0.2);
55 assert_equals(matrix3d.m34, 0.1);
56 assert_equals(matrix3d.m41, -0.3);
57 assert_equals(matrix3d.m42, -0);
58 assert_equals(matrix3d.m43, 0.1);
59 assert_equals(matrix3d.m44, 0.1);
60 }, "DOMMatrix invertSelf() - 3D matrix"); 28 }, "DOMMatrix invertSelf() - 3D matrix");
61 29
62 test(function() { 30 test(function() {
63 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])); 31 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 , 13, 14, 15, 16]));
64 matrix3d.invertSelf(); 32 matrix3d.invertSelf();
65 assert_false(matrix3d.is2D); 33 assert_3d_matrix_equals(matrix3d, [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN , NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
66 assert_equals(matrix3d.m11, NaN); 34 }, "DOMMatrix invertSelf() - non-invertible - 3D matrix");
67 assert_equals(matrix3d.m12, NaN);
68 assert_equals(matrix3d.m13, NaN);
69 assert_equals(matrix3d.m14, NaN);
70 assert_equals(matrix3d.m21, NaN);
71 assert_equals(matrix3d.m22, NaN);
72 assert_equals(matrix3d.m23, NaN);
73 assert_equals(matrix3d.m24, NaN);
74 assert_equals(matrix3d.m31, NaN);
75 assert_equals(matrix3d.m32, NaN);
76 assert_equals(matrix3d.m33, NaN);
77 assert_equals(matrix3d.m34, NaN);
78 assert_equals(matrix3d.m41, NaN);
79 assert_equals(matrix3d.m42, NaN);
80 assert_equals(matrix3d.m43, NaN);
81 assert_equals(matrix3d.m44, NaN);
82 }, "DOMMatrix invertSelf() - uninvertible - 3D matrix");
83 </script> 35 </script>
84 </body>
85 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698