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/InterpolableValue.h" | 5 #include "core/animation/InterpolableValue.h" |
6 | 6 |
7 #include "core/animation/Interpolation.h" | 7 #include "core/animation/Interpolation.h" |
8 #include "core/animation/PropertyHandle.h" | 8 #include "core/animation/PropertyHandle.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 class SampleInterpolation : public Interpolation { | 15 class SampleInterpolation : public Interpolation { |
16 public: | 16 public: |
17 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start,
PassOwnPtr<InterpolableValue> end) | 17 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start,
PassOwnPtr<InterpolableValue> end) |
18 { | 18 { |
19 return adoptRef(new SampleInterpolation(std::move(start), std::move(end)
)); | 19 return adoptRef(new SampleInterpolation(std::move(start), std::move(end)
)); |
20 } | 20 } |
21 | 21 |
22 PropertyHandle property() const override | 22 PropertyHandle getProperty() const override |
23 { | 23 { |
24 return PropertyHandle(CSSPropertyBackgroundColor); | 24 return PropertyHandle(CSSPropertyBackgroundColor); |
25 } | 25 } |
26 private: | 26 private: |
27 SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpol
ableValue> end) | 27 SampleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpol
ableValue> end) |
28 : Interpolation(std::move(start), std::move(end)) | 28 : Interpolation(std::move(start), std::move(end)) |
29 { | 29 { |
30 } | 30 } |
31 }; | 31 }; |
32 | 32 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 addList->set(0, InterpolableNumber::create(1)); | 153 addList->set(0, InterpolableNumber::create(1)); |
154 addList->set(1, InterpolableNumber::create(2)); | 154 addList->set(1, InterpolableNumber::create(2)); |
155 addList->set(2, InterpolableNumber::create(3)); | 155 addList->set(2, InterpolableNumber::create(3)); |
156 scaleAndAdd(*baseList, 2, *addList); | 156 scaleAndAdd(*baseList, 2, *addList); |
157 EXPECT_FLOAT_EQ(11, toInterpolableNumber(baseList->get(0))->value()); | 157 EXPECT_FLOAT_EQ(11, toInterpolableNumber(baseList->get(0))->value()); |
158 EXPECT_FLOAT_EQ(22, toInterpolableNumber(baseList->get(1))->value()); | 158 EXPECT_FLOAT_EQ(22, toInterpolableNumber(baseList->get(1))->value()); |
159 EXPECT_FLOAT_EQ(33, toInterpolableNumber(baseList->get(2))->value()); | 159 EXPECT_FLOAT_EQ(33, toInterpolableNumber(baseList->get(2))->value()); |
160 } | 160 } |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
OLD | NEW |