Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/animation/animation.h" | 5 #include "cc/animation/animation.h" |
| 6 | 6 |
| 7 #include "cc/test/animation_test_common.h" | 7 #include "cc/test/animation_test_common.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 610 EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1.0))); | 610 EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1.0))); |
| 611 EXPECT_EQ(1.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1.5))); | 611 EXPECT_EQ(1.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(1.5))); |
| 612 EXPECT_EQ(2.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(2.0))); | 612 EXPECT_EQ(2.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(2.0))); |
| 613 EXPECT_EQ(1.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(2.5))); | 613 EXPECT_EQ(1.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(2.5))); |
| 614 EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(3.0))); | 614 EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(3.0))); |
| 615 EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(3.5))); | 615 EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(3.5))); |
| 616 EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(4.0))); | 616 EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(4.0))); |
| 617 EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(4.5))); | 617 EXPECT_EQ(0.0, anim->TrimTimeToCurrentIteration(TicksFromSecondsF(4.5))); |
| 618 } | 618 } |
| 619 | 619 |
| 620 TEST(AnimationTest, NoEffectBeforeAnimation) { | |
|
dstockwell
2014/09/18 00:14:29
Test the interaction with playback rate?
samli
2014/09/18 00:59:55
Done.
| |
| 621 scoped_ptr<Animation> anim(CreateAnimation(1)); | |
| 622 anim->set_fill_mode(Animation::FillModeNone); | |
| 623 EXPECT_EQ(true, anim->NoEffectBeforeAnimation(TicksFromSecondsF(-1.0))); | |
| 624 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(0.0))); | |
| 625 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(1.0))); | |
| 626 | |
| 627 anim->set_fill_mode(Animation::FillModeForwards); | |
| 628 EXPECT_EQ(true, anim->NoEffectBeforeAnimation(TicksFromSecondsF(-1.0))); | |
| 629 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(0.0))); | |
| 630 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(1.0))); | |
| 631 | |
| 632 anim->set_fill_mode(Animation::FillModeBackwards); | |
| 633 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(-1.0))); | |
| 634 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(0.0))); | |
| 635 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(1.0))); | |
| 636 | |
| 637 anim->set_fill_mode(Animation::FillModeBoth); | |
| 638 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(-1.0))); | |
| 639 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(0.0))); | |
| 640 EXPECT_EQ(false, anim->NoEffectBeforeAnimation(TicksFromSecondsF(1.0))); | |
| 641 } | |
| 642 | |
| 620 } // namespace | 643 } // namespace |
| 621 } // namespace cc | 644 } // namespace cc |
| OLD | NEW |