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