summaryrefslogtreecommitdiffstats
path: root/cc/animation/keyframed_animation_curve_unittest.cc
diff options
context:
space:
mode:
authorbehara.ms <behara.ms@samsung.com>2015-05-04 19:52:12 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-05 02:52:38 +0000
commitf0ebecee83117f2bf62b4124491910c4654491d0 (patch)
treee0188b2dffb38ab0ee2c062d4ce4056682b93f58 /cc/animation/keyframed_animation_curve_unittest.cc
parenta5b48df46468ee5c0fcd73b74760e44d5e1aaa6e (diff)
downloadchromium_src-f0ebecee83117f2bf62b4124491910c4654491d0.zip
chromium_src-f0ebecee83117f2bf62b4124491910c4654491d0.tar.gz
chromium_src-f0ebecee83117f2bf62b4124491910c4654491d0.tar.bz2
Animation start scale should be considered for the raster scale
In zoom-in scenarios the start animation should be taken in to account to calculate raster scale else the first animation frame is rastered at a low raster scale which leads to blurred content. Added starting_animation_contents_scale to cc::DrawProperties BUG=422341 Review URL: https://codereview.chromium.org/1076313006 Cr-Commit-Position: refs/heads/master@{#328258}
Diffstat (limited to 'cc/animation/keyframed_animation_curve_unittest.cc')
-rw-r--r--cc/animation/keyframed_animation_curve_unittest.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/cc/animation/keyframed_animation_curve_unittest.cc b/cc/animation/keyframed_animation_curve_unittest.cc
index dc8537d..dc4e8173f 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(