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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1613583002: cc:: Remove RenderSurfaceImpl::TargetEffectTreeIndex (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index c65a2cf5002b0c259c5f42e07ba706b27ff11c6a..19faed8993a4e967107493bc36039231ae7d7d2a 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -1391,6 +1391,43 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) {
EXPECT_EQ(SkXfermode::kSrcOver_Mode, child->draw_blend_mode());
}
+TEST_F(LayerTreeHostCommonTest, RenderSurfaceDrawOpacity) {
+ LayerImpl* root = root_layer();
+ LayerImpl* surface1 = AddChildToRoot<LayerImpl>();
+ LayerImpl* not_surface = AddChild<LayerImpl>(surface1);
+ LayerImpl* surface2 = AddChild<LayerImpl>(not_surface);
+
+ const gfx::Transform identity_matrix;
+ SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(10, 10), true, false,
+ true);
+ SetLayerPropertiesForTesting(surface1, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(10, 10), true, false,
+ true);
+ SetLayerPropertiesForTesting(not_surface, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(10, 10), true, false,
+ false);
+ SetLayerPropertiesForTesting(surface2, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(10, 10), true, false,
+ true);
+ surface1->SetDrawsContent(true);
+ surface2->SetDrawsContent(true);
+
+ surface1->SetOpacity(0.5f);
+ not_surface->SetOpacity(0.5f);
+ surface2->SetOpacity(0.5f);
+
+ ExecuteCalculateDrawProperties(root);
+
+ ASSERT_TRUE(surface1->render_surface());
+ ASSERT_FALSE(not_surface->render_surface());
+ ASSERT_TRUE(surface2->render_surface());
+ EXPECT_EQ(0.5f, surface1->render_surface()->draw_opacity());
+ // surface2's draw opacity should include the opacity of not-surface and
+ // itself, but not the opacity of surface1.
+ EXPECT_EQ(0.25f, surface2->render_surface()->draw_opacity());
+}
+
TEST_F(LayerTreeHostCommonTest, DrawOpacityWhenCannotRenderToSeparateSurface) {
// Tests that when separate surfaces are disabled, a layer's draw opacity is
// the product of all ancestor layer opacties and the layer's own opacity.
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698