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

Side by Side Diff: Source/core/animation/InterpolationEffectTest.cpp

Issue 210823003: Move InterpolationEffect to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
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 "config.h" 5 #include "config.h"
6 #include "core/animation/InterpolationEffect.h" 6 #include "core/animation/InterpolationEffect.h"
7 7
8 #include <gtest/gtest.h> 8 #include <gtest/gtest.h>
9 9
10 namespace { 10 namespace {
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 double getInterpolableNumber(PassRefPtrWillBeRawPtr<Interpolation> value) 25 double getInterpolableNumber(PassRefPtrWillBeRawPtr<Interpolation> value)
26 { 26 {
27 return toInterpolableNumber(interpolationValue(*value.get()))->value(); 27 return toInterpolableNumber(interpolationValue(*value.get()))->value();
28 } 28 }
29 }; 29 };
30 30
31 TEST_F(AnimationInterpolationEffectTest, SingleInterpolation) 31 TEST_F(AnimationInterpolationEffectTest, SingleInterpolation)
32 { 32 {
33 RefPtr<InterpolationEffect> interpolationEffect = InterpolationEffect::creat e(); 33 RefPtrWillBeRawPtr<InterpolationEffect> interpolationEffect = InterpolationE ffect::create();
34 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(0), InterpolableNumber::create(10)), 34 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(0), InterpolableNumber::create(10)),
35 RefPtr<TimingFunction>(), 0, 1, -1, 2); 35 RefPtr<TimingFunction>(), 0, 1, -1, 2);
36 36
37 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > ac tiveInterpolations = interpolationEffect->getActiveInterpolations(-2, duration); 37 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > ac tiveInterpolations = interpolationEffect->getActiveInterpolations(-2, duration);
38 EXPECT_EQ(0ul, activeInterpolations->size()); 38 EXPECT_EQ(0ul, activeInterpolations->size());
39 39
40 activeInterpolations = interpolationEffect->getActiveInterpolations(-0.5, du ration); 40 activeInterpolations = interpolationEffect->getActiveInterpolations(-0.5, du ration);
41 EXPECT_EQ(1ul, activeInterpolations->size()); 41 EXPECT_EQ(1ul, activeInterpolations->size());
42 EXPECT_EQ(-5, getInterpolableNumber(activeInterpolations->at(0))); 42 EXPECT_EQ(-5, getInterpolableNumber(activeInterpolations->at(0)));
43 43
44 activeInterpolations = interpolationEffect->getActiveInterpolations(0.5, dur ation); 44 activeInterpolations = interpolationEffect->getActiveInterpolations(0.5, dur ation);
45 EXPECT_EQ(1ul, activeInterpolations->size()); 45 EXPECT_EQ(1ul, activeInterpolations->size());
46 EXPECT_FLOAT_EQ(5, getInterpolableNumber(activeInterpolations->at(0))); 46 EXPECT_FLOAT_EQ(5, getInterpolableNumber(activeInterpolations->at(0)));
47 47
48 activeInterpolations = interpolationEffect->getActiveInterpolations(1.5, dur ation); 48 activeInterpolations = interpolationEffect->getActiveInterpolations(1.5, dur ation);
49 EXPECT_EQ(1ul, activeInterpolations->size()); 49 EXPECT_EQ(1ul, activeInterpolations->size());
50 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations->at(0))); 50 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations->at(0)));
51 51
52 activeInterpolations = interpolationEffect->getActiveInterpolations(3, durat ion); 52 activeInterpolations = interpolationEffect->getActiveInterpolations(3, durat ion);
53 EXPECT_EQ(0ul, activeInterpolations->size()); 53 EXPECT_EQ(0ul, activeInterpolations->size());
54 } 54 }
55 55
56 TEST_F(AnimationInterpolationEffectTest, MultipleInterpolations) 56 TEST_F(AnimationInterpolationEffectTest, MultipleInterpolations)
57 { 57 {
58 RefPtr<InterpolationEffect> interpolationEffect = InterpolationEffect::creat e(); 58 RefPtrWillBeRawPtr<InterpolationEffect> interpolationEffect = InterpolationE ffect::create();
59 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(10), InterpolableNumber::create(15)), 59 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(10), InterpolableNumber::create(15)),
60 RefPtr<TimingFunction>(), 1, 2, 1, 3); 60 RefPtr<TimingFunction>(), 1, 2, 1, 3);
61 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(0), InterpolableNumber::create(1)), 61 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(0), InterpolableNumber::create(1)),
62 LinearTimingFunction::preset(), 0, 1, 0, 1); 62 LinearTimingFunction::preset(), 0, 1, 0, 1);
63 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(1), InterpolableNumber::create(6)), 63 interpolationEffect->addInterpolation(Interpolation::create(InterpolableNumb er::create(1), InterpolableNumber::create(6)),
64 CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease), 0.5, 1.5, 0.5, 1.5); 64 CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Ease), 0.5, 1.5, 0.5, 1.5);
65 65
66 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > ac tiveInterpolations = interpolationEffect->getActiveInterpolations(-0.5, duration ); 66 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > ac tiveInterpolations = interpolationEffect->getActiveInterpolations(-0.5, duration );
67 EXPECT_EQ(0ul, activeInterpolations->size()); 67 EXPECT_EQ(0ul, activeInterpolations->size());
68 68
(...skipping 20 matching lines...) Expand all
89 EXPECT_EQ(1ul, activeInterpolations->size()); 89 EXPECT_EQ(1ul, activeInterpolations->size());
90 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations->at(0))); 90 EXPECT_FLOAT_EQ(12.5f, getInterpolableNumber(activeInterpolations->at(0)));
91 91
92 activeInterpolations = interpolationEffect->getActiveInterpolations(2, durat ion); 92 activeInterpolations = interpolationEffect->getActiveInterpolations(2, durat ion);
93 EXPECT_EQ(1ul, activeInterpolations->size()); 93 EXPECT_EQ(1ul, activeInterpolations->size());
94 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations->at(0))); 94 EXPECT_FLOAT_EQ(15, getInterpolableNumber(activeInterpolations->at(0)));
95 } 95 }
96 96
97 } 97 }
98 98
OLDNEW
« no previous file with comments | « Source/core/animation/InterpolationEffect.cpp ('k') | Source/core/animation/KeyframeEffectModel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698