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

Side by Side Diff: ui/compositor/layer_animator_unittest.cc

Issue 2215043002: Removing unused functionality from ScopedLayerAnimationSettings: inverse animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | ui/compositor/scoped_layer_animation_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/layer_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 EXPECT_EQ(start_opacity, delegate.GetOpacityForAnimation()); 2369 EXPECT_EQ(start_opacity, delegate.GetOpacityForAnimation());
2370 2370
2371 settings.SetPreemptionStrategy( 2371 settings.SetPreemptionStrategy(
2372 LayerAnimator::ENQUEUE_NEW_ANIMATION); 2372 LayerAnimator::ENQUEUE_NEW_ANIMATION);
2373 settings.SetTransitionDuration(base::TimeDelta()); 2373 settings.SetTransitionDuration(base::TimeDelta());
2374 animator->SetOpacity(magic_opacity); 2374 animator->SetOpacity(magic_opacity);
2375 2375
2376 EXPECT_EQ(start_opacity, delegate.GetOpacityForAnimation()); 2376 EXPECT_EQ(start_opacity, delegate.GetOpacityForAnimation());
2377 } 2377 }
2378 2378
2379 TEST(LayerAnimatorTest, TestScopedCounterAnimation) {
2380 Layer parent, child;
2381 parent.Add(&child);
2382
2383 gfx::Transform parent_begin, parent_end;
2384
2385 parent_end.Scale3d(2.0, 0.5, 1.0);
2386
2387 // Parent animates from identity to the end value. The counter animation will
2388 // start at the end value and animate back to identity.
2389 gfx::Transform child_begin(parent_end);
2390
2391 child.SetTransform(child_begin);
2392 parent.SetTransform(parent_begin);
2393
2394 EXPECT_FALSE(child.GetAnimator()->is_animating());
2395
2396 ScopedLayerAnimationSettings settings(parent.GetAnimator());
2397 settings.SetInverselyAnimatedBaseLayer(&parent);
2398 settings.AddInverselyAnimatedLayer(&child);
2399
2400 parent.SetTransform(parent_end);
2401
2402 EXPECT_TRUE(child.GetAnimator()->is_animating());
2403 EXPECT_TRUE(child.GetTargetTransform().IsIdentity())
2404 << child.GetTargetTransform().ToString();
2405
2406 }
2407
2408 class CollectionLayerAnimationDelegate : public TestLayerAnimationDelegate { 2379 class CollectionLayerAnimationDelegate : public TestLayerAnimationDelegate {
2409 public: 2380 public:
2410 CollectionLayerAnimationDelegate() : collection(NULL) {} 2381 CollectionLayerAnimationDelegate() : collection(NULL) {}
2411 ~CollectionLayerAnimationDelegate() override {} 2382 ~CollectionLayerAnimationDelegate() override {}
2412 2383
2413 // LayerAnimationDelegate: 2384 // LayerAnimationDelegate:
2414 LayerAnimatorCollection* GetLayerAnimatorCollection() override { 2385 LayerAnimatorCollection* GetLayerAnimatorCollection() override {
2415 return &collection; 2386 return &collection;
2416 } 2387 }
2417 2388
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 EXPECT_EQ(observer.last_ended_sequence(), nullptr); 2794 EXPECT_EQ(observer.last_ended_sequence(), nullptr);
2824 EXPECT_EQ(observer.last_detached_sequence(), first_sequence); 2795 EXPECT_EQ(observer.last_detached_sequence(), first_sequence);
2825 2796
2826 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch()); 2797 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch());
2827 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch()); 2798 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch());
2828 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch()); 2799 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch());
2829 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch()); 2800 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch());
2830 } 2801 }
2831 2802
2832 } // namespace ui 2803 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/scoped_layer_animation_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698