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

Unified Diff: cc/animation/keyframed_animation_curve_unittest.cc

Issue 140253013: Define accelerated steps time function. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated patch: remove question about velocity Created 6 years, 3 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 | « no previous file | cc/animation/timing_function.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 eceba6fc9e550b3278c6ba7d3fbc871011272de2..572346af06d8ee012589bc46b6e78e98eadd3acd 100644
--- a/cc/animation/keyframed_animation_curve_unittest.cc
+++ b/cc/animation/keyframed_animation_curve_unittest.cc
@@ -427,6 +427,28 @@ TEST(KeyframedAnimationCurveTest, CubicBezierTimingFunction) {
EXPECT_FLOAT_EQ(1.f, curve->GetValue(1.f));
}
+// Tests that a steps timing function works as expected.
+TEST(KeyframedAnimationCurveTest, StepsTimingFunction) {
+ scoped_ptr<KeyframedFloatAnimationCurve> curve(
+ KeyframedFloatAnimationCurve::Create());
+ curve->AddKeyframe(FloatKeyframe::Create(
+ 0.0,
+ 0.f,
+ StepsTimingFunction::Create(36, false).PassAs<TimingFunction>()));
+ curve->AddKeyframe(
+ FloatKeyframe::Create(1.0, 1.f, scoped_ptr<TimingFunction>()));
+
+ EXPECT_FLOAT_EQ(0.f, curve->GetValue(0.f));
+ EXPECT_FLOAT_EQ(7.0 / 36.0, curve->GetValue(0.20f));
+ EXPECT_FLOAT_EQ(0.25f, curve->GetValue(0.25f));
+ EXPECT_FLOAT_EQ(10.0 / 36.0, curve->GetValue(0.30f));
+ EXPECT_FLOAT_EQ(0.5f, curve->GetValue(0.5f));
+ EXPECT_FLOAT_EQ(21.0 / 36.0, curve->GetValue(0.60f));
+ EXPECT_FLOAT_EQ(0.75f, curve->GetValue(0.75f));
+ EXPECT_FLOAT_EQ(32.0 / 36.0, curve->GetValue(0.90f));
+ EXPECT_FLOAT_EQ(1.f, curve->GetValue(1.f));
+}
+
// Tests that animated bounds are computed as expected.
TEST(KeyframedAnimationCurveTest, AnimatedBounds) {
scoped_ptr<KeyframedTransformAnimationCurve> curve(
« no previous file with comments | « no previous file | cc/animation/timing_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698