Chromium Code Reviews| Index: cc/animation/animation_unittest.cc |
| diff --git a/cc/animation/animation_unittest.cc b/cc/animation/animation_unittest.cc |
| index 8223cee5855d10a69fa91b4155fc5f5cd81a2eec..3be1818b9e7ab5f4e7ffbbf805531c494f19b5ce 100644 |
| --- a/cc/animation/animation_unittest.cc |
| +++ b/cc/animation/animation_unittest.cc |
| @@ -49,15 +49,39 @@ TEST(AnimationTest, TrimTimeInfiniteIterations) { |
| EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(1.5)); |
| } |
| -TEST(AnimationTest, TrimTimeAlternating) { |
| +TEST(AnimationTest, TrimTimeReverse) { |
|
mithro-old
2014/03/03 06:30:52
This suggestion is **optional**, it doesn't block
|
| scoped_ptr<Animation> anim(CreateAnimation(-1)); |
| - anim->set_alternates_direction(true); |
| + anim->set_direction(Animation::Reverse); |
| + EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(0)); |
| + EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(0.25)); |
| + EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(0.5)); |
| + EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(0.75)); |
| + EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(1.0)); |
| + EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(1.25)); |
| +} |
| + |
| +TEST(AnimationTest, TrimTimeAlternate) { |
| + scoped_ptr<Animation> anim(CreateAnimation(-1)); |
| + anim->set_direction(Animation::Alternate); |
| EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(0.0)); |
| + EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(0.25)); |
| EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(0.5)); |
| + EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(0.75)); |
| EXPECT_EQ(1, anim->TrimTimeToCurrentIteration(1.0)); |
| EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(1.25)); |
| } |
| +TEST(AnimationTest, TrimTimeAlternateReverse) { |
| + scoped_ptr<Animation> anim(CreateAnimation(-1)); |
| + anim->set_direction(Animation::AlternateReverse); |
| + EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(0.0)); |
| + EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(0.25)); |
| + EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(0.5)); |
| + EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(0.75)); |
| + EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(1.0)); |
| + EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(1.25)); |
| +} |
| + |
| TEST(AnimationTest, TrimTimeStartTime) { |
| scoped_ptr<Animation> anim(CreateAnimation(1)); |
| anim->set_start_time(4); |