diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-20 13:01:08 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-20 13:01:08 +0200 |
commit | 49233e234e5c787396cadb2cea33b31ae0cd65c1 (patch) | |
tree | 5410cb9a8fd53168bb60d62c54b654d86f03c38d /Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp | |
parent | b211c645d8ab690f713515dfdc84d80b11c27d2c (diff) | |
download | qtwebkit-49233e234e5c787396cadb2cea33b31ae0cd65c1.tar.gz |
Imported WebKit commit 3a8c29f35d00659d2ce7a0ccdfa8304f14e82327 (http://svn.webkit.org/repository/webkit/trunk@120813)
New snapshot with Windows build fixes
Diffstat (limited to 'Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp')
-rw-r--r-- | Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp index ad1ae74ca..eb6bb0363 100644 --- a/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp +++ b/Source/WebKit/chromium/tests/CCKeyframedAnimationCurveTest.cpp @@ -31,6 +31,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <public/WebTransformOperations.h> #include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/Vector.h> @@ -113,57 +114,55 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) { OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); - TransformOperations operations; - operations.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + WebKit::WebTransformOperations operations; + operations.appendTranslate(2, 0, 0); curve->addKeyframe(CCTransformKeyframe::create(0, operations, nullptr)); - IntSize layerSize; // ignored - expectTranslateX(2, curve->getValue(-1, layerSize)); - expectTranslateX(2, curve->getValue(0, layerSize)); - expectTranslateX(2, curve->getValue(0.5, layerSize)); - expectTranslateX(2, curve->getValue(1, layerSize)); - expectTranslateX(2, curve->getValue(2, layerSize)); + expectTranslateX(2, curve->getValue(-1)); + expectTranslateX(2, curve->getValue(0)); + expectTranslateX(2, curve->getValue(0.5)); + expectTranslateX(2, curve->getValue(1)); + expectTranslateX(2, curve->getValue(2)); } // Tests that a transform animation with two keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) { OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + WebKit::WebTransformOperations operations1; + operations1.appendTranslate(2, 0, 0); + WebKit::WebTransformOperations operations2; + operations2.appendTranslate(4, 0, 0); + curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); - IntSize layerSize; // ignored - expectTranslateX(2, curve->getValue(-1, layerSize)); - expectTranslateX(2, curve->getValue(0, layerSize)); - expectTranslateX(3, curve->getValue(0.5, layerSize)); - expectTranslateX(4, curve->getValue(1, layerSize)); - expectTranslateX(4, curve->getValue(2, layerSize)); + expectTranslateX(2, curve->getValue(-1)); + expectTranslateX(2, curve->getValue(0)); + expectTranslateX(3, curve->getValue(0.5)); + expectTranslateX(4, curve->getValue(1)); + expectTranslateX(4, curve->getValue(2)); } // Tests that a transform animation with three keyframes works as expected. TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) { OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(2, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - TransformOperations operations3; - operations3.operations().append(TranslateTransformOperation::create(Length(8, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + 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, nullptr)); curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); curve->addKeyframe(CCTransformKeyframe::create(2, operations3, nullptr)); - IntSize layerSize; // ignored - expectTranslateX(2, curve->getValue(-1, layerSize)); - expectTranslateX(2, curve->getValue(0, layerSize)); - expectTranslateX(3, curve->getValue(0.5, layerSize)); - expectTranslateX(4, curve->getValue(1, layerSize)); - expectTranslateX(6, curve->getValue(1.5, layerSize)); - expectTranslateX(8, curve->getValue(2, layerSize)); - expectTranslateX(8, curve->getValue(3, layerSize)); + expectTranslateX(2, curve->getValue(-1)); + expectTranslateX(2, curve->getValue(0)); + expectTranslateX(3, curve->getValue(0.5)); + expectTranslateX(4, curve->getValue(1)); + expectTranslateX(6, curve->getValue(1.5)); + expectTranslateX(8, curve->getValue(2)); + expectTranslateX(8, curve->getValue(3)); } // Tests that a transform animation with multiple keys at a given time works sanely. @@ -171,32 +170,30 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) { OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); // A step function. - TransformOperations operations1; - operations1.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - TransformOperations operations2; - operations2.operations().append(TranslateTransformOperation::create(Length(4, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - TransformOperations operations3; - operations3.operations().append(TranslateTransformOperation::create(Length(6, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); - TransformOperations operations4; - operations4.operations().append(TranslateTransformOperation::create(Length(6, Fixed), Length(0, Fixed), TransformOperation::TRANSLATE_X)); + 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->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)); - IntSize layerSize; // ignored - - expectTranslateX(4, curve->getValue(-1, layerSize)); - expectTranslateX(4, curve->getValue(0, layerSize)); - expectTranslateX(4, curve->getValue(0.5, layerSize)); + expectTranslateX(4, curve->getValue(-1)); + expectTranslateX(4, curve->getValue(0)); + expectTranslateX(4, curve->getValue(0.5)); // There is a discontinuity at 1. Any value between 4 and 6 is valid. - WebTransformationMatrix value = curve->getValue(1, layerSize); + WebTransformationMatrix value = curve->getValue(1); EXPECT_TRUE(value.m41() >= 4 && value.m41() <= 6); - expectTranslateX(6, curve->getValue(1.5, layerSize)); - expectTranslateX(6, curve->getValue(2, layerSize)); - expectTranslateX(6, curve->getValue(3, layerSize)); + expectTranslateX(6, curve->getValue(1.5)); + expectTranslateX(6, curve->getValue(2)); + expectTranslateX(6, curve->getValue(3)); } // Tests that the keyframes may be added out of order. |