From a7ae4ab4544edcce1bfb4081e8caccd7bc4e444b Mon Sep 17 00:00:00 2001 From: "vollick@chromium.org" Date: Tue, 18 Dec 2012 00:01:09 +0000 Subject: Add a test to ensure that pushPropertiesTo causes layer surface properties to be changed. If a layer's opacity or transform is updated via pushPropertiesTo, then we must mark the layer surface properties as being changed, or we will break damage tracking. This test would have caught bugs introduced by: https://codereview.chromium.org/11348256/ BUG=None Review URL: https://chromiumcodereview.appspot.com/11612003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173580 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/layer_unittest.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'cc/layer_unittest.cc') diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc index e5a98e8..2a4af24 100644 --- a/cc/layer_unittest.cc +++ b/cc/layer_unittest.cc @@ -577,6 +577,36 @@ TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)), implLayer->updateRect()); } +TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForTransform) +{ + scoped_refptr testLayer = Layer::create(); + scoped_ptr implLayer = LayerImpl::create(m_hostImpl.activeTree(), 1); + + gfx::Transform transform; + transform.Rotate(45.0); + testLayer->setTransform(transform); + + EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); + + testLayer->pushPropertiesTo(implLayer.get()); + + EXPECT_TRUE(implLayer->layerSurfacePropertyChanged()); +} + +TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForOpacity) +{ + scoped_refptr testLayer = Layer::create(); + scoped_ptr implLayer = LayerImpl::create(m_hostImpl.activeTree(), 1); + + testLayer->setOpacity(0.5); + + EXPECT_FALSE(implLayer->layerSurfacePropertyChanged()); + + testLayer->pushPropertiesTo(implLayer.get()); + + EXPECT_TRUE(implLayer->layerSurfacePropertyChanged()); +} + class FakeLayerImplTreeHost : public LayerTreeHost { public: static scoped_ptr create() -- cgit v1.1