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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 timeline->SetPlaybackRate(1.0); | 233 timeline->SetPlaybackRate(1.0); |
234 EXPECT_EQ(1.0, timeline->PlaybackRate()); | 234 EXPECT_EQ(1.0, timeline->PlaybackRate()); |
235 document->GetAnimationClock().UpdateTime(400); | 235 document->GetAnimationClock().UpdateTime(400); |
236 EXPECT_EQ(-200, timeline->ZeroTime()); | 236 EXPECT_EQ(-200, timeline->ZeroTime()); |
237 EXPECT_EQ(600, timeline->CurrentTimeInternal()); | 237 EXPECT_EQ(600, timeline->CurrentTimeInternal()); |
238 EXPECT_EQ(600, timeline->CurrentTimeInternal(is_null)); | 238 EXPECT_EQ(600, timeline->CurrentTimeInternal(is_null)); |
239 | 239 |
240 EXPECT_FALSE(is_null); | 240 EXPECT_FALSE(is_null); |
241 } | 241 } |
242 | 242 |
243 TEST_F(AnimationAnimationTimelineTest, SetCurrentTime) { | |
244 double zero_time = timeline->ZeroTime(); | |
245 | |
246 document->GetAnimationClock().UpdateTime(100); | |
247 EXPECT_EQ(zero_time, timeline->ZeroTime()); | |
248 EXPECT_EQ(100, timeline->CurrentTimeInternal()); | |
249 | |
250 timeline->SetCurrentTimeInternal(0); | |
251 EXPECT_EQ(0, timeline->CurrentTimeInternal()); | |
252 EXPECT_EQ(zero_time + 100, timeline->ZeroTime()); | |
253 | |
254 timeline->SetCurrentTimeInternal(100); | |
255 EXPECT_EQ(100, timeline->CurrentTimeInternal()); | |
256 EXPECT_EQ(zero_time, timeline->ZeroTime()); | |
257 | |
258 timeline->SetCurrentTimeInternal(200); | |
259 EXPECT_EQ(200, timeline->CurrentTimeInternal()); | |
260 EXPECT_EQ(zero_time - 100, timeline->ZeroTime()); | |
261 | |
262 document->GetAnimationClock().UpdateTime(200); | |
263 EXPECT_EQ(300, timeline->CurrentTimeInternal()); | |
264 EXPECT_EQ(zero_time - 100, timeline->ZeroTime()); | |
265 | |
266 timeline->SetCurrentTimeInternal(0); | |
267 EXPECT_EQ(0, timeline->CurrentTimeInternal()); | |
268 EXPECT_EQ(zero_time + 200, timeline->ZeroTime()); | |
269 | |
270 timeline->SetCurrentTimeInternal(100); | |
271 EXPECT_EQ(100, timeline->CurrentTimeInternal()); | |
272 EXPECT_EQ(zero_time + 100, timeline->ZeroTime()); | |
273 | |
274 timeline->SetCurrentTimeInternal(200); | |
275 EXPECT_EQ(200, timeline->CurrentTimeInternal()); | |
276 EXPECT_EQ(zero_time, timeline->ZeroTime()); | |
277 | |
278 timeline->setCurrentTime(0, false); | |
279 EXPECT_EQ(0, timeline->currentTime()); | |
280 EXPECT_EQ(zero_time + 200, timeline->ZeroTime()); | |
281 | |
282 timeline->setCurrentTime(1000, false); | |
283 EXPECT_EQ(1000, timeline->currentTime()); | |
284 EXPECT_EQ(zero_time + 199, timeline->ZeroTime()); | |
285 | |
286 timeline->setCurrentTime(2000, false); | |
287 EXPECT_EQ(2000, timeline->currentTime()); | |
288 EXPECT_EQ(zero_time + 198, timeline->ZeroTime()); | |
289 } | |
290 | |
291 TEST_F(AnimationAnimationTimelineTest, PauseForTesting) { | 243 TEST_F(AnimationAnimationTimelineTest, PauseForTesting) { |
292 float seek_time = 1; | 244 float seek_time = 1; |
293 timing.fill_mode = Timing::FillMode::FORWARDS; | 245 timing.fill_mode = Timing::FillMode::FORWARDS; |
294 KeyframeEffect* anim1 = | 246 KeyframeEffect* anim1 = |
295 KeyframeEffect::Create(element.Get(), | 247 KeyframeEffect::Create(element.Get(), |
296 AnimatableValueKeyframeEffectModel::Create( | 248 AnimatableValueKeyframeEffectModel::Create( |
297 AnimatableValueKeyframeVector()), | 249 AnimatableValueKeyframeVector()), |
298 timing); | 250 timing); |
299 KeyframeEffect* anim2 = | 251 KeyframeEffect* anim2 = |
300 KeyframeEffect::Create(element.Get(), | 252 KeyframeEffect::Create(element.Get(), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 287 } |
336 | 288 |
337 TEST_F(AnimationAnimationTimelineTest, UseAnimationAfterTimelineDeref) { | 289 TEST_F(AnimationAnimationTimelineTest, UseAnimationAfterTimelineDeref) { |
338 Animation* animation = timeline->Play(0); | 290 Animation* animation = timeline->Play(0); |
339 timeline.Clear(); | 291 timeline.Clear(); |
340 // Test passes if this does not crash. | 292 // Test passes if this does not crash. |
341 animation->setStartTime(0, false); | 293 animation->setStartTime(0, false); |
342 } | 294 } |
343 | 295 |
344 } // namespace blink | 296 } // namespace blink |
OLD | NEW |