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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 <memory> 7 #include <memory>
8 #include "core/animation/LegacyStyleInterpolation.h" 8 #include "core/animation/LegacyStyleInterpolation.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 std::unique_ptr<InterpolableList> subListB = InterpolableList::create(1); 102 std::unique_ptr<InterpolableList> subListB = InterpolableList::create(1);
103 subListB->set(0, InterpolableNumber::create(50)); 103 subListB->set(0, InterpolableNumber::create(50));
104 listB->set(1, std::move(subListB)); 104 listB->set(1, std::move(subListB));
105 listB->set(2, InterpolableNumber::create(1)); 105 listB->set(2, InterpolableNumber::create(1));
106 106
107 RefPtr<LegacyStyleInterpolation> i = 107 RefPtr<LegacyStyleInterpolation> i =
108 interpolateLists(std::move(listA), std::move(listB), 0.5); 108 interpolateLists(std::move(listA), std::move(listB), 0.5);
109 InterpolableList* outList = toInterpolableList(interpolationValue(*i.get())); 109 InterpolableList* outList = toInterpolableList(interpolationValue(*i.get()));
110 EXPECT_FLOAT_EQ(50, toInterpolableNumber(outList->get(0))->value()); 110 EXPECT_FLOAT_EQ(50, toInterpolableNumber(outList->get(0))->value());
111 EXPECT_FLOAT_EQ( 111 EXPECT_FLOAT_EQ(
112 75, toInterpolableNumber(toInterpolableList(outList->get(1))->get(0)) 112 75,
113 ->value()); 113 toInterpolableNumber(toInterpolableList(outList->get(1))->get(0))
114 ->value());
114 EXPECT_FLOAT_EQ(0.5, toInterpolableNumber(outList->get(2))->value()); 115 EXPECT_FLOAT_EQ(0.5, toInterpolableNumber(outList->get(2))->value());
115 } 116 }
116 117
117 TEST_F(AnimationInterpolableValueTest, ScaleAndAddNumbers) { 118 TEST_F(AnimationInterpolableValueTest, ScaleAndAddNumbers) {
118 std::unique_ptr<InterpolableNumber> base = InterpolableNumber::create(10); 119 std::unique_ptr<InterpolableNumber> base = InterpolableNumber::create(10);
119 scaleAndAdd(*base, 2, *InterpolableNumber::create(1)); 120 scaleAndAdd(*base, 2, *InterpolableNumber::create(1));
120 EXPECT_FLOAT_EQ(21, base->value()); 121 EXPECT_FLOAT_EQ(21, base->value());
121 122
122 base = InterpolableNumber::create(10); 123 base = InterpolableNumber::create(10);
123 scaleAndAdd(*base, 0, *InterpolableNumber::create(5)); 124 scaleAndAdd(*base, 0, *InterpolableNumber::create(5));
(...skipping 13 matching lines...) Expand all
137 addList->set(0, InterpolableNumber::create(1)); 138 addList->set(0, InterpolableNumber::create(1));
138 addList->set(1, InterpolableNumber::create(2)); 139 addList->set(1, InterpolableNumber::create(2));
139 addList->set(2, InterpolableNumber::create(3)); 140 addList->set(2, InterpolableNumber::create(3));
140 scaleAndAdd(*baseList, 2, *addList); 141 scaleAndAdd(*baseList, 2, *addList);
141 EXPECT_FLOAT_EQ(11, toInterpolableNumber(baseList->get(0))->value()); 142 EXPECT_FLOAT_EQ(11, toInterpolableNumber(baseList->get(0))->value());
142 EXPECT_FLOAT_EQ(22, toInterpolableNumber(baseList->get(1))->value()); 143 EXPECT_FLOAT_EQ(22, toInterpolableNumber(baseList->get(1))->value());
143 EXPECT_FLOAT_EQ(33, toInterpolableNumber(baseList->get(2))->value()); 144 EXPECT_FLOAT_EQ(33, toInterpolableNumber(baseList->get(2))->value());
144 } 145 }
145 146
146 } // namespace blink 147 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698