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

Unified Diff: ui/compositor/layer_owner_unittest.cc

Issue 1800393002: RecreateLayer should copy the transform as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « ui/compositor/layer_owner.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_owner_unittest.cc
diff --git a/ui/compositor/layer_owner_unittest.cc b/ui/compositor/layer_owner_unittest.cc
index add83450f8b8ead645caf7b59e4d70998c9f8728..69216aa9c143015b106d89299724d8cb34e31a55 100644
--- a/ui/compositor/layer_owner_unittest.cc
+++ b/ui/compositor/layer_owner_unittest.cc
@@ -157,6 +157,31 @@ TEST(LayerOwnerTest, InvertPropertyRemainSameWithRecreateLayer) {
EXPECT_EQ(old_layer2->layer_inverted(), owner.layer()->layer_inverted());
}
+TEST(LayerOwnerTest, RecreateLayerWithTransform) {
+ LayerOwner owner;
+ Layer* layer = new Layer;
+ owner.SetLayer(layer);
+
+ gfx::Transform transform;
+ transform.Scale(2, 1);
+ transform.Translate(10, 5);
+
+ layer->SetTransform(transform);
+
+ scoped_ptr<Layer> old_layer1 = owner.RecreateLayer();
+ // Both new layer and original layer have the same transform.
+ EXPECT_EQ(transform, old_layer1->GetTargetTransform());
+ EXPECT_EQ(transform, owner.layer()->GetTargetTransform());
+
+ // But they're now separated, so changing the old layer's transform
+ // should not affect the owner's.
+ owner.layer()->SetTransform(gfx::Transform());
+ EXPECT_EQ(transform, old_layer1->GetTargetTransform());
+ scoped_ptr<Layer> old_layer2 = owner.RecreateLayer();
+ EXPECT_TRUE(old_layer2->GetTargetTransform().IsIdentity());
+ EXPECT_TRUE(owner.layer()->GetTargetTransform().IsIdentity());
+}
+
TEST_F(LayerOwnerTestWithCompositor, RecreateRootLayerWithCompositor) {
LayerOwner owner;
Layer* layer = new Layer;
« no previous file with comments | « ui/compositor/layer_owner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698