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

Side by Side Diff: LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html

Issue 483633002: Add toFloat*Array() methods and use them in layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TestExepectations Created 6 years, 4 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 scale</title> 4 <title>Geometry Interfaces: DOMMatrix scale</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <script> 8 <script>
9 9
10 function toArray(matrix)
11 {
12 return [ matrix.m11, matrix.m21, matrix.m31, matrix.m41,
13 matrix.m12, matrix.m22, matrix.m32, matrix.m42,
14 matrix.m13, matrix.m23, matrix.m33, matrix.m43,
15 matrix.m14, matrix.m24, matrix.m34, matrix.m44 ];
16 }
17
18 test(function() { 10 test(function() {
19 var matrix = new DOMMatrix(); 11 var matrix = new DOMMatrix();
20 assert_true(matrix.is2D); 12 assert_true(matrix.is2D);
21 assert_true(matrix.isIdentity); 13 assert_true(matrix.isIdentity);
22 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 14 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
23 var result = matrix.scale(3); 15 var result = matrix.scale(3);
24 assert_true(result.is2D); 16 assert_true(result.is2D);
25 assert_false(result.isIdentity); 17 assert_false(result.isIdentity);
26 assert_array_equals(toArray(result), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 18 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
27 assert_true(matrix.is2D); 19 assert_true(matrix.is2D);
28 assert_true(matrix.isIdentity); 20 assert_true(matrix.isIdentity);
29 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 21 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
30 }, "DOMMatrix.scale(scale)"); 22 }, "DOMMatrix.scale(scale)");
31 23
32 test(function() { 24 test(function() {
33 var matrix = new DOMMatrix(); 25 var matrix = new DOMMatrix();
34 assert_true(matrix.is2D); 26 assert_true(matrix.is2D);
35 assert_true(matrix.isIdentity); 27 assert_true(matrix.isIdentity);
36 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 28 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
37 var result = matrix.scale(3, 4, 2); 29 var result = matrix.scale(3, 4, 2);
38 assert_true(result.is2D); 30 assert_true(result.is2D);
39 assert_false(result.isIdentity); 31 assert_false(result.isIdentity);
40 assert_array_equals(toArray(result), [ 3, 0, 0, -8, 0, 3, 0, -4, 0, 0, 1, 0, 0 , 0, 0, 1 ]); 32 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, -8, -4, 0, 1 ]);
41 assert_true(matrix.is2D); 33 assert_true(matrix.is2D);
42 assert_true(matrix.isIdentity); 34 assert_true(matrix.isIdentity);
43 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 35 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
44 }, "DOMMatrix.scale(scale, ox, oy)"); 36 }, "DOMMatrix.scale(scale, ox, oy)");
45 37
46 test(function() { 38 test(function() {
47 var matrix = new DOMMatrix(); 39 var matrix = new DOMMatrix();
48 assert_true(matrix.is2D); 40 assert_true(matrix.is2D);
49 assert_true(matrix.isIdentity); 41 assert_true(matrix.isIdentity);
50 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 42 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
51 var result = matrix.scale3d(3); 43 var result = matrix.scale3d(3);
52 assert_false(result.is2D); 44 assert_false(result.is2D);
53 assert_false(result.isIdentity); 45 assert_false(result.isIdentity);
54 assert_array_equals(toArray(result), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ]); 46 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, 0, 0, 0, 1 ]);
55 assert_true(matrix.is2D); 47 assert_true(matrix.is2D);
56 assert_true(matrix.isIdentity); 48 assert_true(matrix.isIdentity);
57 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 49 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
58 }, "DOMMatrix.scale3d(scale)"); 50 }, "DOMMatrix.scale3d(scale)");
59 51
60 test(function() { 52 test(function() {
61 var matrix = new DOMMatrix(); 53 var matrix = new DOMMatrix();
62 assert_true(matrix.is2D); 54 assert_true(matrix.is2D);
63 assert_true(matrix.isIdentity); 55 assert_true(matrix.isIdentity);
64 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 56 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
65 var result = matrix.scale3d(3, 2, 7, -1); 57 var result = matrix.scale3d(3, 2, 7, -1);
66 assert_false(result.is2D); 58 assert_false(result.is2D);
67 assert_false(result.isIdentity); 59 assert_false(result.isIdentity);
68 assert_array_equals(toArray(result), [ 3, 0, 0, -4, 0, 3, 0, -14, 0, 0, 3, 2, 0, 0, 0, 1 ]); 60 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, -4, -14, 2, 1 ]);
69 assert_true(matrix.is2D); 61 assert_true(matrix.is2D);
70 assert_true(matrix.isIdentity); 62 assert_true(matrix.isIdentity);
71 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 63 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
72 }, "DOMMatrix.scale3d(scale, ox, oy, oz)"); 64 }, "DOMMatrix.scale3d(scale, ox, oy, oz)");
73 65
74 test(function() { 66 test(function() {
75 var matrix = new DOMMatrix(); 67 var matrix = new DOMMatrix();
76 assert_true(matrix.is2D); 68 assert_true(matrix.is2D);
77 assert_true(matrix.isIdentity); 69 assert_true(matrix.isIdentity);
78 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 70 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
79 var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1); 71 var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1);
80 assert_false(result.is2D); 72 assert_false(result.is2D);
81 assert_false(result.isIdentity); 73 assert_false(result.isIdentity);
82 assert_array_equals(toArray(result), [ 2, 0, 0, -2, 0, 3, 0, 8, 0, 0, 0.5, -0. 5, 0, 0, 0, 1 ]); 74 assert_array_equals(result.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 .5, 0, -2, 8, -0.5, 1 ]);
83 assert_true(matrix.is2D); 75 assert_true(matrix.is2D);
84 assert_true(matrix.isIdentity); 76 assert_true(matrix.isIdentity);
85 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 77 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
86 }, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)"); 78 }, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)");
87 79
88 test(function() { 80 test(function() {
89 var matrix = new DOMMatrix(); 81 var matrix = new DOMMatrix();
90 assert_true(matrix.is2D); 82 assert_true(matrix.is2D);
91 assert_true(matrix.isIdentity); 83 assert_true(matrix.isIdentity);
92 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 84 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
93 var result = matrix.scaleSelf(3); 85 var result = matrix.scaleSelf(3);
94 assert_true(result.is2D); 86 assert_true(result.is2D);
95 assert_false(result.isIdentity); 87 assert_false(result.isIdentity);
96 assert_array_equals(toArray(result), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 88 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
97 assert_true(matrix.is2D); 89 assert_true(matrix.is2D);
98 assert_false(matrix.isIdentity); 90 assert_false(matrix.isIdentity);
99 assert_array_equals(toArray(matrix), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 91 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
100 }, "DOMMatrix.scaleSelf(scale)"); 92 }, "DOMMatrix.scaleSelf(scale)");
101 93
102 test(function() { 94 test(function() {
103 var matrix = new DOMMatrix(); 95 var matrix = new DOMMatrix();
104 assert_true(matrix.is2D); 96 assert_true(matrix.is2D);
105 assert_true(matrix.isIdentity); 97 assert_true(matrix.isIdentity);
106 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 98 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
107 var result = matrix.scaleSelf(3, 4, 2); 99 var result = matrix.scaleSelf(3, 4, 2);
108 assert_true(result.is2D); 100 assert_true(result.is2D);
109 assert_false(result.isIdentity); 101 assert_false(result.isIdentity);
110 assert_array_equals(toArray(result), [ 3, 0, 0, -8, 0, 3, 0, -4, 0, 0, 1, 0, 0 , 0, 0, 1 ]); 102 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, -8, -4, 0, 1 ]);
111 assert_true(matrix.is2D); 103 assert_true(matrix.is2D);
112 assert_false(matrix.isIdentity); 104 assert_false(matrix.isIdentity);
113 assert_array_equals(toArray(matrix), [ 3, 0, 0, -8, 0, 3, 0, -4, 0, 0, 1, 0, 0 , 0, 0, 1 ]); 105 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 , 0, -8, -4, 0, 1 ]);
114 }, "DOMMatrix.scaleSelf(scale)"); 106 }, "DOMMatrix.scaleSelf(scale)");
115 107
116 test(function() { 108 test(function() {
117 var matrix = new DOMMatrix(); 109 var matrix = new DOMMatrix();
118 assert_true(matrix.is2D); 110 assert_true(matrix.is2D);
119 assert_true(matrix.isIdentity); 111 assert_true(matrix.isIdentity);
120 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 112 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
121 var result = matrix.scale3dSelf(3); 113 var result = matrix.scale3dSelf(3);
122 assert_false(result.is2D); 114 assert_false(result.is2D);
123 assert_false(result.isIdentity); 115 assert_false(result.isIdentity);
124 assert_array_equals(toArray(result), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ]); 116 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, 0, 0, 0, 1 ]);
125 assert_false(matrix.is2D); 117 assert_false(matrix.is2D);
126 assert_false(matrix.isIdentity); 118 assert_false(matrix.isIdentity);
127 assert_array_equals(toArray(matrix), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1 ]); 119 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, 0, 0, 0, 1 ]);
128 }, "DOMMatrix.scale3dSelf(scale)"); 120 }, "DOMMatrix.scale3dSelf(scale)");
129 121
130 test(function() { 122 test(function() {
131 var matrix = new DOMMatrix(); 123 var matrix = new DOMMatrix();
132 assert_true(matrix.is2D); 124 assert_true(matrix.is2D);
133 assert_true(matrix.isIdentity); 125 assert_true(matrix.isIdentity);
134 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 126 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
135 var result = matrix.scale3dSelf(3, 2, 7, -1); 127 var result = matrix.scale3dSelf(3, 2, 7, -1);
136 assert_false(result.is2D); 128 assert_false(result.is2D);
137 assert_false(result.isIdentity); 129 assert_false(result.isIdentity);
138 assert_array_equals(toArray(result), [ 3, 0, 0, -4, 0, 3, 0, -14, 0, 0, 3, 2, 0, 0, 0, 1 ]); 130 assert_array_equals(result.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, -4, -14, 2, 1 ]);
139 assert_false(matrix.is2D); 131 assert_false(matrix.is2D);
140 assert_false(matrix.isIdentity); 132 assert_false(matrix.isIdentity);
141 assert_array_equals(toArray(matrix), [ 3, 0, 0, -4, 0, 3, 0, -14, 0, 0, 3, 2, 0, 0, 0, 1 ]); 133 assert_array_equals(matrix.toFloat64Array(), [ 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3 , 0, -4, -14, 2, 1 ]);
142 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)"); 134 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)");
143 135
144 test(function() { 136 test(function() {
145 var matrix = new DOMMatrix(); 137 var matrix = new DOMMatrix();
146 assert_true(matrix.is2D); 138 assert_true(matrix.is2D);
147 assert_true(matrix.isIdentity); 139 assert_true(matrix.isIdentity);
148 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 140 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
149 var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1); 141 var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1);
150 assert_false(result.is2D); 142 assert_false(result.is2D);
151 assert_false(result.isIdentity); 143 assert_false(result.isIdentity);
152 assert_array_equals(toArray(result), [ 2, 0, 0, -2, 0, 3, 0, 8, 0, 0, 0.5, -0. 5, 0, 0, 0, 1 ]); 144 assert_array_equals(result.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 .5, 0, -2, 8, -0.5, 1 ]);
153 assert_false(matrix.is2D); 145 assert_false(matrix.is2D);
154 assert_false(matrix.isIdentity); 146 assert_false(matrix.isIdentity);
155 assert_array_equals(toArray(matrix), [ 2, 0, 0, -2, 0, 3, 0, 8, 0, 0, 0.5, -0. 5, 0, 0, 0, 1 ]); 147 assert_array_equals(matrix.toFloat64Array(), [ 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0 .5, 0, -2, 8, -0.5, 1 ]);
156 }, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)"); 148 }, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)");
157 149
158 test(function() { 150 test(function() {
159 var matrix = new DOMMatrix(); 151 var matrix = new DOMMatrix();
160 assert_true(matrix.is2D); 152 assert_true(matrix.is2D);
161 assert_true(matrix.isIdentity); 153 assert_true(matrix.isIdentity);
162 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 154 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
163 var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1); 155 var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1);
164 assert_false(result.is2D); 156 assert_false(result.is2D);
165 assert_true(result.isIdentity); 157 assert_true(result.isIdentity);
166 assert_array_equals(toArray(result), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 158 assert_array_equals(result.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
167 assert_false(matrix.is2D); 159 assert_false(matrix.is2D);
168 assert_true(matrix.isIdentity); 160 assert_true(matrix.isIdentity);
169 assert_array_equals(toArray(matrix), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); 161 assert_array_equals(matrix.toFloat64Array(), [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 , 0, 0, 0, 0, 1 ]);
170 }, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)"); 162 }, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)");
171 163
172 </script> 164 </script>
173 </body> 165 </body>
174 </html> 166 </html>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/dom/geometry-interfaces-dom-matrix-translate.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698