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

Unified Diff: cc/timing_function_unittest.cc

Issue 11359077: cc: Replace the WebCore::UnitBezier class with the SkUnitCubicInterp() method from Skia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix web unittests Created 8 years, 1 month 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/timing_function.cc ('k') | webkit/compositor_bindings/web_float_animation_curve_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/timing_function_unittest.cc
diff --git a/cc/timing_function_unittest.cc b/cc/timing_function_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..69b32672ae06cddd2816fd04b6c398a1ac02ee58
--- /dev/null
+++ b/cc/timing_function_unittest.cc
@@ -0,0 +1,41 @@
+// Copyright 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include "cc/timing_function.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using namespace cc;
+
+namespace {
+
+TEST(TimingFunctionTest, CubicBezierTimingFunction) {
+ scoped_ptr<CubicBezierTimingFunction> function = CubicBezierTimingFunction::create(0.25, 0, 0.75, 1);
+
+ double epsilon = 0.00015;
+
+ EXPECT_NEAR(function->getValue(0), 0, epsilon);
+ EXPECT_NEAR(function->getValue(0.05), 0.01136, epsilon);
+ EXPECT_NEAR(function->getValue(0.1), 0.03978, epsilon);
+ EXPECT_NEAR(function->getValue(0.15), 0.079780, epsilon);
+ EXPECT_NEAR(function->getValue(0.2), 0.12803, epsilon);
+ EXPECT_NEAR(function->getValue(0.25), 0.18235, epsilon);
+ EXPECT_NEAR(function->getValue(0.3), 0.24115, epsilon);
+ EXPECT_NEAR(function->getValue(0.35), 0.30323, epsilon);
+ EXPECT_NEAR(function->getValue(0.4), 0.36761, epsilon);
+ EXPECT_NEAR(function->getValue(0.45), 0.43345, epsilon);
+ EXPECT_NEAR(function->getValue(0.5), 0.5, epsilon);
+ EXPECT_NEAR(function->getValue(0.6), 0.63238, epsilon);
+ EXPECT_NEAR(function->getValue(0.65), 0.69676, epsilon);
+ EXPECT_NEAR(function->getValue(0.7), 0.75884, epsilon);
+ EXPECT_NEAR(function->getValue(0.75), 0.81764, epsilon);
+ EXPECT_NEAR(function->getValue(0.8), 0.87196, epsilon);
+ EXPECT_NEAR(function->getValue(0.85), 0.92021, epsilon);
+ EXPECT_NEAR(function->getValue(0.9), 0.96021, epsilon);
+ EXPECT_NEAR(function->getValue(0.95), 0.98863, epsilon);
+ EXPECT_NEAR(function->getValue(1), 1, epsilon);
+}
+
+} // anonymous namespace
« no previous file with comments | « cc/timing_function.cc ('k') | webkit/compositor_bindings/web_float_animation_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698