diff options
author | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 00:21:14 +0000 |
---|---|---|
committer | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 00:21:14 +0000 |
commit | 6f110e48c7b04a1bdebf9a7d108a7efded4d9edd (patch) | |
tree | 536c08c546cf0dcef0cb74b2e424df921601cbca /ui/compositor/layer_animator_unittest.cc | |
parent | 63c4203845facef2da2f61ec484b21fc5982081c (diff) | |
download | chromium_src-6f110e48c7b04a1bdebf9a7d108a7efded4d9edd.zip chromium_src-6f110e48c7b04a1bdebf9a7d108a7efded4d9edd.tar.gz chromium_src-6f110e48c7b04a1bdebf9a7d108a7efded4d9edd.tar.bz2 |
Add support for LayerAnimator::AbortAllAnimations
This is useful when you want to stop all animations, but you don't want to advance them to their final positions.
R=jamescook@chromium.org
BUG=None
Review URL: https://chromiumcodereview.appspot.com/11571027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor/layer_animator_unittest.cc')
-rw-r--r-- | ui/compositor/layer_animator_unittest.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc index 912262e..a94d8d4 100644 --- a/ui/compositor/layer_animator_unittest.cc +++ b/ui/compositor/layer_animator_unittest.cc @@ -207,6 +207,29 @@ TEST(LayerAnimatorTest, StopAnimating) { CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), target_bounds); } +// Checks that multiple running animation for separate properties can be stopped +// simultaneously and that all animations are advanced to their target values. +TEST(LayerAnimatorTest, AbortAllAnimations) { + scoped_refptr<LayerAnimator> animator( + LayerAnimator::CreateImplicitAnimator()); + animator->set_disable_timer_for_test(true); + TestLayerAnimationDelegate delegate; + double initial_opacity(1.0); + gfx::Rect initial_bounds(0, 0, 10, 10); + delegate.SetOpacityFromAnimation(initial_opacity); + delegate.SetBoundsFromAnimation(initial_bounds); + animator->SetDelegate(&delegate); + double target_opacity(0.5); + gfx::Rect target_bounds(0, 0, 50, 50); + animator->SetOpacity(target_opacity); + animator->SetBounds(target_bounds); + EXPECT_TRUE(animator->is_animating()); + animator->AbortAllAnimations(); + EXPECT_FALSE(animator->is_animating()); + EXPECT_FLOAT_EQ(initial_opacity, delegate.GetOpacityForAnimation()); + CheckApproximatelyEqual(initial_bounds, delegate.GetBoundsForAnimation()); +} + // Schedule an animation that can run immediately. This is the trivial case and // should result in the animation being started immediately. TEST(LayerAnimatorTest, ScheduleAnimationThatCanRunImmediately) { |