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

Unified Diff: cc/animation/animation_unittest.cc

Issue 220403002: Revert "Handle direction control in compositor Animations" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « cc/animation/animation.cc ('k') | webkit/renderer/compositor_bindings/web_animation_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/animation_unittest.cc
diff --git a/cc/animation/animation_unittest.cc b/cc/animation/animation_unittest.cc
index 7a9019d209fa8105b5b4cee657e3eb39b6f32125..8223cee5855d10a69fa91b4155fc5f5cd81a2eec 100644
--- a/cc/animation/animation_unittest.cc
+++ b/cc/animation/animation_unittest.cc
@@ -49,39 +49,15 @@ TEST(AnimationTest, TrimTimeInfiniteIterations) {
EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(1.5));
}
-TEST(AnimationTest, TrimTimeReverse) {
+TEST(AnimationTest, TrimTimeAlternating) {
scoped_ptr<Animation> anim(CreateAnimation(-1));
- 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);
+ anim->set_alternates_direction(true);
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, 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);
@@ -92,17 +68,6 @@ TEST(AnimationTest, TrimTimeStartTime) {
EXPECT_EQ(1, anim->TrimTimeToCurrentIteration(6.0));
}
-TEST(AnimationTest, TrimTimeStartTimeReverse) {
- scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_start_time(4);
- anim->set_direction(Animation::Reverse);
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(0.0));
- EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(4.0));
- EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(4.5));
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(5.0));
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(6.0));
-}
-
TEST(AnimationTest, TrimTimeTimeOffset) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->set_time_offset(4);
@@ -113,17 +78,6 @@ TEST(AnimationTest, TrimTimeTimeOffset) {
EXPECT_EQ(1, anim->TrimTimeToCurrentIteration(1.0));
}
-TEST(AnimationTest, TrimTimeTimeOffsetReverse) {
- scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_time_offset(4);
- anim->set_start_time(4);
- anim->set_direction(Animation::Reverse);
- EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(0.0));
- EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(0.5));
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(1.0));
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(1.0));
-}
-
TEST(AnimationTest, TrimTimeNegativeTimeOffset) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->set_time_offset(-4);
@@ -134,17 +88,6 @@ TEST(AnimationTest, TrimTimeNegativeTimeOffset) {
EXPECT_EQ(1, anim->TrimTimeToCurrentIteration(5.0));
}
-TEST(AnimationTest, TrimTimeNegativeTimeOffsetReverse) {
- scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_time_offset(-4);
- anim->set_direction(Animation::Reverse);
-
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(0.0));
- EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(4.0));
- EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(4.5));
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(5.0));
-}
-
TEST(AnimationTest, TrimTimePauseResume) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->SetRunState(Animation::Running, 0.0);
@@ -157,19 +100,6 @@ TEST(AnimationTest, TrimTimePauseResume) {
EXPECT_EQ(1, anim->TrimTimeToCurrentIteration(1024.5));
}
-TEST(AnimationTest, TrimTimePauseResumeReverse) {
- scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_direction(Animation::Reverse);
- anim->SetRunState(Animation::Running, 0.0);
- EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(0.0));
- EXPECT_EQ(0.5, anim->TrimTimeToCurrentIteration(0.5));
- anim->SetRunState(Animation::Paused, 0.25);
- EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(1024.0));
- anim->SetRunState(Animation::Running, 1024.0);
- EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(1024.0));
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(1024.75));
-}
-
TEST(AnimationTest, TrimTimeSuspendResume) {
scoped_ptr<Animation> anim(CreateAnimation(1));
anim->SetRunState(Animation::Running, 0.0);
@@ -182,19 +112,6 @@ TEST(AnimationTest, TrimTimeSuspendResume) {
EXPECT_EQ(1, anim->TrimTimeToCurrentIteration(1024.5));
}
-TEST(AnimationTest, TrimTimeSuspendResumeReverse) {
- scoped_ptr<Animation> anim(CreateAnimation(1));
- anim->set_direction(Animation::Reverse);
- anim->SetRunState(Animation::Running, 0.0);
- EXPECT_EQ(1.0, anim->TrimTimeToCurrentIteration(0.0));
- EXPECT_EQ(0.75, anim->TrimTimeToCurrentIteration(0.25));
- anim->Suspend(0.75);
- EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(1024.0));
- anim->Resume(1024);
- EXPECT_EQ(0.25, anim->TrimTimeToCurrentIteration(1024.0));
- EXPECT_EQ(0, anim->TrimTimeToCurrentIteration(1024.25));
-}
-
TEST(AnimationTest, TrimTimeZeroDuration) {
scoped_ptr<Animation> anim(CreateAnimation(0, 0));
anim->SetRunState(Animation::Running, 0.0);
« no previous file with comments | « cc/animation/animation.cc ('k') | webkit/renderer/compositor_bindings/web_animation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698