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

Unified Diff: cc/animation/element_animations_unittest.cc

Issue 2655993002: cc: Fix animation bounds computation for multiple players (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/element_animations.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/element_animations_unittest.cc
diff --git a/cc/animation/element_animations_unittest.cc b/cc/animation/element_animations_unittest.cc
index 0871dc7de1aa5f88fc24f439d57c26f9d6288be0..60a99c2136155e614da263bb48ee187d8d3f4a75 100644
--- a/cc/animation/element_animations_unittest.cc
+++ b/cc/animation/element_animations_unittest.cc
@@ -1789,6 +1789,43 @@ TEST_F(ElementAnimationsTest, TransformAnimationBounds) {
EXPECT_FALSE(player_impl_->TransformAnimationBoundsForBox(box, &bounds));
}
+TEST_F(ElementAnimationsTest, TransformAnimationBoundsTwoPlayers) {
+ AttachTimelinePlayerLayer();
+ CreateImplTimelineAndPlayer();
+
+ scoped_refptr<AnimationPlayer> player2 =
+ AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
+ timeline_->AttachPlayer(player2);
+ player2->AttachElement(element_id_);
+
+ std::unique_ptr<KeyframedTransformAnimationCurve> curve(
+ KeyframedTransformAnimationCurve::Create());
+
+ TransformOperations operations;
+ curve->AddKeyframe(
+ TransformKeyframe::Create(base::TimeDelta(), operations, nullptr));
+ operations.AppendScale(2.0, 3.0, 4.0);
+ curve->AddKeyframe(TransformKeyframe::Create(
+ base::TimeDelta::FromSecondsD(1.0), operations, nullptr));
+
+ std::unique_ptr<Animation> animation(
+ Animation::Create(std::move(curve), 1, 1, TargetProperty::TRANSFORM));
+ player2->AddAnimation(std::move(animation));
+
+ gfx::BoxF box(1.f, 2.f, -1.f, 3.f, 4.f, 5.f);
+ gfx::BoxF bounds;
+
+ EXPECT_FALSE(player_impl_->HasTransformAnimationThatInflatesBounds());
+ EXPECT_TRUE(player2->TransformAnimationBoundsForBox(box, &bounds));
+ EXPECT_EQ(gfx::BoxF(1.f, 2.f, -4.f, 7.f, 16.f, 20.f).ToString(),
+ bounds.ToString());
+
+ EXPECT_TRUE(
+ element_animations_->TransformAnimationBoundsForBox(box, &bounds));
+ EXPECT_EQ(gfx::BoxF(1.f, 2.f, -4.f, 7.f, 16.f, 20.f).ToString(),
+ bounds.ToString());
+}
+
// Tests that AbortAnimations aborts all animations targeting the specified
// property.
TEST_F(ElementAnimationsTest, AbortAnimations) {
« no previous file with comments | « cc/animation/element_animations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698