| Index: webkit/compositor_bindings/web_transform_animation_curve_unittest.cc
|
| diff --git a/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc b/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc
|
| index 0234a221e6a700f9087b510e5fb5e215208a97b8..b304372eaf89ef5707d0aa0172ca52dcddfd3026 100644
|
| --- a/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc
|
| +++ b/webkit/compositor_bindings/web_transform_animation_curve_unittest.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| #include "cc/timing_function.h"
|
| +#include "cc/transform_operations.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMatrix.h"
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperations.h"
|
| @@ -17,9 +18,10 @@ namespace {
|
| TEST(WebTransformAnimationCurveTest, OneTransformKeyframe)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations;
|
| - operations.appendTranslate(2, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations(
|
| + cc::TransformOperations::Create());
|
| + operations->appendTranslate(2, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41());
|
| EXPECT_FLOAT_EQ(2, curve->getValue(0).m41());
|
| @@ -32,12 +34,14 @@ TEST(WebTransformAnimationCurveTest, OneTransformKeyframe)
|
| TEST(WebTransformAnimationCurveTest, TwoTransformKeyframe)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(2, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(4, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(2, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(4, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41());
|
| EXPECT_FLOAT_EQ(2, curve->getValue(0).m41());
|
| EXPECT_FLOAT_EQ(3, curve->getValue(0.5).m41());
|
| @@ -49,15 +53,18 @@ TEST(WebTransformAnimationCurveTest, TwoTransformKeyframe)
|
| TEST(WebTransformAnimationCurveTest, ThreeTransformKeyframe)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - 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->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(2, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(4, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations3(
|
| + cc::TransformOperations::Create());
|
| + operations3->appendTranslate(8, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(2, *operations3), WebAnimationCurve::TimingFunctionTypeLinear);
|
| EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41());
|
| EXPECT_FLOAT_EQ(2, curve->getValue(0).m41());
|
| EXPECT_FLOAT_EQ(3, curve->getValue(0.5).m41());
|
| @@ -72,18 +79,22 @@ TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes)
|
| {
|
| // A step function.
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(4, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(4, 0, 0);
|
| - WebKit::WebTransformOperations operations3;
|
| - operations3.appendTranslate(6, 0, 0);
|
| - WebKit::WebTransformOperations operations4;
|
| - operations4.appendTranslate(6, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(1, operations3), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(2, operations4), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(4, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(4, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations3(
|
| + cc::TransformOperations::Create());
|
| + operations3->appendTranslate(6, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations4(
|
| + cc::TransformOperations::Create());
|
| + operations4->appendTranslate(6, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(1, *operations3), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(2, *operations4), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| EXPECT_FLOAT_EQ(4, curve->getValue(-1).m41());
|
| EXPECT_FLOAT_EQ(4, curve->getValue(0).m41());
|
| @@ -102,15 +113,18 @@ TEST(WebTransformAnimationCurveTest, RepeatedTransformKeyTimes)
|
| TEST(WebTransformAnimationCurveTest, UnsortedKeyframes)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - 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->add(WebTransformKeyframe(2, operations3), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(2, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(4, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations3(
|
| + cc::TransformOperations::Create());
|
| + operations3->appendTranslate(8, 0, 0);
|
| + curve->add(WebTransformKeyframe(2, *operations3), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| EXPECT_FLOAT_EQ(2, curve->getValue(-1).m41());
|
| EXPECT_FLOAT_EQ(2, curve->getValue(0).m41());
|
| @@ -125,12 +139,14 @@ TEST(WebTransformAnimationCurveTest, UnsortedKeyframes)
|
| TEST(WebTransformAnimationCurveTest, CubicBezierTimingFunction)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), 0.25, 0, 0.75, 1);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), 0.25, 0, 0.75, 1);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| EXPECT_FLOAT_EQ(0, curve->getValue(0).m41());
|
| EXPECT_LT(0, curve->getValue(0.25).m41());
|
| EXPECT_GT(0.25, curve->getValue(0.25).m41());
|
| @@ -144,12 +160,14 @@ TEST(WebTransformAnimationCurveTest, CubicBezierTimingFunction)
|
| TEST(WebTransformAnimationCurveTest, EaseTimingFunction)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEase);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeEase);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create());
|
| for (int i = 0; i <= 4; ++i) {
|
| @@ -162,12 +180,14 @@ TEST(WebTransformAnimationCurveTest, EaseTimingFunction)
|
| TEST(WebTransformAnimationCurveTest, LinearTimingFunction)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| for (int i = 0; i <= 4; ++i) {
|
| const double time = i * 0.25;
|
| @@ -179,12 +199,14 @@ TEST(WebTransformAnimationCurveTest, LinearTimingFunction)
|
| TEST(WebTransformAnimationCurveTest, EaseInTimingFunction)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseIn);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeEaseIn);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInTimingFunction::create());
|
| for (int i = 0; i <= 4; ++i) {
|
| @@ -197,12 +219,14 @@ TEST(WebTransformAnimationCurveTest, EaseInTimingFunction)
|
| TEST(WebTransformAnimationCurveTest, EaseOutTimingFunction)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseOut);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeEaseOut);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseOutTimingFunction::create());
|
| for (int i = 0; i <= 4; ++i) {
|
| @@ -215,12 +239,14 @@ TEST(WebTransformAnimationCurveTest, EaseOutTimingFunction)
|
| TEST(WebTransformAnimationCurveTest, EaseInOutTimingFunction)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), WebAnimationCurve::TimingFunctionTypeEaseInOut);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), WebAnimationCurve::TimingFunctionTypeEaseInOut);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseInOutTimingFunction::create());
|
| for (int i = 0; i <= 4; ++i) {
|
| @@ -237,12 +263,14 @@ TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction)
|
| double y1 = 0.2;
|
| double x2 = 0.8;
|
| double y2 = 0.7;
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1), x1, y1, x2, y2);
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1), x1, y1, x2, y2);
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| scoped_ptr<cc::TimingFunction> timingFunction(cc::CubicBezierTimingFunction::create(x1, y1, x2, y2));
|
| for (int i = 0; i <= 4; ++i) {
|
| @@ -255,12 +283,14 @@ TEST(WebTransformAnimationCurveTest, CustomBezierTimingFunction)
|
| TEST(WebTransformAnimationCurveTest, DefaultTimingFunction)
|
| {
|
| scoped_ptr<WebTransformAnimationCurve> curve(new WebTransformAnimationCurveImpl);
|
| - WebKit::WebTransformOperations operations1;
|
| - operations1.appendTranslate(0, 0, 0);
|
| - WebKit::WebTransformOperations operations2;
|
| - operations2.appendTranslate(1, 0, 0);
|
| - curve->add(WebTransformKeyframe(0, operations1));
|
| - curve->add(WebTransformKeyframe(1, operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations1(
|
| + cc::TransformOperations::Create());
|
| + operations1->appendTranslate(0, 0, 0);
|
| + scoped_ptr<WebKit::WebTransformOperations> operations2(
|
| + cc::TransformOperations::Create());
|
| + operations2->appendTranslate(1, 0, 0);
|
| + curve->add(WebTransformKeyframe(0, *operations1));
|
| + curve->add(WebTransformKeyframe(1, *operations2), WebAnimationCurve::TimingFunctionTypeLinear);
|
|
|
| scoped_ptr<cc::TimingFunction> timingFunction(cc::EaseTimingFunction::create());
|
| for (int i = 0; i <= 4; ++i) {
|
|
|