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 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 class SampleInterpolation : public Interpolation { | 13 class SampleInterpolation : public Interpolation { |
14 public: | 14 public: |
15 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start,
PassOwnPtr<InterpolableValue> end) | 15 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start,
PassOwnPtr<InterpolableValue> end) |
16 { | 16 { |
17 return adoptRef(new SampleInterpolation(std::move(start), std::move(end)
)); | 17 return adoptRef(new SampleInterpolation(std::move(start), std::move(end)
)); |
18 } | 18 } |
19 | 19 |
20 PropertyHandle property() const override | 20 PropertyHandle getProperty() const override |
21 { | 21 { |
22 return PropertyHandle(CSSPropertyBackgroundColor); | 22 return PropertyHandle(CSSPropertyBackgroundColor); |
23 } | 23 } |
24 private: | 24 private: |
25 SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpol
ableValue> end) | 25 SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpol
ableValue> end) |
26 : Interpolation(std::move(start), std::move(end)) | 26 : Interpolation(std::move(start), std::move(end)) |
27 { | 27 { |
28 } | 28 } |
29 }; | 29 }; |
30 | 30 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 interpolationEffect.getActiveInterpolations(1.5, duration, activeInterpolati
ons); | 107 interpolationEffect.getActiveInterpolations(1.5, duration, activeInterpolati
ons); |
108 EXPECT_EQ(1ul, activeInterpolations.size()); | 108 EXPECT_EQ(1ul, activeInterpolations.size()); |
109 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations.at(0))); | 109 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations.at(0))); |
110 | 110 |
111 interpolationEffect.getActiveInterpolations(2, duration, activeInterpolation
s); | 111 interpolationEffect.getActiveInterpolations(2, duration, activeInterpolation
s); |
112 EXPECT_EQ(1ul, activeInterpolations.size()); | 112 EXPECT_EQ(1ul, activeInterpolations.size()); |
113 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations.at(0))); | 113 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations.at(0))); |
114 } | 114 } |
115 | 115 |
116 } // namespace blink | 116 } // namespace blink |
OLD | NEW |