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

Side by Side Diff: webkit/compositor_bindings/web_transform_animation_curve_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/compositor_bindings/web_float_animation_curve_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "cc/timing_function.h" 8 #include "cc/timing_function.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa trix.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa trix.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveI mpl); 129 scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveI mpl);
130 WebKit::WebTransformOperations operations1; 130 WebKit::WebTransformOperations operations1;
131 operations1.appendTranslate(0, 0, 0); 131 operations1.appendTranslate(0, 0, 0);
132 WebKit::WebTransformOperations operations2; 132 WebKit::WebTransformOperations operations2;
133 operations2.appendTranslate(1, 0, 0); 133 operations2.appendTranslate(1, 0, 0);
134 curve->add(WebTransformKeyframe(0, operations1), 0.25, 0, 0.75, 1); 134 curve->add(WebTransformKeyframe(0, operations1), 0.25, 0, 0.75, 1);
135 curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFu nctionTypeLinear); 135 curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFu nctionTypeLinear);
136 EXPECT_FLOAT_EQ(0, curve->getValue(0).m41()); 136 EXPECT_FLOAT_EQ(0, curve->getValue(0).m41());
137 EXPECT_LT(0, curve->getValue(0.25).m41()); 137 EXPECT_LT(0, curve->getValue(0.25).m41());
138 EXPECT_GT(0.25, curve->getValue(0.25).m41()); 138 EXPECT_GT(0.25, curve->getValue(0.25).m41());
139 EXPECT_FLOAT_EQ(0.5, curve->getValue(0.5).m41()); 139 EXPECT_NEAR(curve->getValue(0.5).m41(), 0.5, 0.00015);
140 EXPECT_LT(0.75, curve->getValue(0.75).m41()); 140 EXPECT_LT(0.75, curve->getValue(0.75).m41());
141 EXPECT_GT(1, curve->getValue(0.75).m41()); 141 EXPECT_GT(1, curve->getValue(0.75).m41());
142 EXPECT_FLOAT_EQ(1, curve->getValue(1).m41()); 142 EXPECT_FLOAT_EQ(1, curve->getValue(1).m41());
143 } 143 }
144 144
145 // Tests that an ease timing function works as expected. 145 // Tests that an ease timing function works as expected.
146 TEST(WebTransformAnimationCurveTest, EaseTimingFunction) 146 TEST(WebTransformAnimationCurveTest, EaseTimingFunction)
147 { 147 {
148 scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveI mpl); 148 scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveI mpl);
149 WebKit::WebTransformOperations operations1; 149 WebKit::WebTransformOperations operations1;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFu nctionTypeLinear); 265 curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFu nctionTypeLinear);
266 266
267 scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create ()); 267 scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create ());
268 for (int i = 0; i <= 4; ++i) { 268 for (int i = 0; i <= 4; ++i) {
269 const double time = i * 0.25; 269 const double time = i * 0.25;
270 EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m4 1()); 270 EXPECT_FLOAT_EQ(timingFunction->getValue(time), curve->getValue(time).m4 1());
271 } 271 }
272 } 272 }
273 273
274 } // namespace 274 } // namespace
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/web_float_animation_curve_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698