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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/compositor/layer_animation_delegate.h" | 12 #include "ui/compositor/layer_animation_delegate.h" |
13 #include "ui/compositor/test/test_layer_animation_delegate.h" | 13 #include "ui/compositor/test/test_layer_animation_delegate.h" |
14 #include "ui/compositor/test/test_utils.h" | 14 #include "ui/compositor/test/test_utils.h" |
15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
16 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Check that the transformation element progresses the delegate as expected and | 22 // Check that the transformation element progresses the delegate as expected and |
23 // that the element can be reused after it completes. | 23 // that the element can be reused after it completes. |
24 TEST(LayerAnimationElementTest, TransformElement) { | 24 TEST(LayerAnimationElementTest, TransformElement) { |
25 TestLayerAnimationDelegate delegate; | 25 TestLayerAnimationDelegate delegate; |
26 gfx::Transform start_transform, target_transform, middle_transform; | 26 gfx::Transform start_transform, target_transform; |
27 start_transform.Rotate(-30.0); | 27 start_transform.Rotate(-30.0); |
28 target_transform.Rotate(30.0); | 28 target_transform.Rotate(30.0); |
29 base::TimeTicks start_time; | 29 base::TimeTicks start_time; |
30 base::TimeTicks effective_start_time; | 30 base::TimeTicks effective_start_time; |
31 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 31 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
32 | 32 |
33 scoped_ptr<LayerAnimationElement> element( | 33 scoped_ptr<LayerAnimationElement> element( |
34 LayerAnimationElement::CreateTransformElement(target_transform, delta)); | 34 LayerAnimationElement::CreateTransformElement(target_transform, delta)); |
35 element->set_animation_group_id(1); | 35 element->set_animation_group_id(1); |
36 | 36 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 element->Abort(&delegate); | 365 element->Abort(&delegate); |
366 target_transform.Blend(start_transform, | 366 target_transform.Blend(start_transform, |
367 Tween::CalculateValue(tween_type, 0.5)); | 367 Tween::CalculateValue(tween_type, 0.5)); |
368 CheckApproximatelyEqual(target_transform, | 368 CheckApproximatelyEqual(target_transform, |
369 delegate.GetTransformForAnimation()); | 369 delegate.GetTransformForAnimation()); |
370 } | 370 } |
371 | 371 |
372 } // namespace | 372 } // namespace |
373 | 373 |
374 } // namespace ui | 374 } // namespace ui |
OLD | NEW |