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

Unified Diff: cc/animation/scroll_offset_animation_curve_unittest.cc

Issue 393713002: Scroll offset animation curve retargeting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove workaround. Created 6 years, 5 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/scroll_offset_animation_curve.cc ('k') | 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/scroll_offset_animation_curve_unittest.cc
diff --git a/cc/animation/scroll_offset_animation_curve_unittest.cc b/cc/animation/scroll_offset_animation_curve_unittest.cc
index 63445d965dc8a5f5971d80285d7d4037602a51fa..1b8fdb5467c0ad4c4fc8a50f2d7c060f38fcaca9 100644
--- a/cc/animation/scroll_offset_animation_curve_unittest.cc
+++ b/cc/animation/scroll_offset_animation_curve_unittest.cc
@@ -119,5 +119,30 @@ TEST(ScrollOffsetAnimationCurveTest, Clone) {
EXPECT_NEAR(37.4168f, value.y(), 0.00015f);
}
+TEST(ScrollOffsetAnimationCurveTest, UpdateTarget) {
+ gfx::Vector2dF initial_value(0.f, 0.f);
+ gfx::Vector2dF target_value(0.f, 3600.f);
+ scoped_ptr<ScrollOffsetAnimationCurve> curve(
+ ScrollOffsetAnimationCurve::Create(
+ target_value, EaseInOutTimingFunction::Create().Pass()));
+ curve->SetInitialValue(initial_value);
+ EXPECT_EQ(1.0, curve->Duration());
+ EXPECT_EQ(1800.0, curve->GetValue(0.5).y());
+ EXPECT_EQ(3600.0, curve->GetValue(1.0).y());
+
+ curve->UpdateTarget(0.5, gfx::Vector2dF(0.0, 9900.0));
+
+ EXPECT_EQ(2.0, curve->Duration());
+ EXPECT_EQ(1800.0, curve->GetValue(0.5).y());
+ EXPECT_NEAR(5566.49, curve->GetValue(1.0).y(), 0.01);
+ EXPECT_EQ(9900.0, curve->GetValue(2.0).y());
+
+ curve->UpdateTarget(1.0, gfx::Vector2dF(0.0, 7200.0));
+
+ EXPECT_NEAR(1.674, curve->Duration(), 0.01);
+ EXPECT_NEAR(5566.49, curve->GetValue(1.0).y(), 0.01);
+ EXPECT_EQ(7200.0, curve->GetValue(1.674).y());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.cc ('k') | cc/animation/timing_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698