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

Unified Diff: Source/core/animation/CompositorAnimationsTest.cpp

Issue 178263006: Handle direction control in compositor Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: new patch: rebases against tot; fixes enum naming issue 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/CompositorAnimationsTest.cpp
diff --git a/Source/core/animation/CompositorAnimationsTest.cpp b/Source/core/animation/CompositorAnimationsTest.cpp
index 23a98e38de0f1446f1fc4651afd9e875a6848ee1..a072fb0dc369913e3610f405dcc0ed8bbbf6e540 100644
--- a/Source/core/animation/CompositorAnimationsTest.cpp
+++ b/Source/core/animation/CompositorAnimationsTest.cpp
@@ -359,20 +359,21 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorPlaybackRate
TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection)
{
+ m_timing.direction = Timing::PlaybackDirectionNormal;
+ EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionNormal);
+
m_timing.direction = Timing::PlaybackDirectionAlternate;
EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
- EXPECT_TRUE(m_compositorTiming.alternate);
- EXPECT_FALSE(m_compositorTiming.reverse);
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternate);
m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
- EXPECT_TRUE(m_compositorTiming.alternate);
- EXPECT_TRUE(m_compositorTiming.reverse);
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternateReverse);
m_timing.direction = Timing::PlaybackDirectionReverse;
EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
- EXPECT_FALSE(m_compositorTiming.alternate);
- EXPECT_TRUE(m_compositorTiming.reverse);
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionReverse);
}
TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIterationsAndStartDelay)
@@ -384,8 +385,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset);
EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
- EXPECT_TRUE(m_compositorTiming.alternate);
- EXPECT_FALSE(m_compositorTiming.reverse);
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternate);
m_timing.direction = Timing::PlaybackDirectionAlternate;
m_timing.iterationCount = 4.0;
@@ -394,8 +394,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset);
EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
- EXPECT_TRUE(m_compositorTiming.alternate);
- EXPECT_FALSE(m_compositorTiming.reverse);
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternate);
m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
m_timing.iterationCount = 4.0;
@@ -404,8 +403,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset);
EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
- EXPECT_TRUE(m_compositorTiming.alternate);
- EXPECT_TRUE(m_compositorTiming.reverse);
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternateReverse);
m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
m_timing.iterationCount = 4.0;
@@ -414,8 +412,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset);
EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
- EXPECT_TRUE(m_compositorTiming.alternate);
- EXPECT_TRUE(m_compositorTiming.reverse);
+ EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternateReverse);
}
TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTimingTimingFunctionPassThru)
@@ -570,7 +567,7 @@ TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation)
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
- usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(false));
+ usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::DirectionNormal));
EXPECT_CALL(*mockAnimationPtr, delete_())
.Times(1)
@@ -617,7 +614,7 @@ TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration)
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
- usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(false));
+ usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::DirectionNormal));
EXPECT_CALL(*mockAnimationPtr, delete_())
.Times(1)
@@ -670,7 +667,7 @@ TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
- usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
+ usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::DirectionAlternate));
EXPECT_CALL(*mockAnimationPtr, delete_())
.Times(1)
@@ -719,7 +716,7 @@ TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25));
- usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(false));
+ usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::DirectionNormal));
EXPECT_CALL(*mockAnimationPtr, delete_())
.Times(1)
@@ -778,7 +775,7 @@ TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
- usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
+ usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::DirectionAlternate));
EXPECT_CALL(*mockAnimationPtr, delete_())
.Times(1)
@@ -824,10 +821,10 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation)
EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
.WillOnce(Return(mockCurvePtr));
- usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), 1.0, 0.0, 1.0, 1.0));
- usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
- usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.75, -1.0), blink::WebAnimationCurve::TimingFunctionTypeEaseOut));
- usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 2.0)));
+ usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeEaseIn));
+ usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.25, -1.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
+ usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), 0.0, 0.0, 0.0, 1.0));
+ usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 5.0)));
// Create the animation
blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blink::WebAnimation::TargetPropertyOpacity);
@@ -838,7 +835,7 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation)
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
- usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
+ usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::DirectionAlternateReverse));
EXPECT_CALL(*mockAnimationPtr, delete_())
.Times(1)
@@ -876,8 +873,8 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
.WillOnce(Return(mockCurvePtr));
- usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
- usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 2.0)));
+ usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
+ usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 5.0)));
// Create animation
blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blink::WebAnimation::TargetPropertyOpacity);
@@ -888,7 +885,7 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0));
- usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
+ usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::DirectionAlternateReverse));
EXPECT_CALL(*mockAnimationPtr, delete_())
.Times(1)
« no previous file with comments | « Source/core/animation/CompositorAnimationsImpl.h ('k') | Source/core/animation/CompositorAnimationsTestHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698