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

Unified Diff: ui/gfx/geometry/cubic_bezier_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 | « ui/gfx/geometry/cubic_bezier.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/cubic_bezier_unittest.cc
diff --git a/ui/gfx/geometry/cubic_bezier_unittest.cc b/ui/gfx/geometry/cubic_bezier_unittest.cc
index 4fd60e87825ae9f0ce68514f5e26e2518e84b3eb..168817c6449ec9caf4f02705092b9080e3904fbe 100644
--- a/ui/gfx/geometry/cubic_bezier_unittest.cc
+++ b/ui/gfx/geometry/cubic_bezier_unittest.cc
@@ -136,5 +136,33 @@ TEST(CubicBezierTest, Range) {
EXPECT_EQ(1.f, max);
}
+TEST(CubicBezierTest, Slope) {
+ CubicBezier function(0.25, 0.0, 0.75, 1.0);
+
+ double epsilon = 0.00015;
+
+ EXPECT_NEAR(function.Slope(0), 0, epsilon);
+ EXPECT_NEAR(function.Slope(0.05), 0.42170, epsilon);
+ EXPECT_NEAR(function.Slope(0.1), 0.69778, epsilon);
+ EXPECT_NEAR(function.Slope(0.15), 0.89121, epsilon);
+ EXPECT_NEAR(function.Slope(0.2), 1.03184, epsilon);
+ EXPECT_NEAR(function.Slope(0.25), 1.13576, epsilon);
+ EXPECT_NEAR(function.Slope(0.3), 1.21239, epsilon);
+ EXPECT_NEAR(function.Slope(0.35), 1.26751, epsilon);
+ EXPECT_NEAR(function.Slope(0.4), 1.30474, epsilon);
+ EXPECT_NEAR(function.Slope(0.45), 1.32628, epsilon);
+ EXPECT_NEAR(function.Slope(0.5), 1.33333, epsilon);
+ EXPECT_NEAR(function.Slope(0.55), 1.32628, epsilon);
+ EXPECT_NEAR(function.Slope(0.6), 1.30474, epsilon);
+ EXPECT_NEAR(function.Slope(0.65), 1.26751, epsilon);
+ EXPECT_NEAR(function.Slope(0.7), 1.21239, epsilon);
+ EXPECT_NEAR(function.Slope(0.75), 1.13576, epsilon);
+ EXPECT_NEAR(function.Slope(0.8), 1.03184, epsilon);
+ EXPECT_NEAR(function.Slope(0.85), 0.89121, epsilon);
+ EXPECT_NEAR(function.Slope(0.9), 0.69778, epsilon);
+ EXPECT_NEAR(function.Slope(0.95), 0.42170, epsilon);
+ EXPECT_NEAR(function.Slope(1), 0, epsilon);
+}
+
} // namespace
} // namespace gfx
« no previous file with comments | « ui/gfx/geometry/cubic_bezier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698