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

Side by Side Diff: cc/animation/keyframed_animation_curve_unittest.cc

Issue 12965007: Fix cpplint errors in cc/(animation|input|layers|trees|test)/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/animation/keyframed_animation_curve.h ('k') | cc/animation/layer_animation_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/animation/keyframed_animation_curve.h" 5 #include "cc/animation/keyframed_animation_curve.h"
6 6
7 #include "cc/animation/transform_operations.h" 7 #include "cc/animation/transform_operations.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 1.f, operations3, scoped_ptr<TimingFunction>())); 171 1.f, operations3, scoped_ptr<TimingFunction>()));
172 curve->AddKeyframe(TransformKeyframe::Create( 172 curve->AddKeyframe(TransformKeyframe::Create(
173 2.f, operations4, scoped_ptr<TimingFunction>())); 173 2.f, operations4, scoped_ptr<TimingFunction>()));
174 174
175 ExpectTranslateX(4.f, curve->GetValue(-1.f)); 175 ExpectTranslateX(4.f, curve->GetValue(-1.f));
176 ExpectTranslateX(4.f, curve->GetValue(0.f)); 176 ExpectTranslateX(4.f, curve->GetValue(0.f));
177 ExpectTranslateX(4.f, curve->GetValue(0.5f)); 177 ExpectTranslateX(4.f, curve->GetValue(0.5f));
178 178
179 // There is a discontinuity at 1. Any value between 4 and 6 is valid. 179 // There is a discontinuity at 1. Any value between 4 and 6 is valid.
180 gfx::Transform value = curve->GetValue(1.f); 180 gfx::Transform value = curve->GetValue(1.f);
181 EXPECT_TRUE(value.matrix().getDouble(0.f, 3.f) >= 4); 181 EXPECT_GE(value.matrix().getDouble(0.f, 3.f), 4);
182 EXPECT_TRUE(value.matrix().getDouble(0.f, 3.f) <= 6); 182 EXPECT_LE(value.matrix().getDouble(0.f, 3.f), 6);
183 183
184 ExpectTranslateX(6.f, curve->GetValue(1.5f)); 184 ExpectTranslateX(6.f, curve->GetValue(1.5f));
185 ExpectTranslateX(6.f, curve->GetValue(2.f)); 185 ExpectTranslateX(6.f, curve->GetValue(2.f));
186 ExpectTranslateX(6.f, curve->GetValue(3.f)); 186 ExpectTranslateX(6.f, curve->GetValue(3.f));
187 } 187 }
188 188
189 // Tests that the keyframes may be added out of order. 189 // Tests that the keyframes may be added out of order.
190 TEST(KeyframedAnimationCurveTest, UnsortedKeyframes) { 190 TEST(KeyframedAnimationCurveTest, UnsortedKeyframes) {
191 scoped_ptr<KeyframedFloatAnimationCurve> curve( 191 scoped_ptr<KeyframedFloatAnimationCurve> curve(
192 KeyframedFloatAnimationCurve::Create()); 192 KeyframedFloatAnimationCurve::Create());
(...skipping 28 matching lines...) Expand all
221 EXPECT_LT(0.f, curve->GetValue(0.25f)); 221 EXPECT_LT(0.f, curve->GetValue(0.25f));
222 EXPECT_GT(0.25f, curve->GetValue(0.25f)); 222 EXPECT_GT(0.25f, curve->GetValue(0.25f));
223 EXPECT_NEAR(curve->GetValue(0.5f), 0.5f, 0.00015f); 223 EXPECT_NEAR(curve->GetValue(0.5f), 0.5f, 0.00015f);
224 EXPECT_LT(0.75f, curve->GetValue(0.75f)); 224 EXPECT_LT(0.75f, curve->GetValue(0.75f));
225 EXPECT_GT(1.f, curve->GetValue(0.75f)); 225 EXPECT_GT(1.f, curve->GetValue(0.75f));
226 EXPECT_FLOAT_EQ(1.f, curve->GetValue(1.f)); 226 EXPECT_FLOAT_EQ(1.f, curve->GetValue(1.f));
227 } 227 }
228 228
229 } // namespace 229 } // namespace
230 } // namespace cc 230 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/keyframed_animation_curve.h ('k') | cc/animation/layer_animation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698