Index: cc/CCKeyframedAnimationCurveTest.cpp |
=================================================================== |
--- cc/CCKeyframedAnimationCurveTest.cpp (revision 161134) |
+++ cc/CCKeyframedAnimationCurveTest.cpp (working copy) |
@@ -10,6 +10,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include <public/WebTransformOperations.h> |
#include <public/WebTransformationMatrix.h> |
+#include <wtf/OwnPtr.h> |
using namespace cc; |
using WebKit::WebTransformationMatrix; |
@@ -24,8 +25,8 @@ |
// Tests that a float animation with one keyframe works as expected. |
TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) |
{ |
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); |
@@ -36,9 +37,9 @@ |
// Tests that a float animation with two keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) |
{ |
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); |
@@ -49,10 +50,10 @@ |
// Tests that a float animation with three keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) |
{ |
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(2, 8, scoped_ptr<CCTimingFunction>())); |
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); |
@@ -65,11 +66,11 @@ |
// Tests that a float animation with multiple keys at a given time works sanely. |
TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) |
{ |
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 4, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 6, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(2, 6, scoped_ptr<CCTimingFunction>())); |
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 4, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 6, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(2, 6, nullptr)); |
EXPECT_FLOAT_EQ(4, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(4, curve->getValue(0)); |
@@ -88,10 +89,10 @@ |
// Tests that a transform animation with one keyframe works as expected. |
TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) |
{ |
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
WebKit::WebTransformOperations operations; |
operations.appendTranslate(2, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations, nullptr)); |
expectTranslateX(2, curve->getValue(-1)); |
expectTranslateX(2, curve->getValue(0)); |
@@ -103,14 +104,14 @@ |
// Tests that a transform animation with two keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) |
{ |
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
WebKit::WebTransformOperations operations1; |
operations1.appendTranslate(2, 0, 0); |
WebKit::WebTransformOperations operations2; |
operations2.appendTranslate(4, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); |
expectTranslateX(2, curve->getValue(-1)); |
expectTranslateX(2, curve->getValue(0)); |
expectTranslateX(3, curve->getValue(0.5)); |
@@ -121,16 +122,16 @@ |
// Tests that a transform animation with three keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) |
{ |
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
WebKit::WebTransformOperations operations1; |
operations1.appendTranslate(2, 0, 0); |
WebKit::WebTransformOperations operations2; |
operations2.appendTranslate(4, 0, 0); |
WebKit::WebTransformOperations operations3; |
operations3.appendTranslate(8, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCTransformKeyframe::create(2, operations3, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(2, operations3, nullptr)); |
expectTranslateX(2, curve->getValue(-1)); |
expectTranslateX(2, curve->getValue(0)); |
expectTranslateX(3, curve->getValue(0.5)); |
@@ -143,7 +144,7 @@ |
// Tests that a transform animation with multiple keys at a given time works sanely. |
TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) |
{ |
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
// A step function. |
WebKit::WebTransformOperations operations1; |
operations1.appendTranslate(4, 0, 0); |
@@ -153,10 +154,10 @@ |
operations3.appendTranslate(6, 0, 0); |
WebKit::WebTransformOperations operations4; |
operations4.appendTranslate(6, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations3, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCTransformKeyframe::create(2, operations4, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations3, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(2, operations4, nullptr)); |
expectTranslateX(4, curve->getValue(-1)); |
expectTranslateX(4, curve->getValue(0)); |
@@ -174,10 +175,10 @@ |
// Tests that the keyframes may be added out of order. |
TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) |
{ |
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(2, 8, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); |
@@ -190,9 +191,9 @@ |
// Tests that a cubic bezier timing function works as expected. |
TEST(CCKeyframedAnimationCurveTest, CubicBezierTimingFunction) |
{ |
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 0, CCCubicBezierTimingFunction::create(0.25, 0, 0.75, 1).PassAs<CCTimingFunction>())); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 1, scoped_ptr<CCTimingFunction>())); |
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 0, CCCubicBezierTimingFunction::create(0.25, 0, 0.75, 1))); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 1, nullptr)); |
EXPECT_FLOAT_EQ(0, curve->getValue(0)); |
EXPECT_LT(0, curve->getValue(0.25)); |