OLD | NEW |
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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "cc/animation/timing_function.h" | 6 #include "cc/animation/timing_function.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" | 8 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" |
9 | 9 |
10 using namespace WebKit; | 10 using WebKit::WebAnimationCurve; |
| 11 using WebKit::WebFloatAnimationCurve; |
| 12 using WebKit::WebFloatKeyframe; |
11 | 13 |
| 14 namespace webkit { |
12 namespace { | 15 namespace { |
13 | 16 |
14 // Tests that a float animation with one keyframe works as expected. | 17 // Tests that a float animation with one keyframe works as expected. |
15 TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { | 18 TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { |
16 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); | 19 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); |
17 curve->add(WebFloatKeyframe(0, 2), | 20 curve->add(WebFloatKeyframe(0, 2), |
18 WebAnimationCurve::TimingFunctionTypeLinear); | 21 WebAnimationCurve::TimingFunctionTypeLinear); |
19 EXPECT_FLOAT_EQ(2, curve->getValue(-1)); | 22 EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
20 EXPECT_FLOAT_EQ(2, curve->getValue(0)); | 23 EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
21 EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); | 24 EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 223 |
221 scoped_ptr<cc::TimingFunction> timing_function( | 224 scoped_ptr<cc::TimingFunction> timing_function( |
222 cc::EaseTimingFunction::create()); | 225 cc::EaseTimingFunction::create()); |
223 for (int i = 0; i <= 4; ++i) { | 226 for (int i = 0; i <= 4; ++i) { |
224 const double time = i * 0.25; | 227 const double time = i * 0.25; |
225 EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); | 228 EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); |
226 } | 229 } |
227 } | 230 } |
228 | 231 |
229 } // namespace | 232 } // namespace |
| 233 } // namespace webkit |
OLD | NEW |