Chromium Code Reviews| 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 43d94da6d9a9dc166ddad829fdaba93e04a39a10..4f9b5f34ed3016c1c1233eb2ca53153ba2b93d89 100644 |
| --- a/cc/trees/layer_tree_host_common_unittest.cc |
| +++ b/cc/trees/layer_tree_host_common_unittest.cc |
| @@ -8311,5 +8311,75 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { |
| GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| EXPECT_EQ(expected, actual); |
| } |
| + |
| +TEST_F(LayerTreeHostCommonTest, VerifyLayerDrawProperties) { |
|
danakj
2014/05/23 17:07:34
how about name this "DrawPropertyScales"
The "Ver
|
| + FakeImplProxy proxy; |
| + TestSharedBitmapManager shared_bitmap_manager; |
| + FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); |
| + |
| + scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| + LayerImpl* root_layer = root.get(); |
| + scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); |
| + LayerImpl* child1_layer = child1.get(); |
| + scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); |
| + LayerImpl* child2_layer = child2.get(); |
| + |
| + root->AddChild(child1.Pass()); |
| + root->AddChild(child2.Pass()); |
| + |
| + gfx::Transform identity_matrix, scale_transform_child1, |
| + scale_transform_child2; |
| + scale_transform_child1.Scale(2, 3); |
| + scale_transform_child2.Scale(4, 5); |
| + |
| + SetLayerPropertiesForTesting(root_layer, |
| + identity_matrix, |
| + gfx::PointF(), |
| + gfx::PointF(), |
| + gfx::Size(), |
| + true, |
| + false); |
| + SetLayerPropertiesForTesting(child1_layer, |
| + scale_transform_child1, |
| + gfx::PointF(), |
| + gfx::PointF(), |
| + gfx::Size(), |
| + true, |
| + false); |
| + |
| + TransformOperations scale; |
| + scale.AppendScale(5.f, 8.f, 3.f); |
| + |
| + AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale); |
| + SetLayerPropertiesForTesting(child2_layer, |
| + scale_transform_child2, |
| + gfx::PointF(), |
| + gfx::PointF(), |
| + gfx::Size(), |
| + true, |
| + false); |
| + |
| + ExecuteCalculateDrawProperties(root_layer); |
| + |
| + EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().ideal_contents_scale); |
| + EXPECT_FLOAT_EQ(3.f, child1_layer->draw_properties().ideal_contents_scale); |
| + EXPECT_FLOAT_EQ(5.f, child2_layer->draw_properties().ideal_contents_scale); |
| + |
| + EXPECT_FLOAT_EQ( |
| + 0.f, root_layer->draw_properties().maximum_animation_contents_scale); |
| + EXPECT_FLOAT_EQ( |
| + 0.f, child1_layer->draw_properties().maximum_animation_contents_scale); |
| + EXPECT_FLOAT_EQ( |
| + 8.f, child2_layer->draw_properties().maximum_animation_contents_scale); |
| + |
| + EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().page_scale_factor); |
|
danakj
2014/05/23 17:07:34
Can you set a page scale factor on the host_impl.a
|
| + EXPECT_FLOAT_EQ(1.f, child1_layer->draw_properties().page_scale_factor); |
| + EXPECT_FLOAT_EQ(1.f, child2_layer->draw_properties().page_scale_factor); |
| + |
| + EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().device_scale_factor); |
| + EXPECT_FLOAT_EQ(1.f, child1_layer->draw_properties().device_scale_factor); |
| + EXPECT_FLOAT_EQ(1.f, child2_layer->draw_properties().device_scale_factor); |
| +} |
| + |
| } // namespace |
| } // namespace cc |