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

Unified Diff: cc/layers/layer_unittest.cc

Issue 217313003: Stop displaying layers with non-invertible transforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test comment for cases 2-3. Created 6 years, 8 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/layers/layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_unittest.cc
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index f249dfe58947484acc446943c83a2ab098e8fbb1..21cf4d20f3b64184abc8564e7e566b385cf427c3 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -804,6 +804,37 @@ TEST_F(LayerTest, MaskAndReplicaHasParent) {
EXPECT_EQ(replica, replica->mask_layer()->parent());
}
+TEST_F(LayerTest, CheckTranformIsInvertible) {
+ scoped_refptr<Layer> layer = Layer::Create();
+ scoped_ptr<LayerImpl> impl_layer =
+ LayerImpl::Create(host_impl_.active_tree(), 1);
+ EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1);
+ EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
+ layer_tree_host_->SetRootLayer(layer);
+
+ EXPECT_TRUE(layer->transform_is_invertible());
+
+ gfx::Transform singular_transform;
+ singular_transform.Scale3d(
+ SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0));
+
+ layer->SetTransform(singular_transform);
+ layer->PushPropertiesTo(impl_layer.get());
+
+ EXPECT_FALSE(layer->transform_is_invertible());
+ EXPECT_FALSE(impl_layer->transform_is_invertible());
+
+ gfx::Transform rotation_transform;
+ rotation_transform.RotateAboutZAxis(-45.0);
+
+ layer->SetTransform(rotation_transform);
+ layer->PushPropertiesTo(impl_layer.get());
+ EXPECT_TRUE(layer->transform_is_invertible());
+ EXPECT_TRUE(impl_layer->transform_is_invertible());
+
+ Mock::VerifyAndClearExpectations(layer_tree_host_.get());
+}
+
class LayerTreeHostFactory {
public:
LayerTreeHostFactory()
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698