Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2927)

Unified Diff: cc/animation/animation_unittest.cc

Issue 180153010: Handle direction control in compositor Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new patch: address reviewer comment Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698