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 "core/animation/InterpolationEffect.h" | 5 #include "core/animation/InterpolationEffect.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include <memory> |
8 | 9 |
9 namespace blink { | 10 namespace blink { |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 class SampleInterpolation : public Interpolation { | 14 class SampleInterpolation : public Interpolation { |
14 public: | 15 public: |
15 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start,
PassOwnPtr<InterpolableValue> end) | 16 static PassRefPtr<Interpolation> create(std::unique_ptr<InterpolableValue> s
tart, std::unique_ptr<InterpolableValue> end) |
16 { | 17 { |
17 return adoptRef(new SampleInterpolation(std::move(start), std::move(end)
)); | 18 return adoptRef(new SampleInterpolation(std::move(start), std::move(end)
)); |
18 } | 19 } |
19 | 20 |
20 PropertyHandle getProperty() const override | 21 PropertyHandle getProperty() const override |
21 { | 22 { |
22 return PropertyHandle(CSSPropertyBackgroundColor); | 23 return PropertyHandle(CSSPropertyBackgroundColor); |
23 } | 24 } |
24 private: | 25 private: |
25 SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpol
ableValue> end) | 26 SampleInterpolation(std::unique_ptr<InterpolableValue> start, std::unique_pt
r<InterpolableValue> end) |
26 : Interpolation(std::move(start), std::move(end)) | 27 : Interpolation(std::move(start), std::move(end)) |
27 { | 28 { |
28 } | 29 } |
29 }; | 30 }; |
30 | 31 |
31 const double duration = 1.0; | 32 const double duration = 1.0; |
32 | 33 |
33 } // namespace | 34 } // namespace |
34 | 35 |
35 class AnimationInterpolationEffectTest : public ::testing::Test { | 36 class AnimationInterpolationEffectTest : public ::testing::Test { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 interpolationEffect.getActiveInterpolations(1.5, duration, activeInterpolati
ons); | 108 interpolationEffect.getActiveInterpolations(1.5, duration, activeInterpolati
ons); |
108 EXPECT_EQ(1ul, activeInterpolations.size()); | 109 EXPECT_EQ(1ul, activeInterpolations.size()); |
109 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations.at(0))); | 110 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations.at(0))); |
110 | 111 |
111 interpolationEffect.getActiveInterpolations(2, duration, activeInterpolation
s); | 112 interpolationEffect.getActiveInterpolations(2, duration, activeInterpolation
s); |
112 EXPECT_EQ(1ul, activeInterpolations.size()); | 113 EXPECT_EQ(1ul, activeInterpolations.size()); |
113 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations.at(0))); | 114 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations.at(0))); |
114 } | 115 } |
115 | 116 |
116 } // namespace blink | 117 } // namespace blink |
OLD | NEW |