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

Unified Diff: ui/gfx/geometry/cubic_bezier_unittest.cc

Issue 1846733003: UI GFX Geometry: Make UnitBezier a wrapper for gfx::CubicBezier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename members. Get rid of GetDefaultEpsilon. Created 4 years, 9 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: 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 9ade0daf42fca709bf8acaeb99e1f658ebbfb83c..18ecebbd2a6d9b59d6ed6ba3861b2f94ffaa3628 100644
--- a/ui/gfx/geometry/cubic_bezier_unittest.cc
+++ b/ui/gfx/geometry/cubic_bezier_unittest.cc
@@ -35,6 +35,15 @@ TEST(CubicBezierTest, Basic) {
EXPECT_NEAR(function.Solve(0.9), 0.96021, epsilon);
EXPECT_NEAR(function.Solve(0.95), 0.98863, epsilon);
EXPECT_NEAR(function.Solve(1), 1, epsilon);
+
+ CubicBezier basicUse(0.5, 1.0, 0.5, 1.0);
danakj 2016/04/01 19:26:17 basic_use
loyso (OOO) 2016/04/04 02:25:29 Done.
+ EXPECT_EQ(0.875, basicUse.Solve(0.5));
+
+ CubicBezier overshoot(0.5, 2.0, 0.5, 2.0);
+ EXPECT_EQ(1.625, overshoot.Solve(0.5));
+
+ CubicBezier undershoot(0.5, -1.0, 0.5, -1.0);
+ EXPECT_EQ(-0.625, undershoot.Solve(0.5));
}
// Tests that solving the bezier works with knots with y not in (0, 1).
@@ -169,6 +178,14 @@ TEST(CubicBezierTest, InputOutOfRange) {
EXPECT_EQ(-2.0, simple.Solve(-1.0));
EXPECT_EQ(1.0, simple.Solve(2.0));
+ CubicBezier atEdgeOfRange(0.5, 1.0, 0.5, 1.0);
danakj 2016/04/01 19:26:18 at_edge_of_range
loyso (OOO) 2016/04/04 02:25:29 Done.
+ EXPECT_EQ(0.0, atEdgeOfRange.Solve(0.0));
+ EXPECT_EQ(1.0, atEdgeOfRange.Solve(1.0));
+
+ CubicBezier largeEpsilon(0.5, 1.0, 0.5, 1.0);
danakj 2016/04/01 19:26:17 large_epsilon
loyso (OOO) 2016/04/04 02:25:29 Done.
+ EXPECT_EQ(-2.0, largeEpsilon.SolveWithEpsilon(-1.0, 1.0));
+ EXPECT_EQ(1.0, largeEpsilon.SolveWithEpsilon(2.0, 1.0));
+
CubicBezier coincidentEndpoints(0.0, 0.0, 1.0, 1.0);
EXPECT_EQ(-1.0, coincidentEndpoints.Solve(-1.0));
EXPECT_EQ(2.0, coincidentEndpoints.Solve(2.0));
« third_party/WebKit/Source/platform/animation/UnitBezier.h ('K') | « ui/gfx/geometry/cubic_bezier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698