TEST(AnimationKeyframeEffectModel, ZeroKeyframes) { AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); Vector<RefPtr<Interpolation>> values; effect->sample(0, 0.5, duration, values); EXPECT_TRUE(values.isEmpty()); }
TEST_F(AnimationAnimationTimelineTest, PauseForTesting) { float seekTime = 1; timing.fillMode = Timing::FillModeForwards; KeyframeEffect* anim1 = KeyframeEffect::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); KeyframeEffect* anim2 = KeyframeEffect::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); Animation* animation1 = timeline->play(anim1); Animation* animation2 = timeline->play(anim2); timeline->pauseAnimationsForTesting(seekTime); EXPECT_FLOAT_EQ(seekTime, animation1->currentTimeInternal()); EXPECT_FLOAT_EQ(seekTime, animation2->currentTimeInternal()); }
TEST_F(AnimationAnimationTimelineTest, EmptyForwardsKeyframeAnimation) { AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); timing.fillMode = Timing::FillModeForwards; KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), effect, timing); timeline->play(keyframeEffect); updateClockAndService(0); EXPECT_FLOAT_EQ(0, timeline->currentTimeInternal()); EXPECT_TRUE(keyframeEffect->isInEffect()); updateClockAndService(100); EXPECT_FLOAT_EQ(100, timeline->currentTimeInternal()); }
TEST_F(AnimationAnimationTimelineTest, PauseForTesting) { float seekTime = 1; timing.fillMode = Timing::FillModeForwards; RefPtrWillBeRawPtr<Animation> anim1 = Animation::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); RefPtrWillBeRawPtr<Animation> anim2 = Animation::create(element.get(), AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); AnimationPlayer* player1 = timeline->play(anim1.get()); AnimationPlayer* player2 = timeline->play(anim2.get()); timeline->pauseAnimationsForTesting(seekTime); EXPECT_FLOAT_EQ(seekTime, player1->currentTimeInternal()); EXPECT_FLOAT_EQ(seekTime, player2->currentTimeInternal()); }
TEST_F(AnimationAnimationTimelineTest, EmptyForwardsKeyframeAnimation) { RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); timing.fillMode = Timing::FillModeForwards; RefPtrWillBeRawPtr<Animation> anim = Animation::create(element.get(), effect, timing); timeline->play(anim.get()); platformTiming->expectNoMoreActions(); updateClockAndService(0); EXPECT_FLOAT_EQ(0, timeline->currentTimeInternal()); EXPECT_TRUE(anim->isInEffect()); platformTiming->expectNoMoreActions(); updateClockAndService(100); EXPECT_FLOAT_EQ(100, timeline->currentTimeInternal()); }
TEST_F(AnimationAnimationTimelineTest, EmptyKeyframeAnimation) { AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), effect, timing); timeline->play(keyframeEffect); platformTiming->expectNoMoreActions(); updateClockAndService(0); EXPECT_FLOAT_EQ(0, timeline->currentTimeInternal()); EXPECT_FALSE(keyframeEffect->isInEffect()); platformTiming->expectNoMoreActions(); updateClockAndService(100); EXPECT_FLOAT_EQ(100, timeline->currentTimeInternal()); }