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

Side by Side Diff: sky/engine/core/animation/AnimationPlayerTest.cpp

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 { 480 {
481 player->finish(exceptionState); 481 player->finish(exceptionState);
482 EXPECT_EQ(30, player->currentTimeInternal()); 482 EXPECT_EQ(30, player->currentTimeInternal());
483 EXPECT_TRUE(player->finished()); 483 EXPECT_TRUE(player->finished());
484 484
485 player->setPlaybackRate(-1); 485 player->setPlaybackRate(-1);
486 player->finish(exceptionState); 486 player->finish(exceptionState);
487 EXPECT_EQ(0, player->currentTimeInternal()); 487 EXPECT_EQ(0, player->currentTimeInternal());
488 EXPECT_TRUE(player->finished()); 488 EXPECT_TRUE(player->finished());
489 489
490 EXPECT_FALSE(exceptionState.hadException()); 490 EXPECT_FALSE(exceptionState.had_exception());
491 } 491 }
492 492
493 TEST_F(AnimationAnimationPlayerTest, FinishAfterSourceEnd) 493 TEST_F(AnimationAnimationPlayerTest, FinishAfterSourceEnd)
494 { 494 {
495 player->setCurrentTimeInternal(40); 495 player->setCurrentTimeInternal(40);
496 player->finish(exceptionState); 496 player->finish(exceptionState);
497 EXPECT_EQ(30, player->currentTimeInternal()); 497 EXPECT_EQ(30, player->currentTimeInternal());
498 } 498 }
499 499
500 TEST_F(AnimationAnimationPlayerTest, FinishBeforeStart) 500 TEST_F(AnimationAnimationPlayerTest, FinishBeforeStart)
(...skipping 15 matching lines...) Expand all
516 TEST_F(AnimationAnimationPlayerTest, FinishRaisesException) 516 TEST_F(AnimationAnimationPlayerTest, FinishRaisesException)
517 { 517 {
518 Timing timing; 518 Timing timing;
519 timing.iterationDuration = 1; 519 timing.iterationDuration = 1;
520 timing.iterationCount = std::numeric_limits<double>::infinity(); 520 timing.iterationCount = std::numeric_limits<double>::infinity();
521 player->setSource(Animation::create(0, nullptr, timing).get()); 521 player->setSource(Animation::create(0, nullptr, timing).get());
522 player->setCurrentTimeInternal(10); 522 player->setCurrentTimeInternal(10);
523 523
524 player->finish(exceptionState); 524 player->finish(exceptionState);
525 EXPECT_EQ(10, player->currentTimeInternal()); 525 EXPECT_EQ(10, player->currentTimeInternal());
526 EXPECT_TRUE(exceptionState.hadException()); 526 EXPECT_TRUE(exceptionState.had_exception());
527 EXPECT_EQ(InvalidStateError, exceptionState.code()); 527 EXPECT_EQ(InvalidStateError, exceptionState.code());
528 } 528 }
529 529
530 530
531 TEST_F(AnimationAnimationPlayerTest, LimitingAtSourceEnd) 531 TEST_F(AnimationAnimationPlayerTest, LimitingAtSourceEnd)
532 { 532 {
533 simulateFrame(30); 533 simulateFrame(30);
534 EXPECT_EQ(30, player->currentTimeInternal()); 534 EXPECT_EQ(30, player->currentTimeInternal());
535 EXPECT_TRUE(player->finished()); 535 EXPECT_TRUE(player->finished());
536 simulateFrame(40); 536 simulateFrame(40);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 } 787 }
788 788
789 TEST_F(AnimationAnimationPlayerTest, HasLowerPriority) 789 TEST_F(AnimationAnimationPlayerTest, HasLowerPriority)
790 { 790 {
791 RefPtr<AnimationPlayer> player1 = timeline->createAnimationPlayer(0); 791 RefPtr<AnimationPlayer> player1 = timeline->createAnimationPlayer(0);
792 RefPtr<AnimationPlayer> player2 = timeline->createAnimationPlayer(0); 792 RefPtr<AnimationPlayer> player2 = timeline->createAnimationPlayer(0);
793 EXPECT_TRUE(AnimationPlayer::hasLowerPriority(player1.get(), player2.get())) ; 793 EXPECT_TRUE(AnimationPlayer::hasLowerPriority(player1.get(), player2.get())) ;
794 } 794 }
795 795
796 } 796 }
OLDNEW
« no previous file with comments | « sky/engine/core/animation/AnimationPlayer.cpp ('k') | sky/engine/core/animation/AnimationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698