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

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

Issue 450533006: Implement scale*() methods in DOMMatrix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use TransformationMatrix 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/dom/DOMMatrix.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Geometry Interfaces: DOMMatrix scale</title>
5 <script src="../../resources/testharness.js"></script>
6 </head>
7 <body>
8 <script>
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() {
19 var matrix = new DOMMatrix();
20 assert_true(matrix.is2D);
21 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 ]);
23 var result = matrix.scale(3);
24 assert_true(result.is2D);
25 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 ]);
27 assert_true(matrix.is2D);
28 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 ]);
30 }, "DOMMatrix.scale(scale)");
31
32 test(function() {
33 var matrix = new DOMMatrix();
34 assert_true(matrix.is2D);
35 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 ]);
37 var result = matrix.scale(3, 4, 2);
38 assert_true(result.is2D);
39 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 ]);
41 assert_true(matrix.is2D);
42 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 ]);
44 }, "DOMMatrix.scale(scale, ox, oy)");
45
46 test(function() {
47 var matrix = new DOMMatrix();
48 assert_true(matrix.is2D);
49 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 ]);
51 var result = matrix.scale3d(3);
52 assert_false(result.is2D);
53 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 ]);
55 assert_true(matrix.is2D);
56 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 ]);
58 }, "DOMMatrix.scale3d(scale)");
59
60 test(function() {
61 var matrix = new DOMMatrix();
62 assert_true(matrix.is2D);
63 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 ]);
65 var result = matrix.scale3d(3, 2, 7, -1);
66 assert_false(result.is2D);
67 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 ]);
69 assert_true(matrix.is2D);
70 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 ]);
72 }, "DOMMatrix.scale3d(scale, ox, oy, oz)");
73
74 test(function() {
75 var matrix = new DOMMatrix();
76 assert_true(matrix.is2D);
77 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 ]);
79 var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1);
80 assert_false(result.is2D);
81 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 ]);
83 assert_true(matrix.is2D);
84 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 ]);
86 }, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)");
87
88 test(function() {
89 var matrix = new DOMMatrix();
90 assert_true(matrix.is2D);
91 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 ]);
93 var result = matrix.scaleSelf(3);
94 assert_true(result.is2D);
95 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 ]);
97 assert_true(matrix.is2D);
98 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 ]);
100 }, "DOMMatrix.scaleSelf(scale)");
101
102 test(function() {
103 var matrix = new DOMMatrix();
104 assert_true(matrix.is2D);
105 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 ]);
107 var result = matrix.scaleSelf(3, 4, 2);
108 assert_true(result.is2D);
109 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 ]);
111 assert_true(matrix.is2D);
112 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 ]);
114 }, "DOMMatrix.scaleSelf(scale)");
115
116 test(function() {
117 var matrix = new DOMMatrix();
118 assert_true(matrix.is2D);
119 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 ]);
121 var result = matrix.scale3dSelf(3);
122 assert_false(result.is2D);
123 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 ]);
125 assert_false(matrix.is2D);
126 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 ]);
128 }, "DOMMatrix.scale3dSelf(scale)");
129
130 test(function() {
131 var matrix = new DOMMatrix();
132 assert_true(matrix.is2D);
133 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 ]);
135 var result = matrix.scale3dSelf(3, 2, 7, -1);
136 assert_false(result.is2D);
137 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 ]);
139 assert_false(matrix.is2D);
140 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 ]);
142 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)");
143
144 test(function() {
145 var matrix = new DOMMatrix();
146 assert_true(matrix.is2D);
147 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 ]);
149 var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1);
150 assert_false(result.is2D);
151 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 ]);
153 assert_false(matrix.is2D);
154 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 ]);
156 }, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)");
157
158 test(function() {
159 var matrix = new DOMMatrix();
160 assert_true(matrix.is2D);
161 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 ]);
163 var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1);
164 assert_false(result.is2D);
165 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 ]);
167 assert_false(matrix.is2D);
168 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 ]);
170 }, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)");
171
172 </script>
173 </body>
174 </html>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/dom/DOMMatrix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698