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

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

Issue 2283173003: Implement inverse & invertSelf function in DOMMatrix & DOMMatrixReadOnly. (Closed)
Patch Set: fix a global-interface-listing-expected.txt Created 4 years, 3 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> 2 <html>
3 <head> 3 <head>
4 <title>Geometry Interfaces: DOMMatrix skew</title> 4 <title>Geometry Interfaces: DOMMatrix skew</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10
11 // TODO(hs1217.lee): create the DOMMatrix directly when the sequence constructor is supported.
12 function initMatrix(values) {
13 return new DOMMatrixReadOnly(values);
14 }
15
10 test(function() { 16 test(function() {
11 var matrix2d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1])); 17 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1]));
12 matrix2d.skewXSelf(); 18 matrix2d.skewXSelf();
13 assert_true(matrix2d.is2D); 19 assert_true(matrix2d.is2D);
14 assert_equals(matrix2d.a, 1); 20 assert_equals(matrix2d.a, 1);
15 assert_equals(matrix2d.b, 2); 21 assert_equals(matrix2d.b, 2);
16 assert_equals(matrix2d.c, 3); 22 assert_equals(matrix2d.c, 3);
17 assert_equals(matrix2d.d, 3.1); 23 assert_equals(matrix2d.d, 3.1);
18 assert_equals(matrix2d.e, 2); 24 assert_equals(matrix2d.e, 2);
19 assert_equals(matrix2d.f, 1); 25 assert_equals(matrix2d.f, 1);
20 }, "DOMMatrix skewX() - 2D matrix"); 26 }, "DOMMatrix skewX() - 2D matrix");
21 27
22 test(function() { 28 test(function() {
23 var matrix2d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1])); 29 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1]));
24 matrix2d.skewXSelf(45); 30 matrix2d.skewXSelf(45);
25 assert_true(matrix2d.is2D); 31 assert_true(matrix2d.is2D);
26 assert_equals(matrix2d.a, 1); 32 assert_equals(matrix2d.a, 1);
27 assert_equals(matrix2d.b, 2); 33 assert_equals(matrix2d.b, 2);
28 assert_equals(matrix2d.c, 4); 34 assert_equals(matrix2d.c, 4);
29 assert_equals(matrix2d.d, 5.1); 35 assert_equals(matrix2d.d, 5.1);
30 assert_equals(matrix2d.e, 2); 36 assert_equals(matrix2d.e, 2);
31 assert_equals(matrix2d.f, 1); 37 assert_equals(matrix2d.f, 1);
32 }, "DOMMatrix skewX(45) - 2D matrix"); 38 }, "DOMMatrix skewX(45) - 2D matrix");
33 39
34 test(function() { 40 test(function() {
35 var matrix3d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6])); 41 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11 , 12, 13, 14, 15, 16.6]));
36 matrix3d.skewXSelf(); 42 matrix3d.skewXSelf();
37 assert_false(matrix3d.is2D); 43 assert_false(matrix3d.is2D);
38 assert_equals(matrix3d.m11, 1); 44 assert_equals(matrix3d.m11, 1);
39 assert_equals(matrix3d.m12, 2); 45 assert_equals(matrix3d.m12, 2);
40 assert_equals(matrix3d.m13, 3); 46 assert_equals(matrix3d.m13, 3);
41 assert_equals(matrix3d.m14, 4); 47 assert_equals(matrix3d.m14, 4);
42 assert_equals(matrix3d.m21, 5); 48 assert_equals(matrix3d.m21, 5);
43 assert_equals(matrix3d.m22, 6); 49 assert_equals(matrix3d.m22, 6);
44 assert_equals(matrix3d.m23, 7); 50 assert_equals(matrix3d.m23, 7);
45 assert_equals(matrix3d.m24, 8); 51 assert_equals(matrix3d.m24, 8);
46 assert_equals(matrix3d.m31, 9); 52 assert_equals(matrix3d.m31, 9);
47 assert_equals(matrix3d.m32, 10.1); 53 assert_equals(matrix3d.m32, 10.1);
48 assert_equals(matrix3d.m33, 11); 54 assert_equals(matrix3d.m33, 11);
49 assert_equals(matrix3d.m34, 12); 55 assert_equals(matrix3d.m34, 12);
50 assert_equals(matrix3d.m41, 13); 56 assert_equals(matrix3d.m41, 13);
51 assert_equals(matrix3d.m42, 14); 57 assert_equals(matrix3d.m42, 14);
52 assert_equals(matrix3d.m43, 15); 58 assert_equals(matrix3d.m43, 15);
53 assert_equals(matrix3d.m44, 16.6); 59 assert_equals(matrix3d.m44, 16.6);
54 }, "DOMMatrix skewX() - 3D matrix"); 60 }, "DOMMatrix skewX() - 3D matrix");
55 61
56 test(function() { 62 test(function() {
57 var matrix3d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6])); 63 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11 , 12, 13, 14, 15, 16.6]));
58 matrix3d.skewXSelf(45); 64 matrix3d.skewXSelf(45);
59 assert_false(matrix3d.is2D); 65 assert_false(matrix3d.is2D);
60 assert_equals(matrix3d.m11, 1); 66 assert_equals(matrix3d.m11, 1);
61 assert_equals(matrix3d.m12, 2); 67 assert_equals(matrix3d.m12, 2);
62 assert_equals(matrix3d.m13, 3); 68 assert_equals(matrix3d.m13, 3);
63 assert_equals(matrix3d.m14, 4); 69 assert_equals(matrix3d.m14, 4);
64 assert_equals(matrix3d.m21, 6); 70 assert_equals(matrix3d.m21, 6);
65 assert_equals(matrix3d.m22, 8); 71 assert_equals(matrix3d.m22, 8);
66 assert_equals(matrix3d.m23, 10); 72 assert_equals(matrix3d.m23, 10);
67 assert_equals(matrix3d.m24, 12); 73 assert_equals(matrix3d.m24, 12);
68 assert_equals(matrix3d.m31, 9); 74 assert_equals(matrix3d.m31, 9);
69 assert_equals(matrix3d.m32, 10.1); 75 assert_equals(matrix3d.m32, 10.1);
70 assert_equals(matrix3d.m33, 11); 76 assert_equals(matrix3d.m33, 11);
71 assert_equals(matrix3d.m34, 12); 77 assert_equals(matrix3d.m34, 12);
72 assert_equals(matrix3d.m41, 13); 78 assert_equals(matrix3d.m41, 13);
73 assert_equals(matrix3d.m42, 14); 79 assert_equals(matrix3d.m42, 14);
74 assert_equals(matrix3d.m43, 15); 80 assert_equals(matrix3d.m43, 15);
75 assert_equals(matrix3d.m44, 16.6); 81 assert_equals(matrix3d.m44, 16.6);
76 }, "DOMMatrix skewX(45) - 3D matrix"); 82 }, "DOMMatrix skewX(45) - 3D matrix");
77 83
78 test(function() { 84 test(function() {
79 var matrix2d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 3.1, 2, 1])); 85 var matrix2d = new DOMMatrix(initMatrix([1, 2, 3, 3.1, 2, 1]));
80 matrix2d.skewYSelf(); 86 matrix2d.skewYSelf();
81 assert_true(matrix2d.is2D); 87 assert_true(matrix2d.is2D);
82 assert_equals(matrix2d.a, 1); 88 assert_equals(matrix2d.a, 1);
83 assert_equals(matrix2d.b, 2); 89 assert_equals(matrix2d.b, 2);
84 assert_equals(matrix2d.c, 3); 90 assert_equals(matrix2d.c, 3);
85 assert_equals(matrix2d.d, 3.1); 91 assert_equals(matrix2d.d, 3.1);
86 assert_equals(matrix2d.e, 2); 92 assert_equals(matrix2d.e, 2);
87 assert_equals(matrix2d.f, 1); 93 assert_equals(matrix2d.f, 1);
88 }, "DOMMatrix skewY() - 2D matrix"); 94 }, "DOMMatrix skewY() - 2D matrix");
89 95
90 test(function() { 96 test(function() {
91 var matrix2d = new DOMMatrix(new DOMMatrixReadOnly([2, 2, 2, 2, 2, 2])); 97 var matrix2d = new DOMMatrix(initMatrix([2, 2, 2, 2, 2, 2]));
92 matrix2d.skewYSelf(45); 98 matrix2d.skewYSelf(45);
93 assert_true(matrix2d.is2D); 99 assert_true(matrix2d.is2D);
94 assert_equals(matrix2d.a, 4); 100 assert_equals(matrix2d.a, 4);
95 assert_equals(matrix2d.b, 4); 101 assert_equals(matrix2d.b, 4);
96 assert_equals(matrix2d.c, 2); 102 assert_equals(matrix2d.c, 2);
97 assert_equals(matrix2d.d, 2); 103 assert_equals(matrix2d.d, 2);
98 assert_equals(matrix2d.e, 2); 104 assert_equals(matrix2d.e, 2);
99 assert_equals(matrix2d.f, 2); 105 assert_equals(matrix2d.f, 2);
100 }, "DOMMatrix skewY(45) - 2D matrix"); 106 }, "DOMMatrix skewY(45) - 2D matrix");
101 107
102 test(function() { 108 test(function() {
103 var matrix3d = new DOMMatrix(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11, 12, 13, 14, 15, 16.6])); 109 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10.1, 11 , 12, 13, 14, 15, 16.6]));
104 matrix3d.skewYSelf(); 110 matrix3d.skewYSelf();
105 assert_false(matrix3d.is2D); 111 assert_false(matrix3d.is2D);
106 assert_equals(matrix3d.m11, 1); 112 assert_equals(matrix3d.m11, 1);
107 assert_equals(matrix3d.m12, 2); 113 assert_equals(matrix3d.m12, 2);
108 assert_equals(matrix3d.m13, 3); 114 assert_equals(matrix3d.m13, 3);
109 assert_equals(matrix3d.m14, 4); 115 assert_equals(matrix3d.m14, 4);
110 assert_equals(matrix3d.m21, 5); 116 assert_equals(matrix3d.m21, 5);
111 assert_equals(matrix3d.m22, 6); 117 assert_equals(matrix3d.m22, 6);
112 assert_equals(matrix3d.m23, 7); 118 assert_equals(matrix3d.m23, 7);
113 assert_equals(matrix3d.m24, 8); 119 assert_equals(matrix3d.m24, 8);
114 assert_equals(matrix3d.m31, 9); 120 assert_equals(matrix3d.m31, 9);
115 assert_equals(matrix3d.m32, 10.1); 121 assert_equals(matrix3d.m32, 10.1);
116 assert_equals(matrix3d.m33, 11); 122 assert_equals(matrix3d.m33, 11);
117 assert_equals(matrix3d.m34, 12); 123 assert_equals(matrix3d.m34, 12);
118 assert_equals(matrix3d.m41, 13); 124 assert_equals(matrix3d.m41, 13);
119 assert_equals(matrix3d.m42, 14); 125 assert_equals(matrix3d.m42, 14);
120 assert_equals(matrix3d.m43, 15); 126 assert_equals(matrix3d.m43, 15);
121 assert_equals(matrix3d.m44, 16.6); 127 assert_equals(matrix3d.m44, 16.6);
122 }, "DOMMatrix skewY() - 3D matrix"); 128 }, "DOMMatrix skewY() - 3D matrix");
123 129
124 test(function() { 130 test(function() {
125 var matrix3d = new DOMMatrix(new DOMMatrixReadOnly([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])); 131 var matrix3d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]));
126 matrix3d.skewYSelf(45); 132 matrix3d.skewYSelf(45);
127 assert_false(matrix3d.is2D); 133 assert_false(matrix3d.is2D);
128 assert_equals(matrix3d.m11, 2); 134 assert_equals(matrix3d.m11, 2);
129 assert_equals(matrix3d.m12, 2); 135 assert_equals(matrix3d.m12, 2);
130 assert_equals(matrix3d.m13, 2); 136 assert_equals(matrix3d.m13, 2);
131 assert_equals(matrix3d.m14, 2); 137 assert_equals(matrix3d.m14, 2);
132 assert_equals(matrix3d.m21, 1); 138 assert_equals(matrix3d.m21, 1);
133 assert_equals(matrix3d.m22, 1); 139 assert_equals(matrix3d.m22, 1);
134 assert_equals(matrix3d.m23, 1); 140 assert_equals(matrix3d.m23, 1);
135 assert_equals(matrix3d.m24, 1); 141 assert_equals(matrix3d.m24, 1);
136 assert_equals(matrix3d.m31, 1); 142 assert_equals(matrix3d.m31, 1);
137 assert_equals(matrix3d.m32, 1); 143 assert_equals(matrix3d.m32, 1);
138 assert_equals(matrix3d.m33, 1); 144 assert_equals(matrix3d.m33, 1);
139 assert_equals(matrix3d.m34, 1); 145 assert_equals(matrix3d.m34, 1);
140 assert_equals(matrix3d.m41, 1); 146 assert_equals(matrix3d.m41, 1);
141 assert_equals(matrix3d.m42, 1); 147 assert_equals(matrix3d.m42, 1);
142 assert_equals(matrix3d.m43, 1); 148 assert_equals(matrix3d.m43, 1);
143 assert_equals(matrix3d.m44, 1); 149 assert_equals(matrix3d.m44, 1);
144 }, "DOMMatrix skewY(45) - 3D matrix"); 150 }, "DOMMatrix skewY(45) - 3D matrix");
145 </script> 151 </script>
146 </body> 152 </body>
147 </html> 153 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698