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

Unified Diff: cc/animation/keyframed_animation_curve_unittest.cc

Issue 1076313006: Animation start scale should be considered for the raster scale (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing and Added more tests Created 5 years, 8 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/keyframed_animation_curve.cc ('k') | cc/animation/layer_animation_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/keyframed_animation_curve_unittest.cc
diff --git a/cc/animation/keyframed_animation_curve_unittest.cc b/cc/animation/keyframed_animation_curve_unittest.cc
index dc8537dfea06e056ab64e7ab80e5fcc58108a80a..dc4e8173f1c538c1aaadb1ba59110a267a951ab0 100644
--- a/cc/animation/keyframed_animation_curve_unittest.cc
+++ b/cc/animation/keyframed_animation_curve_unittest.cc
@@ -677,6 +677,53 @@ TEST(KeyframedAnimationCurveTest, MaximumTargetScale) {
EXPECT_EQ(0.6f, maximum_scale);
}
+// Tests that starting animation scale is computed as expected.
+TEST(KeyframedAnimationCurveTest, AnimationStartScale) {
+ scoped_ptr<KeyframedTransformAnimationCurve> curve(
+ KeyframedTransformAnimationCurve::Create());
+
+ TransformOperations operations1;
+ curve->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations1, nullptr));
+ operations1.AppendScale(2.f, -3.f, 1.f);
+ curve->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta::FromSecondsD(1.f), operations1,
+ EaseTimingFunction::Create()));
+
+ float start_scale = 0.f;
+
+ // Forward direction
+ EXPECT_TRUE(curve->AnimationStartScale(true, &start_scale));
+ EXPECT_EQ(1.f, start_scale);
+
+ // Backward direction
+ EXPECT_TRUE(curve->AnimationStartScale(false, &start_scale));
+ EXPECT_EQ(3.f, start_scale);
+
+ TransformOperations operations2;
+ operations2.AppendScale(6.f, 3.f, 2.f);
+ curve->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta::FromSecondsD(2.f), operations2,
+ EaseTimingFunction::Create()));
+
+ // Backward direction
+ EXPECT_TRUE(curve->AnimationStartScale(true, &start_scale));
+ EXPECT_EQ(1.f, start_scale);
+
+ // Backward direction
+ EXPECT_TRUE(curve->AnimationStartScale(false, &start_scale));
+ EXPECT_EQ(6.f, start_scale);
+
+ TransformOperations operations3;
+ operations3.AppendRotate(1.f, 0.f, 0.f, 90.f);
+ curve->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta::FromSecondsD(3.f), operations3,
+ EaseTimingFunction::Create()));
+
+ EXPECT_FALSE(curve->AnimationStartScale(false, &start_scale));
+ EXPECT_EQ(0.f, start_scale);
+}
+
// Tests that an animation with a curve timing function works as expected.
TEST(KeyframedAnimationCurveTest, CurveTiming) {
scoped_ptr<KeyframedFloatAnimationCurve> curve(
« no previous file with comments | « cc/animation/keyframed_animation_curve.cc ('k') | cc/animation/layer_animation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698