| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 TEST_F(AnimationDocumentTimelineTest, HasStarted) | 125 TEST_F(AnimationDocumentTimelineTest, HasStarted) |
| 126 { | 126 { |
| 127 timeline = DocumentTimeline::create(document.get()); | 127 timeline = DocumentTimeline::create(document.get()); |
| 128 EXPECT_FALSE(timeline->hasStarted()); | 128 EXPECT_FALSE(timeline->hasStarted()); |
| 129 timeline->setZeroTime(0); | 129 timeline->setZeroTime(0); |
| 130 EXPECT_TRUE(timeline->hasStarted()); | 130 EXPECT_TRUE(timeline->hasStarted()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 TEST_F(AnimationDocumentTimelineTest, EmptyKeyframeAnimation) | 133 TEST_F(AnimationDocumentTimelineTest, EmptyKeyframeAnimation) |
| 134 { | 134 { |
| 135 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(KeyframeEffectModel::KeyframeVector()); | 135 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); |
| 136 RefPtr<Animation> anim = Animation::create(element.get(), effect, timing); | 136 RefPtr<Animation> anim = Animation::create(element.get(), effect, timing); |
| 137 | 137 |
| 138 timeline->play(anim.get()); | 138 timeline->play(anim.get()); |
| 139 | 139 |
| 140 platformTiming->expectNoMoreActions(); | 140 platformTiming->expectNoMoreActions(); |
| 141 updateClockAndService(0); | 141 updateClockAndService(0); |
| 142 EXPECT_FLOAT_EQ(0, timeline->currentTime()); | 142 EXPECT_FLOAT_EQ(0, timeline->currentTime()); |
| 143 EXPECT_FALSE(anim->isInEffect()); | 143 EXPECT_FALSE(anim->isInEffect()); |
| 144 | 144 |
| 145 platformTiming->expectNoMoreActions(); | 145 platformTiming->expectNoMoreActions(); |
| 146 updateClockAndService(100); | 146 updateClockAndService(100); |
| 147 EXPECT_FLOAT_EQ(100, timeline->currentTime()); | 147 EXPECT_FLOAT_EQ(100, timeline->currentTime()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 TEST_F(AnimationDocumentTimelineTest, EmptyForwardsKeyframeAnimation) | 150 TEST_F(AnimationDocumentTimelineTest, EmptyForwardsKeyframeAnimation) |
| 151 { | 151 { |
| 152 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(KeyframeEffectModel::KeyframeVector()); | 152 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); |
| 153 timing.fillMode = Timing::FillModeForwards; | 153 timing.fillMode = Timing::FillModeForwards; |
| 154 RefPtr<Animation> anim = Animation::create(element.get(), effect, timing); | 154 RefPtr<Animation> anim = Animation::create(element.get(), effect, timing); |
| 155 | 155 |
| 156 timeline->play(anim.get()); | 156 timeline->play(anim.get()); |
| 157 | 157 |
| 158 platformTiming->expectNoMoreActions(); | 158 platformTiming->expectNoMoreActions(); |
| 159 updateClockAndService(0); | 159 updateClockAndService(0); |
| 160 EXPECT_FLOAT_EQ(0, timeline->currentTime()); | 160 EXPECT_FLOAT_EQ(0, timeline->currentTime()); |
| 161 EXPECT_TRUE(anim->isInEffect()); | 161 EXPECT_TRUE(anim->isInEffect()); |
| 162 EXPECT_TRUE(anim->activeInterpolations().isEmpty()); | 162 EXPECT_TRUE(anim->activeInterpolations().isEmpty()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 186 EXPECT_FALSE(isNull); | 186 EXPECT_FALSE(isNull); |
| 187 | 187 |
| 188 document->animationClock().updateTime(400); | 188 document->animationClock().updateTime(400); |
| 189 EXPECT_EQ(100, timeline->currentTime()); | 189 EXPECT_EQ(100, timeline->currentTime()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 TEST_F(AnimationDocumentTimelineTest, PauseForTesting) | 192 TEST_F(AnimationDocumentTimelineTest, PauseForTesting) |
| 193 { | 193 { |
| 194 float seekTime = 1; | 194 float seekTime = 1; |
| 195 timing.fillMode = Timing::FillModeForwards; | 195 timing.fillMode = Timing::FillModeForwards; |
| 196 RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timing); | 196 RefPtr<Animation> anim1 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timing); |
| 197 RefPtr<Animation> anim2 = Animation::create(element.get(), KeyframeEffectMo
del::create(KeyframeEffectModel::KeyframeVector()), timing); | 197 RefPtr<Animation> anim2 = Animation::create(element.get(), AnimatableValueK
eyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); |
| 198 AnimationPlayer* player1 = timeline->play(anim1.get()); | 198 AnimationPlayer* player1 = timeline->play(anim1.get()); |
| 199 AnimationPlayer* player2 = timeline->play(anim2.get()); | 199 AnimationPlayer* player2 = timeline->play(anim2.get()); |
| 200 timeline->pauseAnimationsForTesting(seekTime); | 200 timeline->pauseAnimationsForTesting(seekTime); |
| 201 | 201 |
| 202 EXPECT_FLOAT_EQ(seekTime, player1->currentTime()); | 202 EXPECT_FLOAT_EQ(seekTime, player1->currentTime()); |
| 203 EXPECT_FLOAT_EQ(seekTime, player2->currentTime()); | 203 EXPECT_FLOAT_EQ(seekTime, player2->currentTime()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 TEST_F(AnimationDocumentTimelineTest, NumberOfActiveAnimations) | 206 TEST_F(AnimationDocumentTimelineTest, NumberOfActiveAnimations) |
| 207 { | 207 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 219 timingBackwardFillDelay.startDelay = 1; | 219 timingBackwardFillDelay.startDelay = 1; |
| 220 | 220 |
| 221 Timing timingNoFillDelay; | 221 Timing timingNoFillDelay; |
| 222 timingNoFillDelay.iterationDuration = 1; | 222 timingNoFillDelay.iterationDuration = 1; |
| 223 timingNoFillDelay.fillMode = Timing::FillModeNone; | 223 timingNoFillDelay.fillMode = Timing::FillModeNone; |
| 224 timingNoFillDelay.startDelay = 1; | 224 timingNoFillDelay.startDelay = 1; |
| 225 | 225 |
| 226 Timing timingAutoFill; | 226 Timing timingAutoFill; |
| 227 timingAutoFill.iterationDuration = 2; | 227 timingAutoFill.iterationDuration = 2; |
| 228 | 228 |
| 229 RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingForwardFill); | 229 RefPtr<Animation> anim1 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingForwardFill); |
| 230 RefPtr<Animation> anim2 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingNoFill); | 230 RefPtr<Animation> anim2 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingNoFill); |
| 231 RefPtr<Animation> anim3 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingBackwardFillDelay); | 231 RefPtr<Animation> anim3 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingBackwardFillDe
lay); |
| 232 RefPtr<Animation> anim4 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingNoFillDelay); | 232 RefPtr<Animation> anim4 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingNoFillDelay); |
| 233 RefPtr<Animation> anim5 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingAutoFill); | 233 RefPtr<Animation> anim5 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingAutoFill); |
| 234 | 234 |
| 235 timeline->play(anim1.get()); | 235 timeline->play(anim1.get()); |
| 236 timeline->play(anim2.get()); | 236 timeline->play(anim2.get()); |
| 237 timeline->play(anim3.get()); | 237 timeline->play(anim3.get()); |
| 238 timeline->play(anim4.get()); | 238 timeline->play(anim4.get()); |
| 239 timeline->play(anim5.get()); | 239 timeline->play(anim5.get()); |
| 240 | 240 |
| 241 platformTiming->expectNextFrameAction(); | 241 platformTiming->expectNextFrameAction(); |
| 242 updateClockAndService(0); | 242 updateClockAndService(0); |
| 243 EXPECT_EQ(5U, timeline->numberOfActiveAnimationsForTesting()); | 243 EXPECT_EQ(5U, timeline->numberOfActiveAnimationsForTesting()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 TEST_F(AnimationDocumentTimelineTest, UseAnimationPlayerAfterTimelineDeref) | 292 TEST_F(AnimationDocumentTimelineTest, UseAnimationPlayerAfterTimelineDeref) |
| 293 { | 293 { |
| 294 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0); | 294 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0); |
| 295 timeline.clear(); | 295 timeline.clear(); |
| 296 // Test passes if this does not crash. | 296 // Test passes if this does not crash. |
| 297 player->setStartTime(0); | 297 player->setStartTime(0); |
| 298 } | 298 } |
| 299 | 299 |
| 300 } | 300 } |
| OLD | NEW |