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 73f82c08f23181e89cc90abb2ba8005d0cf3176c..4a2a1e527cf04fcb15d675bfc0e12387c877e8c5 100644 |
--- a/cc/trees/layer_tree_host_common_unittest.cc |
+++ b/cc/trees/layer_tree_host_common_unittest.cc |
@@ -3525,6 +3525,45 @@ TEST_F(LayerTreeHostCommonTest, OcclusionBySiblingOfTarget) { |
EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); |
} |
+TEST_F(LayerTreeHostCommonTest, TextureLayerSnapping) { |
+ FakeImplTaskRunnerProvider task_runner_provider; |
+ TestSharedBitmapManager shared_bitmap_manager; |
+ TestTaskGraphRunner task_graph_runner; |
+ std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
+ FakeCompositorFrameSink::Create3d(); |
+ FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
+ &task_graph_runner); |
+ |
+ std::unique_ptr<LayerImpl> root = |
+ LayerImpl::Create(host_impl.active_tree(), 1); |
+ std::unique_ptr<TextureLayerImpl> child = |
+ TextureLayerImpl::Create(host_impl.active_tree(), 2); |
+ |
+ LayerImpl* child_ptr = child.get(); |
+ |
+ root->SetBounds(gfx::Size(100, 100)); |
+ child->SetBounds(gfx::Size(100, 100)); |
+ child->SetDrawsContent(true); |
+ gfx::Transform fractional_translate; |
+ fractional_translate.Translate(10.5f, 10.5f); |
enne (OOO)
2016/10/26 20:32:32
Can you use a translation in of these components w
jaydasika
2016/10/26 21:49:13
Done.
|
+ child->test_properties()->transform = fractional_translate; |
+ |
+ host_impl.SetViewportSize(root->bounds()); |
+ |
+ root->test_properties()->AddChild(std::move(child)); |
+ host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); |
+ host_impl.SetVisible(true); |
+ host_impl.InitializeRenderer(compositor_frame_sink.get()); |
+ host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
+ bool update_lcd_text = false; |
+ host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); |
+ |
+ EXPECT_NE(child_ptr->ScreenSpaceTransform(), fractional_translate); |
+ fractional_translate.RoundTranslationComponents(); |
+ EXPECT_TRANSFORMATION_MATRIX_EQ(child_ptr->ScreenSpaceTransform(), |
enne (OOO)
2016/10/26 20:32:32
Could you also map this rect into screen space and
jaydasika
2016/10/26 21:49:13
Done.
|
+ fractional_translate); |
+} |
+ |
TEST_F(LayerTreeHostCommonTest, |
OcclusionForLayerWithUninvertibleDrawTransform) { |
FakeImplTaskRunnerProvider task_runner_provider; |