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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.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 translate</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 test(function() { 6 test(function() {
12 var matrix = new DOMMatrix(); 7 var matrix = new DOMMatrix();
13 assert_true(matrix.is2D); 8 assert_identity_2d_matrix(matrix);
14 assert_true(matrix.isIdentity);
15 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
16 var result = matrix.translate(2, 3); 9 var result = matrix.translate(2, 3);
17 assert_true(result.is2D); 10 assert_2d_matrix_equals(result, [1, 0, 0, 1, 2, 3]);
18 assert_false(result.isIdentity); 11 assert_identity_2d_matrix(matrix);
19 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 2, 3, 0, 1 ]);
20 assert_true(matrix.is2D);
21 assert_true(matrix.isIdentity);
22 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
23 }, "DOMMatrix.translate(tx, ty)"); 12 }, "DOMMatrix.translate(tx, ty)");
24 13
25 test(function() { 14 test(function() {
26 var matrix = new DOMMatrix(); 15 var matrix = new DOMMatrix();
27 matrix.translateSelf(2, 3); 16 matrix.translateSelf(2, 3);
28 assert_true(matrix.is2D); 17 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
29 assert_false(matrix.isIdentity);
30 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 2, 3, 0, 1 ]);
31 var result = matrix.translate(4, 2); 18 var result = matrix.translate(4, 2);
32 assert_true(result.is2D); 19 assert_2d_matrix_equals(result, [1, 0, 0, 1, 6, 5]);
33 assert_false(result.isIdentity); 20 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
34 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 6, 5, 0, 1 ]);
35 assert_true(matrix.is2D);
36 assert_false(matrix.isIdentity);
37 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 2, 3, 0, 1 ]);
38 }, "DOMMatrix.translate(tx, ty) with non-identity"); 21 }, "DOMMatrix.translate(tx, ty) with non-identity");
39 22
40 test(function() { 23 test(function() {
41 var matrix = new DOMMatrix(); 24 var matrix = new DOMMatrix();
42 assert_true(matrix.is2D); 25 assert_identity_2d_matrix(matrix);
43 assert_true(matrix.isIdentity);
44 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
45 var result = matrix.translateSelf(4, 2); 26 var result = matrix.translateSelf(4, 2);
46 assert_true(result.is2D); 27 assert_2d_matrix_equals(result, [1, 0, 0, 1, 4, 2]);
47 assert_false(result.isIdentity); 28 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 4, 2]);
48 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 4, 2, 0, 1 ]);
49 assert_true(matrix.is2D);
50 assert_false(matrix.isIdentity);
51 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 4, 2, 0, 1 ]);
52 }, "DOMMatrix.translateSelf(tx, ty)"); 29 }, "DOMMatrix.translateSelf(tx, ty)");
53 30
54 test(function() { 31 test(function() {
55 var matrix = new DOMMatrix(); 32 var matrix = new DOMMatrix();
56 assert_true(matrix.is2D); 33 assert_identity_2d_matrix(matrix);
57 assert_true(matrix.isIdentity);
58 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
59 var result = matrix.translate(2, 3, 4); 34 var result = matrix.translate(2, 3, 4);
60 assert_false(result.is2D); 35 assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4, 1]);
61 assert_false(result.isIdentity); 36 assert_identity_2d_matrix(matrix);
62 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 2, 3, 4, 1 ]);
63 assert_true(matrix.is2D);
64 assert_true(matrix.isIdentity);
65 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
66 }, "DOMMatrix.translate(tx, ty, tz)"); 37 }, "DOMMatrix.translate(tx, ty, tz)");
67 38
68 test(function() { 39 test(function() {
69 var matrix = new DOMMatrix(); 40 var matrix = new DOMMatrix();
70 matrix.translateSelf(2, 3); 41 matrix.translateSelf(2, 3);
71 assert_true(matrix.is2D); 42 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
72 assert_false(matrix.isIdentity);
73 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 2, 3, 0, 1 ]);
74 var result = matrix.translate(4, 2, 3); 43 var result = matrix.translate(4, 2, 3);
75 assert_false(result.is2D); 44 assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 6, 5, 3, 1]);
76 assert_false(result.isIdentity); 45 assert_2d_matrix_equals(matrix, [1, 0, 0, 1, 2, 3]);
77 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 6, 5, 3, 1 ]);
78 assert_true(matrix.is2D);
79 assert_false(matrix.isIdentity);
80 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 2, 3, 0, 1 ]);
81 }, "DOMMatrix.translate(tx, ty, tz) with non-identity"); 46 }, "DOMMatrix.translate(tx, ty, tz) with non-identity");
82 47
83 test(function() { 48 test(function() {
84 var matrix = new DOMMatrix(); 49 var matrix = new DOMMatrix();
85 assert_true(matrix.is2D); 50 assert_identity_2d_matrix(matrix);
86 assert_true(matrix.isIdentity);
87 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
88 var result = matrix.translateSelf(4, 2, 3); 51 var result = matrix.translateSelf(4, 2, 3);
89 assert_false(result.is2D); 52 assert_3d_matrix_equals(result, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 3, 1]);
90 assert_false(result.isIdentity); 53 assert_3d_matrix_equals(matrix, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 2, 3, 1]);
91 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 4, 2, 3, 1 ]);
92 assert_false(matrix.is2D);
93 assert_false(matrix.isIdentity);
94 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 4, 2, 3, 1 ]);
95 }, "DOMMatrix.translateSelf(tx, ty, tz)"); 54 }, "DOMMatrix.translateSelf(tx, ty, tz)");
96 55
97 test(function() { 56 test(function() {
98 var matrix = new DOMMatrix(); 57 var matrix = new DOMMatrix();
99 assert_true(matrix.is2D); 58 assert_identity_2d_matrix(matrix);
100 assert_true(matrix.isIdentity);
101 matrix.m14 = 2; 59 matrix.m14 = 2;
102 matrix.m24 = 3; 60 matrix.m24 = 3;
103 matrix.m34 = 4; 61 matrix.m34 = 4;
104 matrix.m44 = 7; 62 matrix.m44 = 7;
105 assert_false(matrix.is2D); 63 assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 0, 0, 0, 7]);
106 assert_false(matrix.isIdentity);
107 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1 , 4, 0, 0, 0, 7 ]);
108 matrix.translateSelf(7, -8, 2); 64 matrix.translateSelf(7, -8, 2);
109 assert_false(matrix.is2D); 65 assert_3d_matrix_equals(matrix, [1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1, 4, 7, -8, 2, 5]);
110 assert_false(matrix.isIdentity);
111 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 2, 0, 1, 0, 3, 0, 0, 1 , 4, 7, -8, 2, 5 ]);
112 }, "DOMMatrix.translateSelf(tx, ty, tz) Homogeneous Coordinates"); 66 }, "DOMMatrix.translateSelf(tx, ty, tz) Homogeneous Coordinates");
113
114 </script> 67 </script>
115 </body>
116 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698