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

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

Issue 2374773002: [GeometryInterface] Add DOMMatrix(numberSequence) constructor. (Closed)
Patch Set: 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 <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, 4, 5, 6])); 8 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
13 matrix2d.invertSelf(); 9 matrix2d.invertSelf();
14 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]);
15 }, "DOMMatrix invertSelf() - invertible - 2D matrix"); 11 }, "DOMMatrix invertSelf() - invertible - 2D matrix");
16 12
17 test(function() { 13 test(function() {
18 var matrix2d = new DOMMatrix(initMatrix([1, 1, 1, 1, 1, 1])); 14 var matrix2d = new DOMMatrix([1, 1, 1, 1, 1, 1]);
19 matrix2d.invertSelf(); 15 matrix2d.invertSelf();
20 //when non invertible matrix execute invertSelf(), result matrix is not 2d. 16 //when non invertible matrix execute invertSelf(), result matrix is not 2d.
21 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]);
22 }, "DOMMatrix invertSelf() - non-invertible - 2D matrix"); 18 }, "DOMMatrix invertSelf() - non-invertible - 2D matrix");
23 19
24 test(function() { 20 test(function() {
25 var matrix3d = new DOMMatrix(initMatrix([10, 20, 30, 40, 40, 40, 30, 20, 10, 2 0, 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]);
26 matrix3d.invertSelf(); 22 matrix3d.invertSelf();
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]); 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]);
28 }, "DOMMatrix invertSelf() - 3D matrix"); 24 }, "DOMMatrix invertSelf() - 3D matrix");
29 25
30 test(function() { 26 test(function() {
31 var matrix3d = new DOMMatrix(initMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 , 13, 14, 15, 16])); 27 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1 5, 16]);
32 matrix3d.invertSelf(); 28 matrix3d.invertSelf();
33 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]);
34 }, "DOMMatrix invertSelf() - non-invertible - 3D matrix"); 30 }, "DOMMatrix invertSelf() - non-invertible - 3D matrix");
35 </script> 31 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698