summaryrefslogtreecommitdiffstats
path: root/cc/layer_unittest.cc
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 00:01:09 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 00:01:09 +0000
commita7ae4ab4544edcce1bfb4081e8caccd7bc4e444b (patch)
treef9c0bd0ba92068f037452a9987eafeda03365deb /cc/layer_unittest.cc
parente52c2839d14a4d10de0e49b8a7fd0cccb24490bf (diff)
downloadchromium_src-a7ae4ab4544edcce1bfb4081e8caccd7bc4e444b.zip
chromium_src-a7ae4ab4544edcce1bfb4081e8caccd7bc4e444b.tar.gz
chromium_src-a7ae4ab4544edcce1bfb4081e8caccd7bc4e444b.tar.bz2
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
Diffstat (limited to 'cc/layer_unittest.cc')
-rw-r--r--cc/layer_unittest.cc30
1 files changed, 30 insertions, 0 deletions
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<Layer> testLayer = Layer::create();
+ scoped_ptr<LayerImpl> 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<Layer> testLayer = Layer::create();
+ scoped_ptr<LayerImpl> 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<FakeLayerImplTreeHost> create()