OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "core/animation/InterpolationEffect.h" | 6 #include "core/animation/InterpolationEffect.h" |
7 | 7 |
8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class SampleInterpolation : public Interpolation { | 14 class SampleInterpolation : public Interpolation { |
15 public: | 15 public: |
16 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I
nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end) | 16 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtr<InterpolableV
alue> start, PassOwnPtr<InterpolableValue> end) |
17 { | 17 { |
18 return adoptRefWillBeNoop(new SampleInterpolation(start, end)); | 18 return adoptRefWillBeNoop(new SampleInterpolation(start, end)); |
19 } | 19 } |
20 | 20 |
21 PropertyHandle property() const override | 21 PropertyHandle property() const override |
22 { | 22 { |
23 return PropertyHandle(CSSPropertyBackgroundColor); | 23 return PropertyHandle(CSSPropertyBackgroundColor); |
24 } | 24 } |
25 private: | 25 private: |
26 SampleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwn
PtrWillBeRawPtr<InterpolableValue> end) | 26 SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpol
ableValue> end) |
27 : Interpolation(start, end) | 27 : Interpolation(start, end) |
28 { | 28 { |
29 } | 29 } |
30 }; | 30 }; |
31 | 31 |
32 const double duration = 1.0; | 32 const double duration = 1.0; |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 class AnimationInterpolationEffectTest : public ::testing::Test { | 36 class AnimationInterpolationEffectTest : public ::testing::Test { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 interpolationEffect->getActiveInterpolations(1.5, duration, activeInterpolat
ions); | 108 interpolationEffect->getActiveInterpolations(1.5, duration, activeInterpolat
ions); |
109 EXPECT_EQ(1ul, activeInterpolations->size()); | 109 EXPECT_EQ(1ul, activeInterpolations->size()); |
110 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations->at(0))); | 110 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations->at(0))); |
111 | 111 |
112 interpolationEffect->getActiveInterpolations(2, duration, activeInterpolatio
ns); | 112 interpolationEffect->getActiveInterpolations(2, duration, activeInterpolatio
ns); |
113 EXPECT_EQ(1ul, activeInterpolations->size()); | 113 EXPECT_EQ(1ul, activeInterpolations->size()); |
114 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations->at(0))); | 114 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations->at(0))); |
115 } | 115 } |
116 | 116 |
117 } | 117 } |
OLD | NEW |