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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.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 scale</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.scale(3); 9 var result = matrix.scale(3);
17 assert_true(result.is2D); 10 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]);
18 assert_false(result.isIdentity); 11 assert_identity_2d_matrix(matrix);
19 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, 0, 0, 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.scale(scale)"); 12 }, "DOMMatrix.scale(scale)");
24 13
25 test(function() { 14 test(function() {
26 var matrix = new DOMMatrix(); 15 var matrix = new DOMMatrix();
27 assert_true(matrix.is2D); 16 assert_identity_2d_matrix(matrix);
28 assert_true(matrix.isIdentity);
29 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
30 var result = matrix.scale(3, 4, 2); 17 var result = matrix.scale(3, 4, 2);
31 assert_true(result.is2D); 18 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]);
32 assert_false(result.isIdentity); 19 assert_identity_2d_matrix(matrix);
33 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, -8, -4, 0, 1 ]);
34 assert_true(matrix.is2D);
35 assert_true(matrix.isIdentity);
36 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
37 }, "DOMMatrix.scale(scale, ox, oy)"); 20 }, "DOMMatrix.scale(scale, ox, oy)");
38 21
39 test(function() { 22 test(function() {
40 var matrix = new DOMMatrix(); 23 var matrix = new DOMMatrix();
41 assert_true(matrix.is2D); 24 assert_identity_2d_matrix(matrix);
42 assert_true(matrix.isIdentity);
43 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
44 var result = matrix.scale3d(3); 25 var result = matrix.scale3d(3);
45 assert_false(result.is2D); 26 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]);
46 assert_false(result.isIdentity); 27 assert_identity_2d_matrix(matrix);
47 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, 0, 0, 0, 1 ]);
48 assert_true(matrix.is2D);
49 assert_true(matrix.isIdentity);
50 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
51 }, "DOMMatrix.scale3d(scale)"); 28 }, "DOMMatrix.scale3d(scale)");
52 29
53 test(function() { 30 test(function() {
54 var matrix = new DOMMatrix(); 31 var matrix = new DOMMatrix();
55 assert_true(matrix.is2D); 32 assert_identity_2d_matrix(matrix);
56 assert_true(matrix.isIdentity);
57 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
58 var result = matrix.scale3d(3, 2, 7, -1); 33 var result = matrix.scale3d(3, 2, 7, -1);
59 assert_false(result.is2D); 34 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1]);
60 assert_false(result.isIdentity); 35 assert_identity_2d_matrix(matrix);
61 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, -4, -14, 2, 1 ]);
62 assert_true(matrix.is2D);
63 assert_true(matrix.isIdentity);
64 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
65 }, "DOMMatrix.scale3d(scale, ox, oy, oz)"); 36 }, "DOMMatrix.scale3d(scale, ox, oy, oz)");
66 37
67 test(function() { 38 test(function() {
68 var matrix = new DOMMatrix(); 39 var matrix = new DOMMatrix();
69 assert_true(matrix.is2D); 40 assert_identity_2d_matrix(matrix);
70 assert_true(matrix.isIdentity);
71 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
72 var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1); 41 var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1);
73 assert_false(result.is2D); 42 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
74 assert_false(result.isIdentity); 43 assert_identity_2d_matrix(matrix);
75 assert_array_equals(result.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 .5, 0, -2, 8, -0.5, 1 ]);
76 assert_true(matrix.is2D);
77 assert_true(matrix.isIdentity);
78 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
79 }, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)"); 44 }, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)");
80 45
81 test(function() { 46 test(function() {
82 var matrix = new DOMMatrix(); 47 var matrix = new DOMMatrix();
83 assert_true(matrix.is2D); 48 assert_identity_2d_matrix(matrix);
84 assert_true(matrix.isIdentity);
85 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
86 var result = matrix.scaleSelf(3); 49 var result = matrix.scaleSelf(3);
87 assert_true(result.is2D); 50 assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]);
88 assert_false(result.isIdentity); 51 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, 0, 0]);
89 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
90 assert_true(matrix.is2D);
91 assert_false(matrix.isIdentity);
92 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
93 }, "DOMMatrix.scaleSelf(scale)"); 52 }, "DOMMatrix.scaleSelf(scale)");
94 53
95 test(function() { 54 test(function() {
96 var matrix = new DOMMatrix(); 55 var matrix = new DOMMatrix();
97 assert_true(matrix.is2D); 56 assert_identity_2d_matrix(matrix);
98 assert_true(matrix.isIdentity);
99 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
100 var result = matrix.scaleSelf(3, 4, 2); 57 var result = matrix.scaleSelf(3, 4, 2);
101 assert_true(result.is2D); 58 assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]);
102 assert_false(result.isIdentity); 59 assert_2d_matrix_equals(matrix, [3, 0, 0, 3, -8, -4]);
103 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, -8, -4, 0, 1 ]);
104 assert_true(matrix.is2D);
105 assert_false(matrix.isIdentity);
106 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, -8, -4, 0, 1 ]);
107 }, "DOMMatrix.scaleSelf(scale)"); 60 }, "DOMMatrix.scaleSelf(scale)");
108 61
109 test(function() { 62 test(function() {
110 var matrix = new DOMMatrix(); 63 var matrix = new DOMMatrix();
111 assert_true(matrix.is2D); 64 assert_identity_2d_matrix(matrix);
112 assert_true(matrix.isIdentity);
113 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
114 var result = matrix.scale3dSelf(3); 65 var result = matrix.scale3dSelf(3);
115 assert_false(result.is2D); 66 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]);
116 assert_false(result.isIdentity); 67 assert_3d_matrix_equals(matrix, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]);
117 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, 0, 0, 0, 1 ]);
118 assert_false(matrix.is2D);
119 assert_false(matrix.isIdentity);
120 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, 0, 0, 0, 1 ]);
121 }, "DOMMatrix.scale3dSelf(scale)"); 68 }, "DOMMatrix.scale3dSelf(scale)");
122 69
123 test(function() { 70 test(function() {
124 var matrix = new DOMMatrix(); 71 var matrix = new DOMMatrix();
125 assert_true(matrix.is2D); 72 assert_identity_2d_matrix(matrix);
126 assert_true(matrix.isIdentity);
127 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
128 var result = matrix.scale3dSelf(3, 2, 7, -1); 73 var result = matrix.scale3dSelf(3, 2, 7, -1);
129 assert_false(result.is2D); 74 assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1]);
130 assert_false(result.isIdentity); 75 assert_3d_matrix_equals(matrix, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1]);
131 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, -4, -14, 2, 1 ]);
132 assert_false(matrix.is2D);
133 assert_false(matrix.isIdentity);
134 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, -4, -14, 2, 1 ]);
135 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)"); 76 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)");
136 77
137 test(function() { 78 test(function() {
138 var matrix = new DOMMatrix(); 79 var matrix = new DOMMatrix();
139 assert_true(matrix.is2D); 80 assert_identity_2d_matrix(matrix);
140 assert_true(matrix.isIdentity);
141 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
142 var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1); 81 var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1);
143 assert_false(result.is2D); 82 assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
144 assert_false(result.isIdentity); 83 assert_3d_matrix_equals(matrix, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
145 assert_array_equals(result.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 .5, 0, -2, 8, -0.5, 1 ]);
146 assert_false(matrix.is2D);
147 assert_false(matrix.isIdentity);
148 assert_array_equals(matrix.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 .5, 0, -2, 8, -0.5, 1 ]);
149 }, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)"); 84 }, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)");
150 85
151 test(function() { 86 test(function() {
152 var matrix = new DOMMatrix(); 87 var matrix = new DOMMatrix();
153 assert_true(matrix.is2D); 88 assert_identity_2d_matrix(matrix);
154 assert_true(matrix.isIdentity);
155 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
156 var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1); 89 var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1);
157 assert_false(result.is2D); 90 assert_identity_3d_matrix(result);
158 assert_true(result.isIdentity); 91 assert_identity_3d_matrix(matrix);
159 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
160 assert_false(matrix.is2D);
161 assert_true(matrix.isIdentity);
162 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
163 }, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)"); 92 }, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)");
164
165 </script> 93 </script>
166 </body>
167 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698