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