Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Side by Side Diff: third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp

Issue 2619173002: Remove most content from Interpolation (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/LegacyStyleInterpolation.h"
8 #include "core/animation/PropertyHandle.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 #include <memory> 9 #include <memory>
11 10
12 namespace blink { 11 namespace blink {
13 12
14 namespace { 13 namespace {
15 14
16 class SampleInterpolation : public Interpolation { 15 class SampleInterpolation : public LegacyStyleInterpolation {
17 public: 16 public:
18 static PassRefPtr<Interpolation> create( 17 static PassRefPtr<Interpolation> create(
19 std::unique_ptr<InterpolableValue> start, 18 std::unique_ptr<InterpolableValue> start,
20 std::unique_ptr<InterpolableValue> end) { 19 std::unique_ptr<InterpolableValue> end) {
21 return adoptRef(new SampleInterpolation(std::move(start), std::move(end))); 20 return adoptRef(new SampleInterpolation(std::move(start), std::move(end)));
22 } 21 }
23 22
24 PropertyHandle getProperty() const override {
25 return PropertyHandle(CSSPropertyBackgroundColor);
26 }
27
28 private: 23 private:
29 SampleInterpolation(std::unique_ptr<InterpolableValue> start, 24 SampleInterpolation(std::unique_ptr<InterpolableValue> start,
30 std::unique_ptr<InterpolableValue> end) 25 std::unique_ptr<InterpolableValue> end)
31 : Interpolation(std::move(start), std::move(end)) {} 26 : LegacyStyleInterpolation(std::move(start),
27 std::move(end),
28 CSSPropertyBackgroundColor) {}
32 }; 29 };
33 30
34 } // namespace 31 } // namespace
35 32
36 class AnimationInterpolableValueTest : public ::testing::Test { 33 class AnimationInterpolableValueTest : public ::testing::Test {
37 protected: 34 protected:
38 InterpolableValue* interpolationValue(Interpolation& interpolation) { 35 InterpolableValue* interpolationValue(Interpolation& interpolation) {
39 return interpolation.getCachedValueForTesting(); 36 return interpolation.getCachedValueForTesting();
40 } 37 }
41 38
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 addList->set(0, InterpolableNumber::create(1)); 136 addList->set(0, InterpolableNumber::create(1));
140 addList->set(1, InterpolableNumber::create(2)); 137 addList->set(1, InterpolableNumber::create(2));
141 addList->set(2, InterpolableNumber::create(3)); 138 addList->set(2, InterpolableNumber::create(3));
142 scaleAndAdd(*baseList, 2, *addList); 139 scaleAndAdd(*baseList, 2, *addList);
143 EXPECT_FLOAT_EQ(11, toInterpolableNumber(baseList->get(0))->value()); 140 EXPECT_FLOAT_EQ(11, toInterpolableNumber(baseList->get(0))->value());
144 EXPECT_FLOAT_EQ(22, toInterpolableNumber(baseList->get(1))->value()); 141 EXPECT_FLOAT_EQ(22, toInterpolableNumber(baseList->get(1))->value());
145 EXPECT_FLOAT_EQ(33, toInterpolableNumber(baseList->get(2))->value()); 142 EXPECT_FLOAT_EQ(33, toInterpolableNumber(baseList->get(2))->value());
146 } 143 }
147 144
148 } // namespace blink 145 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/InterpolableValue.h ('k') | third_party/WebKit/Source/core/animation/Interpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698