OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include "base/memory/scoped_ptr.h" |
5 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
6 #include "cc/test/geometry_test_utils.h" | 7 #include "cc/test/geometry_test_utils.h" |
| 8 #include "cc/transform_operations.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperati
ons.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperati
ons.h" |
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" |
10 | 12 |
11 using namespace WebKit; | 13 using namespace WebKit; |
12 | 14 |
13 TEST(WebTransformOperationTest, transformTypesAreUnique) | 15 TEST(WebTransformOperationTest, transformTypesAreUnique) |
14 { | 16 { |
15 ScopedVector<WebTransformOperations> transforms; | 17 ScopedVector<WebTransformOperations> transforms; |
16 | 18 |
17 WebTransformOperations* toAdd = new WebTransformOperations(); | 19 WebTransformOperations* toAdd = cc::TransformOperations::Create(); |
18 toAdd->appendTranslate(1, 0, 0); | 20 toAdd->appendTranslate(1, 0, 0); |
19 transforms.push_back(toAdd); | 21 transforms.push_back(toAdd); |
20 | 22 |
21 toAdd = new WebTransformOperations(); | 23 toAdd = cc::TransformOperations::Create(); |
22 toAdd->appendRotate(0, 0, 1, 2); | 24 toAdd->appendRotate(0, 0, 1, 2); |
23 transforms.push_back(toAdd); | 25 transforms.push_back(toAdd); |
24 | 26 |
25 toAdd = new WebTransformOperations(); | 27 toAdd = cc::TransformOperations::Create(); |
26 toAdd->appendScale(2, 2, 2); | 28 toAdd->appendScale(2, 2, 2); |
27 transforms.push_back(toAdd); | 29 transforms.push_back(toAdd); |
28 | 30 |
29 toAdd = new WebTransformOperations(); | 31 toAdd = cc::TransformOperations::Create(); |
30 toAdd->appendSkew(1, 0); | 32 toAdd->appendSkew(1, 0); |
31 transforms.push_back(toAdd); | 33 transforms.push_back(toAdd); |
32 | 34 |
33 toAdd = new WebTransformOperations(); | 35 toAdd = cc::TransformOperations::Create(); |
34 toAdd->appendPerspective(800); | 36 toAdd->appendPerspective(800); |
35 transforms.push_back(toAdd); | 37 transforms.push_back(toAdd); |
36 | 38 |
37 for (size_t i = 0; i < transforms.size(); ++i) { | 39 for (size_t i = 0; i < transforms.size(); ++i) { |
38 for (size_t j = 0; j < transforms.size(); ++j) { | 40 for (size_t j = 0; j < transforms.size(); ++j) { |
39 bool matchesType = transforms[i]->matchesTypes(*transforms[j]); | 41 bool matchesType = transforms[i]->matchesTypes(*transforms[j]); |
40 EXPECT_TRUE((i == j && matchesType) || !matchesType); | 42 EXPECT_TRUE((i == j && matchesType) || !matchesType); |
41 } | 43 } |
42 } | 44 } |
43 } | 45 } |
44 | 46 |
45 TEST(WebTransformOperationTest, matchTypesSameLength) | 47 TEST(WebTransformOperationTest, matchTypesSameLength) |
46 { | 48 { |
47 WebTransformOperations translates; | 49 scoped_ptr<WebTransformOperations> translates( |
48 translates.appendTranslate(1, 0, 0); | 50 cc::TransformOperations::Create()); |
49 translates.appendTranslate(1, 0, 0); | 51 translates->appendTranslate(1, 0, 0); |
50 translates.appendTranslate(1, 0, 0); | 52 translates->appendTranslate(1, 0, 0); |
| 53 translates->appendTranslate(1, 0, 0); |
51 | 54 |
52 WebTransformOperations skews; | 55 scoped_ptr<WebTransformOperations> skews( |
53 skews.appendSkew(0, 2); | 56 cc::TransformOperations::Create()); |
54 skews.appendSkew(0, 2); | 57 skews->appendSkew(0, 2); |
55 skews.appendSkew(0, 2); | 58 skews->appendSkew(0, 2); |
| 59 skews->appendSkew(0, 2); |
56 | 60 |
57 WebTransformOperations translates2; | 61 scoped_ptr<WebTransformOperations> translates2( |
58 translates2.appendTranslate(0, 2, 0); | 62 cc::TransformOperations::Create()); |
59 translates2.appendTranslate(0, 2, 0); | 63 translates2->appendTranslate(0, 2, 0); |
60 translates2.appendTranslate(0, 2, 0); | 64 translates2->appendTranslate(0, 2, 0); |
| 65 translates2->appendTranslate(0, 2, 0); |
61 | 66 |
62 WebTransformOperations translates3 = translates2; | 67 scoped_ptr<WebTransformOperations> translates3( |
| 68 cc::TransformOperations::Create(*translates2)); |
63 | 69 |
64 EXPECT_FALSE(translates.matchesTypes(skews)); | 70 EXPECT_FALSE(translates->matchesTypes(*skews)); |
65 EXPECT_TRUE(translates.matchesTypes(translates2)); | 71 EXPECT_TRUE(translates->matchesTypes(*translates2)); |
66 EXPECT_TRUE(translates.matchesTypes(translates3)); | 72 EXPECT_TRUE(translates->matchesTypes(*translates3)); |
67 } | 73 } |
68 | 74 |
69 TEST(WebTransformOperationTest, matchTypesDifferentLength) | 75 TEST(WebTransformOperationTest, matchTypesDifferentLength) |
70 { | 76 { |
71 WebTransformOperations translates; | 77 scoped_ptr<WebTransformOperations> translates( |
72 translates.appendTranslate(1, 0, 0); | 78 cc::TransformOperations::Create()); |
73 translates.appendTranslate(1, 0, 0); | 79 translates->appendTranslate(1, 0, 0); |
74 translates.appendTranslate(1, 0, 0); | 80 translates->appendTranslate(1, 0, 0); |
| 81 translates->appendTranslate(1, 0, 0); |
75 | 82 |
76 WebTransformOperations skews; | 83 scoped_ptr<WebTransformOperations> skews( |
77 skews.appendSkew(2, 0); | 84 cc::TransformOperations::Create()); |
78 skews.appendSkew(2, 0); | 85 skews->appendSkew(2, 0); |
| 86 skews->appendSkew(2, 0); |
79 | 87 |
80 WebTransformOperations translates2; | 88 scoped_ptr<WebTransformOperations> translates2( |
81 translates2.appendTranslate(0, 2, 0); | 89 cc::TransformOperations::Create()); |
82 translates2.appendTranslate(0, 2, 0); | 90 translates2->appendTranslate(0, 2, 0); |
| 91 translates2->appendTranslate(0, 2, 0); |
83 | 92 |
84 EXPECT_FALSE(translates.matchesTypes(skews)); | 93 EXPECT_FALSE(translates->matchesTypes(*skews)); |
85 EXPECT_FALSE(translates.matchesTypes(translates2)); | 94 EXPECT_FALSE(translates->matchesTypes(*translates2)); |
86 } | 95 } |
87 | 96 |
88 void getIdentityOperations(ScopedVector<WebTransformOperations>* operations) | 97 void getIdentityOperations(ScopedVector<WebTransformOperations>* operations) |
89 { | 98 { |
90 WebTransformOperations* toAdd = new WebTransformOperations(); | 99 WebTransformOperations* toAdd = cc::TransformOperations::Create(); |
91 operations->push_back(toAdd); | 100 operations->push_back(toAdd); |
92 | 101 |
93 toAdd = new WebTransformOperations(); | 102 toAdd = cc::TransformOperations::Create(); |
94 toAdd->appendTranslate(0, 0, 0); | 103 toAdd->appendTranslate(0, 0, 0); |
95 operations->push_back(toAdd); | 104 operations->push_back(toAdd); |
96 | 105 |
97 toAdd = new WebTransformOperations(); | 106 toAdd = cc::TransformOperations::Create(); |
98 toAdd->appendTranslate(0, 0, 0); | 107 toAdd->appendTranslate(0, 0, 0); |
99 toAdd->appendTranslate(0, 0, 0); | 108 toAdd->appendTranslate(0, 0, 0); |
100 operations->push_back(toAdd); | 109 operations->push_back(toAdd); |
101 | 110 |
102 toAdd = new WebTransformOperations(); | 111 toAdd = cc::TransformOperations::Create(); |
103 toAdd->appendScale(1, 1, 1); | 112 toAdd->appendScale(1, 1, 1); |
104 operations->push_back(toAdd); | 113 operations->push_back(toAdd); |
105 | 114 |
106 toAdd = new WebTransformOperations(); | 115 toAdd = cc::TransformOperations::Create(); |
107 toAdd->appendScale(1, 1, 1); | 116 toAdd->appendScale(1, 1, 1); |
108 toAdd->appendScale(1, 1, 1); | 117 toAdd->appendScale(1, 1, 1); |
109 operations->push_back(toAdd); | 118 operations->push_back(toAdd); |
110 | 119 |
111 toAdd = new WebTransformOperations(); | 120 toAdd = cc::TransformOperations::Create(); |
112 toAdd->appendSkew(0, 0); | 121 toAdd->appendSkew(0, 0); |
113 operations->push_back(toAdd); | 122 operations->push_back(toAdd); |
114 | 123 |
115 toAdd = new WebTransformOperations(); | 124 toAdd = cc::TransformOperations::Create(); |
116 toAdd->appendSkew(0, 0); | 125 toAdd->appendSkew(0, 0); |
117 toAdd->appendSkew(0, 0); | 126 toAdd->appendSkew(0, 0); |
118 operations->push_back(toAdd); | 127 operations->push_back(toAdd); |
119 | 128 |
120 toAdd = new WebTransformOperations(); | 129 toAdd = cc::TransformOperations::Create(); |
121 toAdd->appendRotate(0, 0, 1, 0); | 130 toAdd->appendRotate(0, 0, 1, 0); |
122 operations->push_back(toAdd); | 131 operations->push_back(toAdd); |
123 | 132 |
124 toAdd = new WebTransformOperations(); | 133 toAdd = cc::TransformOperations::Create(); |
125 toAdd->appendRotate(0, 0, 1, 0); | 134 toAdd->appendRotate(0, 0, 1, 0); |
126 toAdd->appendRotate(0, 0, 1, 0); | 135 toAdd->appendRotate(0, 0, 1, 0); |
127 operations->push_back(toAdd); | 136 operations->push_back(toAdd); |
128 | 137 |
129 toAdd = new WebTransformOperations(); | 138 toAdd = cc::TransformOperations::Create(); |
130 toAdd->appendMatrix(WebTransformationMatrix()); | 139 toAdd->appendMatrix(WebTransformationMatrix()); |
131 operations->push_back(toAdd); | 140 operations->push_back(toAdd); |
132 | 141 |
133 toAdd = new WebTransformOperations(); | 142 toAdd = cc::TransformOperations::Create(); |
134 toAdd->appendMatrix(WebTransformationMatrix()); | 143 toAdd->appendMatrix(WebTransformationMatrix()); |
135 toAdd->appendMatrix(WebTransformationMatrix()); | 144 toAdd->appendMatrix(WebTransformationMatrix()); |
136 operations->push_back(toAdd); | 145 operations->push_back(toAdd); |
137 } | 146 } |
138 | 147 |
139 TEST(WebTransformOperationTest, identityAlwaysMatches) | 148 TEST(WebTransformOperationTest, identityAlwaysMatches) |
140 { | 149 { |
141 ScopedVector<WebTransformOperations> operations; | 150 ScopedVector<WebTransformOperations> operations; |
142 getIdentityOperations(&operations); | 151 getIdentityOperations(&operations); |
143 | 152 |
144 for (size_t i = 0; i < operations.size(); ++i) { | 153 for (size_t i = 0; i < operations.size(); ++i) { |
145 for (size_t j = 0; j < operations.size(); ++j) | 154 for (size_t j = 0; j < operations.size(); ++j) |
146 EXPECT_TRUE(operations[i]->matchesTypes(*operations[j])); | 155 EXPECT_TRUE(operations[i]->matchesTypes(*operations[j])); |
147 } | 156 } |
148 } | 157 } |
149 | 158 |
150 TEST(WebTransformOperationTest, applyTranslate) | 159 TEST(WebTransformOperationTest, applyTranslate) |
151 { | 160 { |
152 double x = 1; | 161 double x = 1; |
153 double y = 2; | 162 double y = 2; |
154 double z = 3; | 163 double z = 3; |
155 WebTransformOperations operations; | 164 scoped_ptr<WebTransformOperations> operations( |
156 operations.appendTranslate(x, y, z); | 165 cc::TransformOperations::Create()); |
| 166 operations->appendTranslate(x, y, z); |
157 WebTransformationMatrix expected; | 167 WebTransformationMatrix expected; |
158 expected.translate3d(x, y, z); | 168 expected.translate3d(x, y, z); |
159 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); | 169 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->apply()); |
160 } | 170 } |
161 | 171 |
162 TEST(WebTransformOperationTest, applyRotate) | 172 TEST(WebTransformOperationTest, applyRotate) |
163 { | 173 { |
164 double x = 1; | 174 double x = 1; |
165 double y = 2; | 175 double y = 2; |
166 double z = 3; | 176 double z = 3; |
167 double degrees = 80; | 177 double degrees = 80; |
168 WebTransformOperations operations; | 178 scoped_ptr<WebTransformOperations> operations( |
169 operations.appendRotate(x, y, z, degrees); | 179 cc::TransformOperations::Create()); |
| 180 operations->appendRotate(x, y, z, degrees); |
170 WebTransformationMatrix expected; | 181 WebTransformationMatrix expected; |
171 expected.rotate3d(x, y, z, degrees); | 182 expected.rotate3d(x, y, z, degrees); |
172 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); | 183 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->apply()); |
173 } | 184 } |
174 | 185 |
175 TEST(WebTransformOperationTest, applyScale) | 186 TEST(WebTransformOperationTest, applyScale) |
176 { | 187 { |
177 double x = 1; | 188 double x = 1; |
178 double y = 2; | 189 double y = 2; |
179 double z = 3; | 190 double z = 3; |
180 WebTransformOperations operations; | 191 scoped_ptr<WebTransformOperations> operations( |
181 operations.appendScale(x, y, z); | 192 cc::TransformOperations::Create()); |
| 193 operations->appendScale(x, y, z); |
182 WebTransformationMatrix expected; | 194 WebTransformationMatrix expected; |
183 expected.scale3d(x, y, z); | 195 expected.scale3d(x, y, z); |
184 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); | 196 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->apply()); |
185 } | 197 } |
186 | 198 |
187 TEST(WebTransformOperationTest, applySkew) | 199 TEST(WebTransformOperationTest, applySkew) |
188 { | 200 { |
189 double x = 1; | 201 double x = 1; |
190 double y = 2; | 202 double y = 2; |
191 WebTransformOperations operations; | 203 scoped_ptr<WebTransformOperations> operations( |
192 operations.appendSkew(x, y); | 204 cc::TransformOperations::Create()); |
| 205 operations->appendSkew(x, y); |
193 WebTransformationMatrix expected; | 206 WebTransformationMatrix expected; |
194 expected.skewX(x); | 207 expected.skewX(x); |
195 expected.skewY(y); | 208 expected.skewY(y); |
196 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); | 209 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->apply()); |
197 } | 210 } |
198 | 211 |
199 TEST(WebTransformOperationTest, applyPerspective) | 212 TEST(WebTransformOperationTest, applyPerspective) |
200 { | 213 { |
201 double depth = 800; | 214 double depth = 800; |
202 WebTransformOperations operations; | 215 scoped_ptr<WebTransformOperations> operations( |
203 operations.appendPerspective(depth); | 216 cc::TransformOperations::Create()); |
| 217 operations->appendPerspective(depth); |
204 WebTransformationMatrix expected; | 218 WebTransformationMatrix expected; |
205 expected.applyPerspective(depth); | 219 expected.applyPerspective(depth); |
206 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.apply()); | 220 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->apply()); |
207 } | 221 } |
208 | 222 |
209 TEST(WebTransformOperationTest, applyMatrix) | 223 TEST(WebTransformOperationTest, applyMatrix) |
210 { | 224 { |
211 double dx = 1; | 225 double dx = 1; |
212 double dy = 2; | 226 double dy = 2; |
213 double dz = 3; | 227 double dz = 3; |
214 WebTransformationMatrix expectedMatrix; | 228 WebTransformationMatrix expectedMatrix; |
215 expectedMatrix.translate3d(dx, dy, dz); | 229 expectedMatrix.translate3d(dx, dy, dz); |
216 WebTransformOperations matrixTransform; | 230 scoped_ptr<WebTransformOperations> matrixTransform( |
217 matrixTransform.appendMatrix(expectedMatrix); | 231 cc::TransformOperations::Create()); |
218 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, matrixTransform.apply()); | 232 matrixTransform->appendMatrix(expectedMatrix); |
| 233 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, matrixTransform->apply()); |
219 } | 234 } |
220 | 235 |
221 TEST(WebTransformOperationTest, applyOrder) | 236 TEST(WebTransformOperationTest, applyOrder) |
222 { | 237 { |
223 double sx = 2; | 238 double sx = 2; |
224 double sy = 4; | 239 double sy = 4; |
225 double sz = 8; | 240 double sz = 8; |
226 | 241 |
227 double dx = 1; | 242 double dx = 1; |
228 double dy = 2; | 243 double dy = 2; |
229 double dz = 3; | 244 double dz = 3; |
230 | 245 |
231 WebTransformOperations operations; | 246 scoped_ptr<WebTransformOperations> operations( |
232 operations.appendScale(sx, sy, sz); | 247 cc::TransformOperations::Create()); |
233 operations.appendTranslate(dx, dy, dz); | 248 operations->appendScale(sx, sy, sz); |
| 249 operations->appendTranslate(dx, dy, dz); |
234 | 250 |
235 WebTransformationMatrix expectedScaleMatrix; | 251 WebTransformationMatrix expectedScaleMatrix; |
236 expectedScaleMatrix.scale3d(sx, sy, sz); | 252 expectedScaleMatrix.scale3d(sx, sy, sz); |
237 | 253 |
238 WebTransformationMatrix expectedTranslateMatrix; | 254 WebTransformationMatrix expectedTranslateMatrix; |
239 expectedTranslateMatrix.translate3d(dx, dy, dz); | 255 expectedTranslateMatrix.translate3d(dx, dy, dz); |
240 | 256 |
241 WebTransformationMatrix expectedCombinedMatrix = expectedScaleMatrix; | 257 WebTransformationMatrix expectedCombinedMatrix = expectedScaleMatrix; |
242 expectedCombinedMatrix.multiply(expectedTranslateMatrix); | 258 expectedCombinedMatrix.multiply(expectedTranslateMatrix); |
243 | 259 |
244 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedCombinedMatrix, operations.apply()); | 260 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedCombinedMatrix, operations->apply())
; |
245 } | 261 } |
246 | 262 |
247 TEST(WebTransformOperationTest, blendOrder) | 263 TEST(WebTransformOperationTest, blendOrder) |
248 { | 264 { |
249 double sx1 = 2; | 265 double sx1 = 2; |
250 double sy1 = 4; | 266 double sy1 = 4; |
251 double sz1 = 8; | 267 double sz1 = 8; |
252 | 268 |
253 double dx1 = 1; | 269 double dx1 = 1; |
254 double dy1 = 2; | 270 double dy1 = 2; |
255 double dz1 = 3; | 271 double dz1 = 3; |
256 | 272 |
257 double sx2 = 4; | 273 double sx2 = 4; |
258 double sy2 = 8; | 274 double sy2 = 8; |
259 double sz2 = 16; | 275 double sz2 = 16; |
260 | 276 |
261 double dx2 = 10; | 277 double dx2 = 10; |
262 double dy2 = 20; | 278 double dy2 = 20; |
263 double dz2 = 30; | 279 double dz2 = 30; |
264 | 280 |
265 WebTransformOperations operationsFrom; | 281 scoped_ptr<WebTransformOperations> operationsFrom( |
266 operationsFrom.appendScale(sx1, sy1, sz1); | 282 cc::TransformOperations::Create()); |
267 operationsFrom.appendTranslate(dx1, dy1, dz1); | 283 operationsFrom->appendScale(sx1, sy1, sz1); |
| 284 operationsFrom->appendTranslate(dx1, dy1, dz1); |
268 | 285 |
269 WebTransformOperations operationsTo; | 286 scoped_ptr<WebTransformOperations> operationsTo( |
270 operationsTo.appendScale(sx2, sy2, sz2); | 287 cc::TransformOperations::Create()); |
271 operationsTo.appendTranslate(dx2, dy2, dz2); | 288 operationsTo->appendScale(sx2, sy2, sz2); |
| 289 operationsTo->appendTranslate(dx2, dy2, dz2); |
272 | 290 |
273 WebTransformationMatrix scaleFrom; | 291 WebTransformationMatrix scaleFrom; |
274 scaleFrom.scale3d(sx1, sy1, sz1); | 292 scaleFrom.scale3d(sx1, sy1, sz1); |
275 WebTransformationMatrix translateFrom; | 293 WebTransformationMatrix translateFrom; |
276 translateFrom.translate3d(dx1, dy1, dz1); | 294 translateFrom.translate3d(dx1, dy1, dz1); |
277 | 295 |
278 WebTransformationMatrix scaleTo; | 296 WebTransformationMatrix scaleTo; |
279 scaleTo.scale3d(sx2, sy2, sz2); | 297 scaleTo.scale3d(sx2, sy2, sz2); |
280 WebTransformationMatrix translateTo; | 298 WebTransformationMatrix translateTo; |
281 translateTo.translate3d(dx2, dy2, dz2); | 299 translateTo.translate3d(dx2, dy2, dz2); |
282 | 300 |
283 double progress = 0.25; | 301 double progress = 0.25; |
284 | 302 |
285 WebTransformationMatrix blendedScale = scaleTo; | 303 WebTransformationMatrix blendedScale = scaleTo; |
286 blendedScale.blend(scaleFrom, progress); | 304 blendedScale.blend(scaleFrom, progress); |
287 | 305 |
288 WebTransformationMatrix blendedTranslate = translateTo; | 306 WebTransformationMatrix blendedTranslate = translateTo; |
289 blendedTranslate.blend(translateFrom, progress); | 307 blendedTranslate.blend(translateFrom, progress); |
290 | 308 |
291 WebTransformationMatrix expected = blendedScale; | 309 WebTransformationMatrix expected = blendedScale; |
292 expected.multiply(blendedTranslate); | 310 expected.multiply(blendedTranslate); |
293 | 311 |
294 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom,
progress)); | 312 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo->blend(*operationsFro
m, progress)); |
295 } | 313 } |
296 | 314 |
297 static void checkProgress(double progress, | 315 static void checkProgress(double progress, |
298 const WebTransformationMatrix& fromMatrix, | 316 const WebTransformationMatrix& fromMatrix, |
299 const WebTransformationMatrix& toMatrix, | 317 const WebTransformationMatrix& toMatrix, |
300 const WebTransformOperations& fromTransform, | 318 const WebTransformOperations& fromTransform, |
301 const WebTransformOperations& toTransform) | 319 const WebTransformOperations& toTransform) |
302 { | 320 { |
303 WebTransformationMatrix expectedMatrix = toMatrix; | 321 WebTransformationMatrix expectedMatrix = toMatrix; |
304 expectedMatrix.blend(fromMatrix, progress); | 322 expectedMatrix.blend(fromMatrix, progress); |
305 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, toTransform.blend(fromTransf
orm, progress)); | 323 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedMatrix, toTransform.blend(fromTransf
orm, progress)); |
306 } | 324 } |
307 | 325 |
308 TEST(WebTransformOperationTest, blendProgress) | 326 TEST(WebTransformOperationTest, blendProgress) |
309 { | 327 { |
310 double sx = 2; | 328 double sx = 2; |
311 double sy = 4; | 329 double sy = 4; |
312 double sz = 8; | 330 double sz = 8; |
313 WebTransformOperations operationsFrom; | 331 scoped_ptr<WebTransformOperations> operationsFrom( |
314 operationsFrom.appendScale(sx, sy, sz); | 332 cc::TransformOperations::Create()); |
| 333 operationsFrom->appendScale(sx, sy, sz); |
315 | 334 |
316 WebTransformationMatrix matrixFrom; | 335 WebTransformationMatrix matrixFrom; |
317 matrixFrom.scale3d(sx, sy, sz); | 336 matrixFrom.scale3d(sx, sy, sz); |
318 | 337 |
319 sx = 4; | 338 sx = 4; |
320 sy = 8; | 339 sy = 8; |
321 sz = 16; | 340 sz = 16; |
322 WebTransformOperations operationsTo; | 341 scoped_ptr<WebTransformOperations> operationsTo( |
323 operationsTo.appendScale(sx, sy, sz); | 342 cc::TransformOperations::Create()); |
| 343 operationsTo->appendScale(sx, sy, sz); |
324 | 344 |
325 WebTransformationMatrix matrixTo; | 345 WebTransformationMatrix matrixTo; |
326 matrixTo.scale3d(sx, sy, sz); | 346 matrixTo.scale3d(sx, sy, sz); |
327 | 347 |
328 checkProgress(-1, matrixFrom, matrixTo, operationsFrom, operationsTo); | 348 checkProgress(-1, matrixFrom, matrixTo, *operationsFrom, *operationsTo); |
329 checkProgress(0, matrixFrom, matrixTo, operationsFrom, operationsTo); | 349 checkProgress(0, matrixFrom, matrixTo, *operationsFrom, *operationsTo); |
330 checkProgress(0.25, matrixFrom, matrixTo, operationsFrom, operationsTo); | 350 checkProgress(0.25, matrixFrom, matrixTo, *operationsFrom, *operationsTo); |
331 checkProgress(0.5, matrixFrom, matrixTo, operationsFrom, operationsTo); | 351 checkProgress(0.5, matrixFrom, matrixTo, *operationsFrom, *operationsTo); |
332 checkProgress(1, matrixFrom, matrixTo, operationsFrom, operationsTo); | 352 checkProgress(1, matrixFrom, matrixTo, *operationsFrom, *operationsTo); |
333 checkProgress(2, matrixFrom, matrixTo, operationsFrom, operationsTo); | 353 checkProgress(2, matrixFrom, matrixTo, *operationsFrom, *operationsTo); |
334 } | 354 } |
335 | 355 |
336 TEST(WebTransformOperationTest, blendWhenTypesDoNotMatch) | 356 TEST(WebTransformOperationTest, blendWhenTypesDoNotMatch) |
337 { | 357 { |
338 double sx1 = 2; | 358 double sx1 = 2; |
339 double sy1 = 4; | 359 double sy1 = 4; |
340 double sz1 = 8; | 360 double sz1 = 8; |
341 | 361 |
342 double dx1 = 1; | 362 double dx1 = 1; |
343 double dy1 = 2; | 363 double dy1 = 2; |
344 double dz1 = 3; | 364 double dz1 = 3; |
345 | 365 |
346 double sx2 = 4; | 366 double sx2 = 4; |
347 double sy2 = 8; | 367 double sy2 = 8; |
348 double sz2 = 16; | 368 double sz2 = 16; |
349 | 369 |
350 double dx2 = 10; | 370 double dx2 = 10; |
351 double dy2 = 20; | 371 double dy2 = 20; |
352 double dz2 = 30; | 372 double dz2 = 30; |
353 | 373 |
354 WebTransformOperations operationsFrom; | 374 scoped_ptr<WebTransformOperations> operationsFrom( |
355 operationsFrom.appendScale(sx1, sy1, sz1); | 375 cc::TransformOperations::Create()); |
356 operationsFrom.appendTranslate(dx1, dy1, dz1); | 376 operationsFrom->appendScale(sx1, sy1, sz1); |
| 377 operationsFrom->appendTranslate(dx1, dy1, dz1); |
357 | 378 |
358 WebTransformOperations operationsTo; | 379 scoped_ptr<WebTransformOperations> operationsTo( |
359 operationsTo.appendTranslate(dx2, dy2, dz2); | 380 cc::TransformOperations::Create()); |
360 operationsTo.appendScale(sx2, sy2, sz2); | 381 operationsTo->appendTranslate(dx2, dy2, dz2); |
| 382 operationsTo->appendScale(sx2, sy2, sz2); |
361 | 383 |
362 WebTransformationMatrix from; | 384 WebTransformationMatrix from; |
363 from.scale3d(sx1, sy1, sz1); | 385 from.scale3d(sx1, sy1, sz1); |
364 from.translate3d(dx1, dy1, dz1); | 386 from.translate3d(dx1, dy1, dz1); |
365 | 387 |
366 WebTransformationMatrix to; | 388 WebTransformationMatrix to; |
367 to.translate3d(dx2, dy2, dz2); | 389 to.translate3d(dx2, dy2, dz2); |
368 to.scale3d(sx2, sy2, sz2); | 390 to.scale3d(sx2, sy2, sz2); |
369 | 391 |
370 double progress = 0.25; | 392 double progress = 0.25; |
371 | 393 |
372 WebTransformationMatrix expected = to; | 394 WebTransformationMatrix expected = to; |
373 expected.blend(from, progress); | 395 expected.blend(from, progress); |
374 | 396 |
375 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom,
progress)); | 397 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo->blend(*operationsFro
m, progress)); |
376 } | 398 } |
377 | 399 |
378 TEST(WebTransformOperationTest, largeRotationsWithSameAxis) | 400 TEST(WebTransformOperationTest, largeRotationsWithSameAxis) |
379 { | 401 { |
380 WebTransformOperations operationsFrom; | 402 scoped_ptr<WebTransformOperations> operationsFrom( |
381 operationsFrom.appendRotate(0, 0, 1, 0); | 403 cc::TransformOperations::Create()); |
| 404 operationsFrom->appendRotate(0, 0, 1, 0); |
382 | 405 |
383 WebTransformOperations operationsTo; | 406 scoped_ptr<WebTransformOperations> operationsTo( |
384 operationsTo.appendRotate(0, 0, 2, 360); | 407 cc::TransformOperations::Create()); |
| 408 operationsTo->appendRotate(0, 0, 2, 360); |
385 | 409 |
386 double progress = 0.5; | 410 double progress = 0.5; |
387 | 411 |
388 WebTransformationMatrix expected; | 412 WebTransformationMatrix expected; |
389 expected.rotate3d(0, 0, 1, 180); | 413 expected.rotate3d(0, 0, 1, 180); |
390 | 414 |
391 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom,
progress)); | 415 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo->blend(*operationsFro
m, progress)); |
392 } | 416 } |
393 | 417 |
394 TEST(WebTransformOperationTest, largeRotationsWithSameAxisInDifferentDirection) | 418 TEST(WebTransformOperationTest, largeRotationsWithSameAxisInDifferentDirection) |
395 { | 419 { |
396 WebTransformOperations operationsFrom; | 420 scoped_ptr<WebTransformOperations> operationsFrom( |
397 operationsFrom.appendRotate(0, 0, 1, 180); | 421 cc::TransformOperations::Create()); |
| 422 operationsFrom->appendRotate(0, 0, 1, 180); |
398 | 423 |
399 WebTransformOperations operationsTo; | 424 scoped_ptr<WebTransformOperations> operationsTo( |
400 operationsTo.appendRotate(0, 0, -1, 180); | 425 cc::TransformOperations::Create()); |
| 426 operationsTo->appendRotate(0, 0, -1, 180); |
401 | 427 |
402 double progress = 0.5; | 428 double progress = 0.5; |
403 | 429 |
404 WebTransformationMatrix expected; | 430 WebTransformationMatrix expected; |
405 | 431 |
406 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom,
progress)); | 432 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo->blend(*operationsFro
m, progress)); |
407 } | 433 } |
408 | 434 |
409 TEST(WebTransformOperationTest, largeRotationsWithDifferentAxes) | 435 TEST(WebTransformOperationTest, largeRotationsWithDifferentAxes) |
410 { | 436 { |
411 WebTransformOperations operationsFrom; | 437 scoped_ptr<WebTransformOperations> operationsFrom( |
412 operationsFrom.appendRotate(0, 0, 1, 180); | 438 cc::TransformOperations::Create()); |
| 439 operationsFrom->appendRotate(0, 0, 1, 180); |
413 | 440 |
414 WebTransformOperations operationsTo; | 441 scoped_ptr<WebTransformOperations> operationsTo( |
415 operationsTo.appendRotate(0, 1, 0, 180); | 442 cc::TransformOperations::Create()); |
| 443 operationsTo->appendRotate(0, 1, 0, 180); |
416 | 444 |
417 double progress = 0.5; | 445 double progress = 0.5; |
418 WebTransformationMatrix matrixFrom; | 446 WebTransformationMatrix matrixFrom; |
419 matrixFrom.rotate3d(0, 0, 1, 180); | 447 matrixFrom.rotate3d(0, 0, 1, 180); |
420 | 448 |
421 WebTransformationMatrix matrixTo; | 449 WebTransformationMatrix matrixTo; |
422 matrixTo.rotate3d(0, 1, 0, 180); | 450 matrixTo.rotate3d(0, 1, 0, 180); |
423 | 451 |
424 WebTransformationMatrix expected = matrixTo; | 452 WebTransformationMatrix expected = matrixTo; |
425 expected.blend(matrixFrom, progress); | 453 expected.blend(matrixFrom, progress); |
426 | 454 |
427 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo.blend(operationsFrom,
progress)); | 455 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operationsTo->blend(*operationsFro
m, progress)); |
428 } | 456 } |
429 | 457 |
430 TEST(WebTransformOperationTest, blendRotationFromIdentity) | 458 TEST(WebTransformOperationTest, blendRotationFromIdentity) |
431 { | 459 { |
432 ScopedVector<WebTransformOperations> identityOperations; | 460 ScopedVector<WebTransformOperations> identityOperations; |
433 getIdentityOperations(&identityOperations); | 461 getIdentityOperations(&identityOperations); |
434 | 462 |
435 for (size_t i = 0; i < identityOperations.size(); ++i) { | 463 for (size_t i = 0; i < identityOperations.size(); ++i) { |
436 WebTransformOperations operations; | 464 scoped_ptr<WebTransformOperations> operations( |
437 operations.appendRotate(0, 0, 1, 360); | 465 cc::TransformOperations::Create()); |
| 466 operations->appendRotate(0, 0, 1, 360); |
438 | 467 |
439 double progress = 0.5; | 468 double progress = 0.5; |
440 | 469 |
441 WebTransformationMatrix expected; | 470 WebTransformationMatrix expected; |
442 expected.rotate3d(0, 0, 1, 180); | 471 expected.rotate3d(0, 0, 1, 180); |
443 | 472 |
444 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOper
ations[i], progress)); | 473 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->blend(*identityOpe
rations[i], progress)); |
445 } | 474 } |
446 } | 475 } |
447 | 476 |
448 TEST(WebTransformOperationTest, blendTranslationFromIdentity) | 477 TEST(WebTransformOperationTest, blendTranslationFromIdentity) |
449 { | 478 { |
450 ScopedVector<WebTransformOperations> identityOperations; | 479 ScopedVector<WebTransformOperations> identityOperations; |
451 getIdentityOperations(&identityOperations); | 480 getIdentityOperations(&identityOperations); |
452 | 481 |
453 for (size_t i = 0; i < identityOperations.size(); ++i) { | 482 for (size_t i = 0; i < identityOperations.size(); ++i) { |
454 WebTransformOperations operations; | 483 scoped_ptr<WebTransformOperations> operations( |
455 operations.appendTranslate(2, 2, 2); | 484 cc::TransformOperations::Create()); |
| 485 operations->appendTranslate(2, 2, 2); |
456 | 486 |
457 double progress = 0.5; | 487 double progress = 0.5; |
458 | 488 |
459 WebTransformationMatrix expected; | 489 WebTransformationMatrix expected; |
460 expected.translate3d(1, 1, 1); | 490 expected.translate3d(1, 1, 1); |
461 | 491 |
462 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOper
ations[i], progress)); | 492 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->blend(*identityOpe
rations[i], progress)); |
463 } | 493 } |
464 } | 494 } |
465 | 495 |
466 TEST(WebTransformOperationTest, blendScaleFromIdentity) | 496 TEST(WebTransformOperationTest, blendScaleFromIdentity) |
467 { | 497 { |
468 ScopedVector<WebTransformOperations> identityOperations; | 498 ScopedVector<WebTransformOperations> identityOperations; |
469 getIdentityOperations(&identityOperations); | 499 getIdentityOperations(&identityOperations); |
470 | 500 |
471 for (size_t i = 0; i < identityOperations.size(); ++i) { | 501 for (size_t i = 0; i < identityOperations.size(); ++i) { |
472 WebTransformOperations operations; | 502 scoped_ptr<WebTransformOperations> operations( |
473 operations.appendScale(3, 3, 3); | 503 cc::TransformOperations::Create()); |
| 504 operations->appendScale(3, 3, 3); |
474 | 505 |
475 double progress = 0.5; | 506 double progress = 0.5; |
476 | 507 |
477 WebTransformationMatrix expected; | 508 WebTransformationMatrix expected; |
478 expected.scale3d(2, 2, 2); | 509 expected.scale3d(2, 2, 2); |
479 | 510 |
480 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOper
ations[i], progress)); | 511 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->blend(*identityOpe
rations[i], progress)); |
481 } | 512 } |
482 } | 513 } |
483 | 514 |
484 TEST(WebTransformOperationTest, blendSkewFromIdentity) | 515 TEST(WebTransformOperationTest, blendSkewFromIdentity) |
485 { | 516 { |
486 ScopedVector<WebTransformOperations> identityOperations; | 517 ScopedVector<WebTransformOperations> identityOperations; |
487 getIdentityOperations(&identityOperations); | 518 getIdentityOperations(&identityOperations); |
488 | 519 |
489 for (size_t i = 0; i < identityOperations.size(); ++i) { | 520 for (size_t i = 0; i < identityOperations.size(); ++i) { |
490 WebTransformOperations operations; | 521 scoped_ptr<WebTransformOperations> operations( |
491 operations.appendSkew(2, 2); | 522 cc::TransformOperations::Create()); |
| 523 operations->appendSkew(2, 2); |
492 | 524 |
493 double progress = 0.5; | 525 double progress = 0.5; |
494 | 526 |
495 WebTransformationMatrix expected; | 527 WebTransformationMatrix expected; |
496 expected.skewX(1); | 528 expected.skewX(1); |
497 expected.skewY(1); | 529 expected.skewY(1); |
498 | 530 |
499 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOper
ations[i], progress)); | 531 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->blend(*identityOpe
rations[i], progress)); |
500 } | 532 } |
501 } | 533 } |
502 | 534 |
503 TEST(WebTransformOperationTest, blendPerspectiveFromIdentity) | 535 TEST(WebTransformOperationTest, blendPerspectiveFromIdentity) |
504 { | 536 { |
505 ScopedVector<WebTransformOperations> identityOperations; | 537 ScopedVector<WebTransformOperations> identityOperations; |
506 getIdentityOperations(&identityOperations); | 538 getIdentityOperations(&identityOperations); |
507 | 539 |
508 for (size_t i = 0; i < identityOperations.size(); ++i) { | 540 for (size_t i = 0; i < identityOperations.size(); ++i) { |
509 WebTransformOperations operations; | 541 scoped_ptr<WebTransformOperations> operations( |
510 operations.appendPerspective(1000); | 542 cc::TransformOperations::Create()); |
| 543 operations->appendPerspective(1000); |
511 | 544 |
512 double progress = 0.5; | 545 double progress = 0.5; |
513 | 546 |
514 WebTransformationMatrix expected; | 547 WebTransformationMatrix expected; |
515 expected.applyPerspective(500 + 0.5 * std::numeric_limits<double>::max()
); | 548 expected.applyPerspective(500 + 0.5 * std::numeric_limits<double>::max()
); |
516 | 549 |
517 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations.blend(*identityOper
ations[i], progress)); | 550 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, operations->blend(*identityOpe
rations[i], progress)); |
518 } | 551 } |
519 } | 552 } |
520 | 553 |
521 TEST(WebTransformOperationTest, blendRotationToIdentity) | 554 TEST(WebTransformOperationTest, blendRotationToIdentity) |
522 { | 555 { |
523 ScopedVector<WebTransformOperations> identityOperations; | 556 ScopedVector<WebTransformOperations> identityOperations; |
524 getIdentityOperations(&identityOperations); | 557 getIdentityOperations(&identityOperations); |
525 | 558 |
526 for (size_t i = 0; i < identityOperations.size(); ++i) { | 559 for (size_t i = 0; i < identityOperations.size(); ++i) { |
527 WebTransformOperations operations; | 560 scoped_ptr<WebTransformOperations> operations( |
528 operations.appendRotate(0, 0, 1, 360); | 561 cc::TransformOperations::Create()); |
| 562 operations->appendRotate(0, 0, 1, 360); |
529 | 563 |
530 double progress = 0.5; | 564 double progress = 0.5; |
531 | 565 |
532 WebTransformationMatrix expected; | 566 WebTransformationMatrix expected; |
533 expected.rotate3d(0, 0, 1, 180); | 567 expected.rotate3d(0, 0, 1, 180); |
534 | 568 |
535 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(o
perations, progress)); | 569 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(*
operations, progress)); |
536 } | 570 } |
537 } | 571 } |
538 | 572 |
539 TEST(WebTransformOperationTest, blendTranslationToIdentity) | 573 TEST(WebTransformOperationTest, blendTranslationToIdentity) |
540 { | 574 { |
541 ScopedVector<WebTransformOperations> identityOperations; | 575 ScopedVector<WebTransformOperations> identityOperations; |
542 getIdentityOperations(&identityOperations); | 576 getIdentityOperations(&identityOperations); |
543 | 577 |
544 for (size_t i = 0; i < identityOperations.size(); ++i) { | 578 for (size_t i = 0; i < identityOperations.size(); ++i) { |
545 WebTransformOperations operations; | 579 scoped_ptr<WebTransformOperations> operations( |
546 operations.appendTranslate(2, 2, 2); | 580 cc::TransformOperations::Create()); |
| 581 operations->appendTranslate(2, 2, 2); |
547 | 582 |
548 double progress = 0.5; | 583 double progress = 0.5; |
549 | 584 |
550 WebTransformationMatrix expected; | 585 WebTransformationMatrix expected; |
551 expected.translate3d(1, 1, 1); | 586 expected.translate3d(1, 1, 1); |
552 | 587 |
553 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(o
perations, progress)); | 588 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(*
operations, progress)); |
554 } | 589 } |
555 } | 590 } |
556 | 591 |
557 TEST(WebTransformOperationTest, blendScaleToIdentity) | 592 TEST(WebTransformOperationTest, blendScaleToIdentity) |
558 { | 593 { |
559 ScopedVector<WebTransformOperations> identityOperations; | 594 ScopedVector<WebTransformOperations> identityOperations; |
560 getIdentityOperations(&identityOperations); | 595 getIdentityOperations(&identityOperations); |
561 | 596 |
562 for (size_t i = 0; i < identityOperations.size(); ++i) { | 597 for (size_t i = 0; i < identityOperations.size(); ++i) { |
563 WebTransformOperations operations; | 598 scoped_ptr<WebTransformOperations> operations( |
564 operations.appendScale(3, 3, 3); | 599 cc::TransformOperations::Create()); |
| 600 operations->appendScale(3, 3, 3); |
565 | 601 |
566 double progress = 0.5; | 602 double progress = 0.5; |
567 | 603 |
568 WebTransformationMatrix expected; | 604 WebTransformationMatrix expected; |
569 expected.scale3d(2, 2, 2); | 605 expected.scale3d(2, 2, 2); |
570 | 606 |
571 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(o
perations, progress)); | 607 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(*
operations, progress)); |
572 } | 608 } |
573 } | 609 } |
574 | 610 |
575 TEST(WebTransformOperationTest, blendSkewToIdentity) | 611 TEST(WebTransformOperationTest, blendSkewToIdentity) |
576 { | 612 { |
577 ScopedVector<WebTransformOperations> identityOperations; | 613 ScopedVector<WebTransformOperations> identityOperations; |
578 getIdentityOperations(&identityOperations); | 614 getIdentityOperations(&identityOperations); |
579 | 615 |
580 for (size_t i = 0; i < identityOperations.size(); ++i) { | 616 for (size_t i = 0; i < identityOperations.size(); ++i) { |
581 WebTransformOperations operations; | 617 scoped_ptr<WebTransformOperations> operations( |
582 operations.appendSkew(2, 2); | 618 cc::TransformOperations::Create()); |
| 619 operations->appendSkew(2, 2); |
583 | 620 |
584 double progress = 0.5; | 621 double progress = 0.5; |
585 | 622 |
586 WebTransformationMatrix expected; | 623 WebTransformationMatrix expected; |
587 expected.skewX(1); | 624 expected.skewX(1); |
588 expected.skewY(1); | 625 expected.skewY(1); |
589 | 626 |
590 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(o
perations, progress)); | 627 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(*
operations, progress)); |
591 } | 628 } |
592 } | 629 } |
593 | 630 |
594 TEST(WebTransformOperationTest, blendPerspectiveToIdentity) | 631 TEST(WebTransformOperationTest, blendPerspectiveToIdentity) |
595 { | 632 { |
596 ScopedVector<WebTransformOperations> identityOperations; | 633 ScopedVector<WebTransformOperations> identityOperations; |
597 getIdentityOperations(&identityOperations); | 634 getIdentityOperations(&identityOperations); |
598 | 635 |
599 for (size_t i = 0; i < identityOperations.size(); ++i) { | 636 for (size_t i = 0; i < identityOperations.size(); ++i) { |
600 WebTransformOperations operations; | 637 scoped_ptr<WebTransformOperations> operations( |
601 operations.appendPerspective(1000); | 638 cc::TransformOperations::Create()); |
| 639 operations->appendPerspective(1000); |
602 | 640 |
603 double progress = 0.5; | 641 double progress = 0.5; |
604 | 642 |
605 WebTransformationMatrix expected; | 643 WebTransformationMatrix expected; |
606 expected.applyPerspective(500 + 0.5 * std::numeric_limits<double>::max()
); | 644 expected.applyPerspective(500 + 0.5 * std::numeric_limits<double>::max()
); |
607 | 645 |
608 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(o
perations, progress)); | 646 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, identityOperations[i]->blend(*
operations, progress)); |
609 } | 647 } |
610 } | 648 } |
OLD | NEW |