summaryrefslogtreecommitdiffstats
path: root/ui/compositor/layer_owner_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/compositor/layer_owner_unittest.cc')
-rw-r--r--ui/compositor/layer_owner_unittest.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/compositor/layer_owner_unittest.cc b/ui/compositor/layer_owner_unittest.cc
index add8345..69216aa 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;