OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer_animation_element.h" | 5 #include "ui/compositor/layer_animation_element.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/time/time.h" | 10 #include "base/time/time.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "ui/compositor/layer_animation_delegate.h" | 12 #include "ui/compositor/layer_animation_delegate.h" |
12 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 13 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
13 #include "ui/compositor/test/test_layer_animation_delegate.h" | 14 #include "ui/compositor/test/test_layer_animation_delegate.h" |
14 #include "ui/compositor/test/test_utils.h" | 15 #include "ui/compositor/test/test_utils.h" |
15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/gfx/transform.h" | 17 #include "ui/gfx/transform.h" |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // that the element can be reused after it completes. | 55 // that the element can be reused after it completes. |
55 TEST(LayerAnimationElementTest, TransformElement) { | 56 TEST(LayerAnimationElementTest, TransformElement) { |
56 TestLayerAnimationDelegate delegate; | 57 TestLayerAnimationDelegate delegate; |
57 gfx::Transform start_transform, target_transform; | 58 gfx::Transform start_transform, target_transform; |
58 start_transform.Rotate(-30.0); | 59 start_transform.Rotate(-30.0); |
59 target_transform.Rotate(30.0); | 60 target_transform.Rotate(30.0); |
60 base::TimeTicks start_time; | 61 base::TimeTicks start_time; |
61 base::TimeTicks effective_start_time; | 62 base::TimeTicks effective_start_time; |
62 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 63 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
63 | 64 |
64 scoped_ptr<LayerAnimationElement> element( | 65 std::unique_ptr<LayerAnimationElement> element( |
65 LayerAnimationElement::CreateTransformElement(target_transform, delta)); | 66 LayerAnimationElement::CreateTransformElement(target_transform, delta)); |
66 element->set_animation_group_id(1); | 67 element->set_animation_group_id(1); |
67 | 68 |
68 for (int i = 0; i < 2; ++i) { | 69 for (int i = 0; i < 2; ++i) { |
69 start_time = effective_start_time + delta; | 70 start_time = effective_start_time + delta; |
70 element->set_requested_start_time(start_time); | 71 element->set_requested_start_time(start_time); |
71 delegate.SetTransformFromAnimation(start_transform); | 72 delegate.SetTransformFromAnimation(start_transform); |
72 element->Start(&delegate, 1); | 73 element->Start(&delegate, 1); |
73 element->Progress(start_time, &delegate); | 74 element->Progress(start_time, &delegate); |
74 CheckApproximatelyEqual(start_transform, | 75 CheckApproximatelyEqual(start_transform, |
(...skipping 19 matching lines...) Expand all Loading... |
94 LayerAnimationElement::TargetValue target_value(&delegate); | 95 LayerAnimationElement::TargetValue target_value(&delegate); |
95 element->GetTargetValue(&target_value); | 96 element->GetTargetValue(&target_value); |
96 CheckApproximatelyEqual(target_transform, target_value.transform); | 97 CheckApproximatelyEqual(target_transform, target_value.transform); |
97 } | 98 } |
98 | 99 |
99 // Ensures that duration is copied correctly. | 100 // Ensures that duration is copied correctly. |
100 TEST(LayerAnimationElementTest, InverseElementDurationNoScale) { | 101 TEST(LayerAnimationElementTest, InverseElementDurationNoScale) { |
101 gfx::Transform transform; | 102 gfx::Transform transform; |
102 base::TimeDelta delta; | 103 base::TimeDelta delta; |
103 | 104 |
104 scoped_ptr<LayerAnimationElement> base_element( | 105 std::unique_ptr<LayerAnimationElement> base_element( |
105 LayerAnimationElement::CreateTransformElement(transform, delta)); | 106 LayerAnimationElement::CreateTransformElement(transform, delta)); |
106 | 107 |
107 scoped_ptr<LayerAnimationElement> inverse_element( | 108 std::unique_ptr<LayerAnimationElement> inverse_element( |
108 LayerAnimationElement::CreateInverseTransformElement(transform, | 109 LayerAnimationElement::CreateInverseTransformElement(transform, |
109 base_element.get())); | 110 base_element.get())); |
110 EXPECT_EQ(base_element->duration(), inverse_element->duration()); | 111 EXPECT_EQ(base_element->duration(), inverse_element->duration()); |
111 } | 112 } |
112 | 113 |
113 // Ensures that duration is copied correctly and not double scaled. | 114 // Ensures that duration is copied correctly and not double scaled. |
114 TEST(LayerAnimationElementTest, InverseElementDurationScaled) { | 115 TEST(LayerAnimationElementTest, InverseElementDurationScaled) { |
115 gfx::Transform transform; | 116 gfx::Transform transform; |
116 base::TimeDelta delta; | 117 base::TimeDelta delta; |
117 | 118 |
118 ScopedAnimationDurationScaleMode faster_duration( | 119 ScopedAnimationDurationScaleMode faster_duration( |
119 ScopedAnimationDurationScaleMode::FAST_DURATION); | 120 ScopedAnimationDurationScaleMode::FAST_DURATION); |
120 scoped_ptr<LayerAnimationElement> base_element( | 121 std::unique_ptr<LayerAnimationElement> base_element( |
121 LayerAnimationElement::CreateTransformElement(transform, delta)); | 122 LayerAnimationElement::CreateTransformElement(transform, delta)); |
122 | 123 |
123 scoped_ptr<LayerAnimationElement> inverse_element( | 124 std::unique_ptr<LayerAnimationElement> inverse_element( |
124 LayerAnimationElement::CreateInverseTransformElement(transform, | 125 LayerAnimationElement::CreateInverseTransformElement(transform, |
125 base_element.get())); | 126 base_element.get())); |
126 EXPECT_EQ(base_element->duration(), inverse_element->duration()); | 127 EXPECT_EQ(base_element->duration(), inverse_element->duration()); |
127 } | 128 } |
128 | 129 |
129 // Ensures that the GetTargetTransform() method works as intended. | 130 // Ensures that the GetTargetTransform() method works as intended. |
130 TEST(LayerAnimationElementTest, InverseElementTargetCalculation) { | 131 TEST(LayerAnimationElementTest, InverseElementTargetCalculation) { |
131 base::TimeTicks start_time; | 132 base::TimeTicks start_time; |
132 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 133 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
133 start_time += delta; | 134 start_time += delta; |
134 | 135 |
135 gfx::Transform identity, transform; | 136 gfx::Transform identity, transform; |
136 | 137 |
137 transform.Scale3d(2.0, 2.0, 2.0); | 138 transform.Scale3d(2.0, 2.0, 2.0); |
138 | 139 |
139 scoped_ptr<LayerAnimationElement> base_element( | 140 std::unique_ptr<LayerAnimationElement> base_element( |
140 LayerAnimationElement::CreateTransformElement(transform, delta)); | 141 LayerAnimationElement::CreateTransformElement(transform, delta)); |
141 scoped_ptr<LayerAnimationElement> inverse_element( | 142 std::unique_ptr<LayerAnimationElement> inverse_element( |
142 LayerAnimationElement::CreateInverseTransformElement(identity, | 143 LayerAnimationElement::CreateInverseTransformElement(identity, |
143 base_element.get())); | 144 base_element.get())); |
144 | 145 |
145 base_element->set_requested_start_time(start_time); | 146 base_element->set_requested_start_time(start_time); |
146 inverse_element->set_requested_start_time(start_time); | 147 inverse_element->set_requested_start_time(start_time); |
147 | 148 |
148 TestLayerAnimationDelegate delegate; | 149 TestLayerAnimationDelegate delegate; |
149 delegate.SetTransformFromAnimation(transform); | 150 delegate.SetTransformFromAnimation(transform); |
150 | 151 |
151 base_element->Start(&delegate, 1); | 152 base_element->Start(&delegate, 1); |
(...skipping 10 matching lines...) Expand all Loading... |
162 // that the element can be reused after it completes. | 163 // that the element can be reused after it completes. |
163 TEST(LayerAnimationElementTest, BoundsElement) { | 164 TEST(LayerAnimationElementTest, BoundsElement) { |
164 TestLayerAnimationDelegate delegate; | 165 TestLayerAnimationDelegate delegate; |
165 gfx::Rect start, target, middle; | 166 gfx::Rect start, target, middle; |
166 start = target = middle = gfx::Rect(0, 0, 50, 50); | 167 start = target = middle = gfx::Rect(0, 0, 50, 50); |
167 start.set_x(-90); | 168 start.set_x(-90); |
168 target.set_x(90); | 169 target.set_x(90); |
169 base::TimeTicks start_time; | 170 base::TimeTicks start_time; |
170 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 171 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
171 | 172 |
172 scoped_ptr<LayerAnimationElement> element( | 173 std::unique_ptr<LayerAnimationElement> element( |
173 LayerAnimationElement::CreateBoundsElement(target, delta)); | 174 LayerAnimationElement::CreateBoundsElement(target, delta)); |
174 | 175 |
175 for (int i = 0; i < 2; ++i) { | 176 for (int i = 0; i < 2; ++i) { |
176 start_time += delta; | 177 start_time += delta; |
177 element->set_requested_start_time(start_time); | 178 element->set_requested_start_time(start_time); |
178 delegate.SetBoundsFromAnimation(start); | 179 delegate.SetBoundsFromAnimation(start); |
179 element->Start(&delegate, 1); | 180 element->Start(&delegate, 1); |
180 element->Progress(start_time, &delegate); | 181 element->Progress(start_time, &delegate); |
181 CheckApproximatelyEqual(start, delegate.GetBoundsForAnimation()); | 182 CheckApproximatelyEqual(start, delegate.GetBoundsForAnimation()); |
182 element->Progress(start_time + delta/2, &delegate); | 183 element->Progress(start_time + delta/2, &delegate); |
(...skipping 15 matching lines...) Expand all Loading... |
198 // Check that the opacity element progresses the delegate as expected and | 199 // Check that the opacity element progresses the delegate as expected and |
199 // that the element can be reused after it completes. | 200 // that the element can be reused after it completes. |
200 TEST(LayerAnimationElementTest, OpacityElement) { | 201 TEST(LayerAnimationElementTest, OpacityElement) { |
201 TestLayerAnimationDelegate delegate; | 202 TestLayerAnimationDelegate delegate; |
202 float start = 0.0; | 203 float start = 0.0; |
203 float middle = 0.5; | 204 float middle = 0.5; |
204 float target = 1.0; | 205 float target = 1.0; |
205 base::TimeTicks start_time; | 206 base::TimeTicks start_time; |
206 base::TimeTicks effective_start_time; | 207 base::TimeTicks effective_start_time; |
207 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 208 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
208 scoped_ptr<LayerAnimationElement> element( | 209 std::unique_ptr<LayerAnimationElement> element( |
209 LayerAnimationElement::CreateOpacityElement(target, delta)); | 210 LayerAnimationElement::CreateOpacityElement(target, delta)); |
210 | 211 |
211 for (int i = 0; i < 2; ++i) { | 212 for (int i = 0; i < 2; ++i) { |
212 start_time = effective_start_time + delta; | 213 start_time = effective_start_time + delta; |
213 element->set_requested_start_time(start_time); | 214 element->set_requested_start_time(start_time); |
214 delegate.SetOpacityFromAnimation(start); | 215 delegate.SetOpacityFromAnimation(start); |
215 element->Start(&delegate, 1); | 216 element->Start(&delegate, 1); |
216 element->Progress(start_time, &delegate); | 217 element->Progress(start_time, &delegate); |
217 EXPECT_FLOAT_EQ(start, element->last_progressed_fraction()); | 218 EXPECT_FLOAT_EQ(start, element->last_progressed_fraction()); |
218 effective_start_time = start_time + delta; | 219 effective_start_time = start_time + delta; |
(...skipping 19 matching lines...) Expand all Loading... |
238 } | 239 } |
239 | 240 |
240 // Check that the visibility element progresses the delegate as expected and | 241 // Check that the visibility element progresses the delegate as expected and |
241 // that the element can be reused after it completes. | 242 // that the element can be reused after it completes. |
242 TEST(LayerAnimationElementTest, VisibilityElement) { | 243 TEST(LayerAnimationElementTest, VisibilityElement) { |
243 TestLayerAnimationDelegate delegate; | 244 TestLayerAnimationDelegate delegate; |
244 bool start = true; | 245 bool start = true; |
245 bool target = false; | 246 bool target = false; |
246 base::TimeTicks start_time; | 247 base::TimeTicks start_time; |
247 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 248 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
248 scoped_ptr<LayerAnimationElement> element( | 249 std::unique_ptr<LayerAnimationElement> element( |
249 LayerAnimationElement::CreateVisibilityElement(target, delta)); | 250 LayerAnimationElement::CreateVisibilityElement(target, delta)); |
250 | 251 |
251 for (int i = 0; i < 2; ++i) { | 252 for (int i = 0; i < 2; ++i) { |
252 start_time += delta; | 253 start_time += delta; |
253 element->set_requested_start_time(start_time); | 254 element->set_requested_start_time(start_time); |
254 delegate.SetVisibilityFromAnimation(start); | 255 delegate.SetVisibilityFromAnimation(start); |
255 element->Start(&delegate, 1); | 256 element->Start(&delegate, 1); |
256 element->Progress(start_time, &delegate); | 257 element->Progress(start_time, &delegate); |
257 EXPECT_TRUE(delegate.GetVisibilityForAnimation()); | 258 EXPECT_TRUE(delegate.GetVisibilityForAnimation()); |
258 element->Progress(start_time + delta/2, &delegate); | 259 element->Progress(start_time + delta/2, &delegate); |
(...skipping 14 matching lines...) Expand all Loading... |
273 | 274 |
274 // Check that the Brightness element progresses the delegate as expected and | 275 // Check that the Brightness element progresses the delegate as expected and |
275 // that the element can be reused after it completes. | 276 // that the element can be reused after it completes. |
276 TEST(LayerAnimationElementTest, BrightnessElement) { | 277 TEST(LayerAnimationElementTest, BrightnessElement) { |
277 TestLayerAnimationDelegate delegate; | 278 TestLayerAnimationDelegate delegate; |
278 float start = 0.0; | 279 float start = 0.0; |
279 float middle = 0.5; | 280 float middle = 0.5; |
280 float target = 1.0; | 281 float target = 1.0; |
281 base::TimeTicks start_time; | 282 base::TimeTicks start_time; |
282 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 283 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
283 scoped_ptr<LayerAnimationElement> element( | 284 std::unique_ptr<LayerAnimationElement> element( |
284 LayerAnimationElement::CreateBrightnessElement(target, delta)); | 285 LayerAnimationElement::CreateBrightnessElement(target, delta)); |
285 | 286 |
286 for (int i = 0; i < 2; ++i) { | 287 for (int i = 0; i < 2; ++i) { |
287 start_time += delta; | 288 start_time += delta; |
288 element->set_requested_start_time(start_time); | 289 element->set_requested_start_time(start_time); |
289 delegate.SetBrightnessFromAnimation(start); | 290 delegate.SetBrightnessFromAnimation(start); |
290 element->Start(&delegate, 1); | 291 element->Start(&delegate, 1); |
291 element->Progress(start_time, &delegate); | 292 element->Progress(start_time, &delegate); |
292 EXPECT_FLOAT_EQ(start, delegate.GetBrightnessForAnimation()); | 293 EXPECT_FLOAT_EQ(start, delegate.GetBrightnessForAnimation()); |
293 element->Progress(start_time + delta/2, &delegate); | 294 element->Progress(start_time + delta/2, &delegate); |
(...skipping 14 matching lines...) Expand all Loading... |
308 | 309 |
309 // Check that the Grayscale element progresses the delegate as expected and | 310 // Check that the Grayscale element progresses the delegate as expected and |
310 // that the element can be reused after it completes. | 311 // that the element can be reused after it completes. |
311 TEST(LayerAnimationElementTest, GrayscaleElement) { | 312 TEST(LayerAnimationElementTest, GrayscaleElement) { |
312 TestLayerAnimationDelegate delegate; | 313 TestLayerAnimationDelegate delegate; |
313 float start = 0.0; | 314 float start = 0.0; |
314 float middle = 0.5; | 315 float middle = 0.5; |
315 float target = 1.0; | 316 float target = 1.0; |
316 base::TimeTicks start_time; | 317 base::TimeTicks start_time; |
317 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 318 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
318 scoped_ptr<LayerAnimationElement> element( | 319 std::unique_ptr<LayerAnimationElement> element( |
319 LayerAnimationElement::CreateGrayscaleElement(target, delta)); | 320 LayerAnimationElement::CreateGrayscaleElement(target, delta)); |
320 | 321 |
321 for (int i = 0; i < 2; ++i) { | 322 for (int i = 0; i < 2; ++i) { |
322 start_time += delta; | 323 start_time += delta; |
323 element->set_requested_start_time(start_time); | 324 element->set_requested_start_time(start_time); |
324 delegate.SetGrayscaleFromAnimation(start); | 325 delegate.SetGrayscaleFromAnimation(start); |
325 element->Start(&delegate, 1); | 326 element->Start(&delegate, 1); |
326 element->Progress(start_time, &delegate); | 327 element->Progress(start_time, &delegate); |
327 EXPECT_FLOAT_EQ(start, delegate.GetGrayscaleForAnimation()); | 328 EXPECT_FLOAT_EQ(start, delegate.GetGrayscaleForAnimation()); |
328 element->Progress(start_time + delta/2, &delegate); | 329 element->Progress(start_time + delta/2, &delegate); |
(...skipping 16 matching lines...) Expand all Loading... |
345 // that the element can be reused after it completes. | 346 // that the element can be reused after it completes. |
346 TEST(LayerAnimationElementTest, PauseElement) { | 347 TEST(LayerAnimationElementTest, PauseElement) { |
347 LayerAnimationElement::AnimatableProperties properties = | 348 LayerAnimationElement::AnimatableProperties properties = |
348 LayerAnimationElement::TRANSFORM | LayerAnimationElement::BOUNDS | | 349 LayerAnimationElement::TRANSFORM | LayerAnimationElement::BOUNDS | |
349 LayerAnimationElement::OPACITY | LayerAnimationElement::BRIGHTNESS | | 350 LayerAnimationElement::OPACITY | LayerAnimationElement::BRIGHTNESS | |
350 LayerAnimationElement::GRAYSCALE; | 351 LayerAnimationElement::GRAYSCALE; |
351 | 352 |
352 base::TimeTicks start_time; | 353 base::TimeTicks start_time; |
353 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 354 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
354 | 355 |
355 scoped_ptr<LayerAnimationElement> element( | 356 std::unique_ptr<LayerAnimationElement> element( |
356 LayerAnimationElement::CreatePauseElement(properties, delta)); | 357 LayerAnimationElement::CreatePauseElement(properties, delta)); |
357 | 358 |
358 TestLayerAnimationDelegate delegate; | 359 TestLayerAnimationDelegate delegate; |
359 TestLayerAnimationDelegate copy = delegate; | 360 TestLayerAnimationDelegate copy = delegate; |
360 | 361 |
361 start_time += delta; | 362 start_time += delta; |
362 element->set_requested_start_time(start_time); | 363 element->set_requested_start_time(start_time); |
363 element->Start(&delegate, 1); | 364 element->Start(&delegate, 1); |
364 | 365 |
365 // Pause should last for |delta|. | 366 // Pause should last for |delta|. |
(...skipping 18 matching lines...) Expand all Loading... |
384 | 385 |
385 // Check that a threaded opacity element updates the delegate as expected when | 386 // Check that a threaded opacity element updates the delegate as expected when |
386 // aborted. | 387 // aborted. |
387 TEST(LayerAnimationElementTest, AbortOpacityElement) { | 388 TEST(LayerAnimationElementTest, AbortOpacityElement) { |
388 TestLayerAnimationDelegate delegate; | 389 TestLayerAnimationDelegate delegate; |
389 float start = 0.0; | 390 float start = 0.0; |
390 float target = 1.0; | 391 float target = 1.0; |
391 base::TimeTicks start_time; | 392 base::TimeTicks start_time; |
392 base::TimeTicks effective_start_time; | 393 base::TimeTicks effective_start_time; |
393 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 394 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
394 scoped_ptr<LayerAnimationElement> element( | 395 std::unique_ptr<LayerAnimationElement> element( |
395 LayerAnimationElement::CreateOpacityElement(target, delta)); | 396 LayerAnimationElement::CreateOpacityElement(target, delta)); |
396 | 397 |
397 // Choose a non-linear Tween type. | 398 // Choose a non-linear Tween type. |
398 gfx::Tween::Type tween_type = gfx::Tween::EASE_IN; | 399 gfx::Tween::Type tween_type = gfx::Tween::EASE_IN; |
399 element->set_tween_type(tween_type); | 400 element->set_tween_type(tween_type); |
400 | 401 |
401 delegate.SetOpacityFromAnimation(start); | 402 delegate.SetOpacityFromAnimation(start); |
402 | 403 |
403 // Aborting the element before it has started should not update the delegate. | 404 // Aborting the element before it has started should not update the delegate. |
404 element->Abort(&delegate); | 405 element->Abort(&delegate); |
(...skipping 18 matching lines...) Expand all Loading... |
423 // Check that a threaded transform element updates the delegate as expected when | 424 // Check that a threaded transform element updates the delegate as expected when |
424 // aborted. | 425 // aborted. |
425 TEST(LayerAnimationElementTest, AbortTransformElement) { | 426 TEST(LayerAnimationElementTest, AbortTransformElement) { |
426 TestLayerAnimationDelegate delegate; | 427 TestLayerAnimationDelegate delegate; |
427 gfx::Transform start_transform, target_transform; | 428 gfx::Transform start_transform, target_transform; |
428 start_transform.Rotate(-30.0); | 429 start_transform.Rotate(-30.0); |
429 target_transform.Rotate(30.0); | 430 target_transform.Rotate(30.0); |
430 base::TimeTicks start_time; | 431 base::TimeTicks start_time; |
431 base::TimeTicks effective_start_time; | 432 base::TimeTicks effective_start_time; |
432 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 433 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
433 scoped_ptr<LayerAnimationElement> element( | 434 std::unique_ptr<LayerAnimationElement> element( |
434 LayerAnimationElement::CreateTransformElement(target_transform, delta)); | 435 LayerAnimationElement::CreateTransformElement(target_transform, delta)); |
435 | 436 |
436 // Choose a non-linear Tween type. | 437 // Choose a non-linear Tween type. |
437 gfx::Tween::Type tween_type = gfx::Tween::EASE_IN; | 438 gfx::Tween::Type tween_type = gfx::Tween::EASE_IN; |
438 element->set_tween_type(tween_type); | 439 element->set_tween_type(tween_type); |
439 | 440 |
440 delegate.SetTransformFromAnimation(start_transform); | 441 delegate.SetTransformFromAnimation(start_transform); |
441 | 442 |
442 // Aborting the element before it has started should not update the delegate. | 443 // Aborting the element before it has started should not update the delegate. |
443 element->Abort(&delegate); | 444 element->Abort(&delegate); |
(...skipping 13 matching lines...) Expand all Loading... |
457 element->Abort(&delegate); | 458 element->Abort(&delegate); |
458 target_transform.Blend(start_transform, | 459 target_transform.Blend(start_transform, |
459 gfx::Tween::CalculateValue(tween_type, 0.5)); | 460 gfx::Tween::CalculateValue(tween_type, 0.5)); |
460 CheckApproximatelyEqual(target_transform, | 461 CheckApproximatelyEqual(target_transform, |
461 delegate.GetTransformForAnimation()); | 462 delegate.GetTransformForAnimation()); |
462 } | 463 } |
463 | 464 |
464 } // namespace | 465 } // namespace |
465 | 466 |
466 } // namespace ui | 467 } // namespace ui |
OLD | NEW |