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

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: 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
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..9b1623ae8860f6c6e11b429776a1f799eceb53aa 100644
--- a/cc/animation/scroll_offset_animation_curve_unittest.cc
+++ b/cc/animation/scroll_offset_animation_curve_unittest.cc
@@ -119,5 +119,24 @@ 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());
ajuma 2014/07/16 20:35:23 Please add one more re-targeting here (to verify t
skobes 2014/07/16 21:10:48 Done.
+}
+
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698