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

Unified Diff: cc/animation/timing_function_unittest.cc

Issue 16112002: Do not clamp y values on internal knots of timing function bezier curves (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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/timing_function.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/timing_function_unittest.cc
diff --git a/cc/animation/timing_function_unittest.cc b/cc/animation/timing_function_unittest.cc
index c076d5216fc85d7ba51a017735a921240d125fc2..2caa12d077290177d8586cb617f950b188946354 100644
--- a/cc/animation/timing_function_unittest.cc
+++ b/cc/animation/timing_function_unittest.cc
@@ -37,5 +37,35 @@ TEST(TimingFunctionTest, CubicBezierTimingFunction) {
EXPECT_NEAR(function->GetValue(1), 1, epsilon);
}
+// Tests that the bezier timing function works with knots with y not in (0, 1).
+TEST(TimingFunctionTest, CubicBezierTimingFunctionUnclampedYValues) {
+ scoped_ptr<CubicBezierTimingFunction> function =
+ CubicBezierTimingFunction::Create(0.5, -1.0, 0.5, 2.0);
+
+ double epsilon = 0.00015;
+
+ EXPECT_NEAR(function->GetValue(0.0), 0.0, epsilon);
+ EXPECT_NEAR(function->GetValue(0.05), -0.08954, epsilon);
+ EXPECT_NEAR(function->GetValue(0.1), -0.15613, epsilon);
+ EXPECT_NEAR(function->GetValue(0.15), -0.19641, epsilon);
+ EXPECT_NEAR(function->GetValue(0.2), -0.20651, epsilon);
+ EXPECT_NEAR(function->GetValue(0.25), -0.18232, epsilon);
+ EXPECT_NEAR(function->GetValue(0.3), -0.11992, epsilon);
+ EXPECT_NEAR(function->GetValue(0.35), -0.01672, epsilon);
+ EXPECT_NEAR(function->GetValue(0.4), 0.12660, epsilon);
+ EXPECT_NEAR(function->GetValue(0.45), 0.30349, epsilon);
+ EXPECT_NEAR(function->GetValue(0.5), 0.50000, epsilon);
+ EXPECT_NEAR(function->GetValue(0.55), 0.69651, epsilon);
+ EXPECT_NEAR(function->GetValue(0.6), 0.87340, epsilon);
+ EXPECT_NEAR(function->GetValue(0.65), 1.01672, epsilon);
+ EXPECT_NEAR(function->GetValue(0.7), 1.11992, epsilon);
+ EXPECT_NEAR(function->GetValue(0.75), 1.18232, epsilon);
+ EXPECT_NEAR(function->GetValue(0.8), 1.20651, epsilon);
+ EXPECT_NEAR(function->GetValue(0.85), 1.19641, epsilon);
+ EXPECT_NEAR(function->GetValue(0.9), 1.15613, epsilon);
+ EXPECT_NEAR(function->GetValue(0.95), 1.08954, epsilon);
+ EXPECT_NEAR(function->GetValue(1.0), 1.0, epsilon);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/animation/timing_function.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698