OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/animation/multi_animation.h" |
| 6 |
5 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "ui/base/animation/animation_container_element.h" | 8 #include "ui/gfx/animation/animation_container_element.h" |
7 #include "ui/base/animation/multi_animation.h" | |
8 | 9 |
9 namespace ui { | 10 namespace gfx { |
10 | 11 |
11 TEST(MultiAnimationTest, Basic) { | 12 TEST(MultiAnimationTest, Basic) { |
12 // Create a MultiAnimation with two parts. | 13 // Create a MultiAnimation with two parts. |
13 MultiAnimation::Parts parts; | 14 MultiAnimation::Parts parts; |
14 parts.push_back(MultiAnimation::Part(100, Tween::LINEAR)); | 15 parts.push_back(MultiAnimation::Part(100, Tween::LINEAR)); |
15 parts.push_back(MultiAnimation::Part(100, Tween::EASE_OUT)); | 16 parts.push_back(MultiAnimation::Part(100, Tween::EASE_OUT)); |
16 | 17 |
17 MultiAnimation animation(parts, MultiAnimation::GetDefaultTimerInterval()); | 18 MultiAnimation animation(parts, MultiAnimation::GetDefaultTimerInterval()); |
18 AnimationContainerElement* as_element = | 19 AnimationContainerElement* as_element = |
19 static_cast<AnimationContainerElement*>(&animation); | 20 static_cast<AnimationContainerElement*>(&animation); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 MultiAnimation animation(parts, MultiAnimation::GetDefaultTimerInterval()); | 82 MultiAnimation animation(parts, MultiAnimation::GetDefaultTimerInterval()); |
82 AnimationContainerElement* as_element = | 83 AnimationContainerElement* as_element = |
83 static_cast<AnimationContainerElement*>(&animation); | 84 static_cast<AnimationContainerElement*>(&animation); |
84 as_element->SetStartTime(base::TimeTicks()); | 85 as_element->SetStartTime(base::TimeTicks()); |
85 | 86 |
86 // Step to 300, which is greater than the cycle time. | 87 // Step to 300, which is greater than the cycle time. |
87 as_element->Step(base::TimeTicks() + base::TimeDelta::FromMilliseconds(300)); | 88 as_element->Step(base::TimeTicks() + base::TimeDelta::FromMilliseconds(300)); |
88 EXPECT_EQ(.5, animation.GetCurrentValue()); | 89 EXPECT_EQ(.5, animation.GetCurrentValue()); |
89 } | 90 } |
90 | 91 |
91 } // namespace ui | 92 } // namespace gfx |
OLD | NEW |