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

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: new patch 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
« no previous file with comments | « no previous file | cc/animation/timing_function.h » ('j') | ui/gfx/geometry/steps.h » ('J')
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 0e6fbbfa70eba489a6be885355ae7770eb399f88..c5aed82207c0f939ea1c03bf3fdabab8130fe597 100644
--- a/cc/animation/keyframed_animation_curve_unittest.cc
+++ b/cc/animation/keyframed_animation_curve_unittest.cc
@@ -427,6 +427,25 @@ 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(0.25f, curve->GetValue(0.25));
ajuma 2014/02/24 21:11:16 0.25f
+ EXPECT_FLOAT_EQ(0.5f, curve->GetValue(0.5f));
+ EXPECT_FLOAT_EQ(0.75f, curve->GetValue(0.75));
ajuma 2014/02/24 21:11:16 0.75f
+ EXPECT_FLOAT_EQ(1.f, curve->GetValue(1.f));
ajuma 2014/02/24 21:11:16 It'd be good to also test values that don't land e
+}
+
// 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') | ui/gfx/geometry/steps.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698