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 18 matching lines...) Expand all Loading... |
181 EXPECT_EQ(0, timeline->currentTime()); | 181 EXPECT_EQ(0, timeline->currentTime()); |
182 | 182 |
183 document->animationClock().updateTime(400); | 183 document->animationClock().updateTime(400); |
184 EXPECT_EQ(100, timeline->currentTime()); | 184 EXPECT_EQ(100, timeline->currentTime()); |
185 } | 185 } |
186 | 186 |
187 TEST_F(AnimationDocumentTimelineTest, PauseForTesting) | 187 TEST_F(AnimationDocumentTimelineTest, PauseForTesting) |
188 { | 188 { |
189 float seekTime = 1; | 189 float seekTime = 1; |
190 timing.fillMode = Timing::FillModeForwards; | 190 timing.fillMode = Timing::FillModeForwards; |
191 RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timing); | 191 RefPtr<Animation> anim1 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timing); |
192 RefPtr<Animation> anim2 = Animation::create(element.get(), KeyframeEffectMo
del::create(KeyframeEffectModel::KeyframeVector()), timing); | 192 RefPtr<Animation> anim2 = Animation::create(element.get(), AnimatableValueK
eyframeEffectModel::create(AnimatableValueKeyframeVector()), timing); |
193 AnimationPlayer* player1 = timeline->play(anim1.get()); | 193 AnimationPlayer* player1 = timeline->play(anim1.get()); |
194 AnimationPlayer* player2 = timeline->play(anim2.get()); | 194 AnimationPlayer* player2 = timeline->play(anim2.get()); |
195 timeline->pauseAnimationsForTesting(seekTime); | 195 timeline->pauseAnimationsForTesting(seekTime); |
196 | 196 |
197 EXPECT_FLOAT_EQ(seekTime, player1->currentTime()); | 197 EXPECT_FLOAT_EQ(seekTime, player1->currentTime()); |
198 EXPECT_FLOAT_EQ(seekTime, player2->currentTime()); | 198 EXPECT_FLOAT_EQ(seekTime, player2->currentTime()); |
199 } | 199 } |
200 | 200 |
201 TEST_F(AnimationDocumentTimelineTest, NumberOfActiveAnimations) | 201 TEST_F(AnimationDocumentTimelineTest, NumberOfActiveAnimations) |
202 { | 202 { |
(...skipping 11 matching lines...) Expand all Loading... |
214 timingBackwardFillDelay.startDelay = 1; | 214 timingBackwardFillDelay.startDelay = 1; |
215 | 215 |
216 Timing timingNoFillDelay; | 216 Timing timingNoFillDelay; |
217 timingNoFillDelay.iterationDuration = 1; | 217 timingNoFillDelay.iterationDuration = 1; |
218 timingNoFillDelay.fillMode = Timing::FillModeNone; | 218 timingNoFillDelay.fillMode = Timing::FillModeNone; |
219 timingNoFillDelay.startDelay = 1; | 219 timingNoFillDelay.startDelay = 1; |
220 | 220 |
221 Timing timingAutoFill; | 221 Timing timingAutoFill; |
222 timingAutoFill.iterationDuration = 2; | 222 timingAutoFill.iterationDuration = 2; |
223 | 223 |
224 RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingForwardFill); | 224 RefPtr<Animation> anim1 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingForwardFill); |
225 RefPtr<Animation> anim2 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingNoFill); | 225 RefPtr<Animation> anim2 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingNoFill); |
226 RefPtr<Animation> anim3 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingBackwardFillDelay); | 226 RefPtr<Animation> anim3 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingBackwardFillDe
lay); |
227 RefPtr<Animation> anim4 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingNoFillDelay); | 227 RefPtr<Animation> anim4 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingNoFillDelay); |
228 RefPtr<Animation> anim5 = Animation::create(element.get(), KeyframeEffectMod
el::create(KeyframeEffectModel::KeyframeVector()), timingAutoFill); | 228 RefPtr<Animation> anim5 = Animation::create(element.get(), AnimatableValueKe
yframeEffectModel::create(AnimatableValueKeyframeVector()), timingAutoFill); |
229 | 229 |
230 timeline->play(anim1.get()); | 230 timeline->play(anim1.get()); |
231 timeline->play(anim2.get()); | 231 timeline->play(anim2.get()); |
232 timeline->play(anim3.get()); | 232 timeline->play(anim3.get()); |
233 timeline->play(anim4.get()); | 233 timeline->play(anim4.get()); |
234 timeline->play(anim5.get()); | 234 timeline->play(anim5.get()); |
235 | 235 |
236 platformTiming->expectNextFrameAction(); | 236 platformTiming->expectNextFrameAction(); |
237 updateClockAndService(0); | 237 updateClockAndService(0); |
238 EXPECT_EQ(5U, timeline->numberOfActiveAnimationsForTesting()); | 238 EXPECT_EQ(5U, timeline->numberOfActiveAnimationsForTesting()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 TEST_F(AnimationDocumentTimelineTest, UseAnimationPlayerAfterTimelineDeref) | 287 TEST_F(AnimationDocumentTimelineTest, UseAnimationPlayerAfterTimelineDeref) |
288 { | 288 { |
289 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0); | 289 RefPtr<AnimationPlayer> player = timeline->createAnimationPlayer(0); |
290 timeline.clear(); | 290 timeline.clear(); |
291 // Test passes if this does not crash. | 291 // Test passes if this does not crash. |
292 player->setStartTime(0); | 292 player->setStartTime(0); |
293 } | 293 } |
294 | 294 |
295 } | 295 } |
OLD | NEW |