OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/test/layer_tree_json_parser.h" | 5 #include "cc/test/layer_tree_json_parser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/test/fake_impl_task_runner_provider.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 result()->Failed()) \ | 27 result()->Failed()) \ |
28 return false; \ | 28 return false; \ |
29 } while (0) | 29 } while (0) |
30 | 30 |
31 RETURN_IF_EXPECTATION_FAILS( | 31 RETURN_IF_EXPECTATION_FAILS( |
32 EXPECT_EQ(layer_impl->test_properties()->children.size(), | 32 EXPECT_EQ(layer_impl->test_properties()->children.size(), |
33 layer->children().size())); | 33 layer->children().size())); |
34 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->bounds(), layer->bounds())); | 34 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->bounds(), layer->bounds())); |
35 RETURN_IF_EXPECTATION_FAILS( | 35 RETURN_IF_EXPECTATION_FAILS( |
36 EXPECT_EQ(layer_impl->position(), layer->position())); | 36 EXPECT_EQ(layer_impl->position(), layer->position())); |
37 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRANSFORMATION_MATRIX_EQ( | |
38 layer_impl->transform(), layer->transform())); | |
ajuma
2016/08/17 13:27:46
I think we need to continue to include a transform
jaydasika
2016/08/17 19:40:00
Done.
| |
39 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(), | 37 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(), |
40 layer->contents_opaque())); | 38 layer->contents_opaque())); |
41 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(), | 39 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(), |
42 layer->scrollable())); | 40 layer->scrollable())); |
43 RETURN_IF_EXPECTATION_FAILS( | 41 RETURN_IF_EXPECTATION_FAILS( |
44 EXPECT_FLOAT_EQ(layer_impl->Opacity(), layer->opacity())); | 42 EXPECT_FLOAT_EQ(layer_impl->Opacity(), layer->opacity())); |
45 RETURN_IF_EXPECTATION_FAILS( | 43 RETURN_IF_EXPECTATION_FAILS( |
46 EXPECT_EQ(layer_impl->touch_event_handler_region(), | 44 EXPECT_EQ(layer_impl->touch_event_handler_region(), |
47 layer->touch_event_handler_region())); | 45 layer->touch_event_handler_region())); |
48 | 46 |
(...skipping 21 matching lines...) Expand all Loading... | |
70 LayerTreeImpl* tree = host_impl.active_tree(); | 68 LayerTreeImpl* tree = host_impl.active_tree(); |
71 | 69 |
72 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); | 70 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); |
73 std::unique_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); | 71 std::unique_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); |
74 std::unique_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); | 72 std::unique_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); |
75 | 73 |
76 root_impl->SetBounds(gfx::Size(100, 100)); | 74 root_impl->SetBounds(gfx::Size(100, 100)); |
77 parent->SetBounds(gfx::Size(50, 50)); | 75 parent->SetBounds(gfx::Size(50, 50)); |
78 child->SetBounds(gfx::Size(40, 40)); | 76 child->SetBounds(gfx::Size(40, 40)); |
79 | 77 |
80 gfx::Transform translate; | |
81 translate.Translate(10, 15); | |
82 child->SetTransform(translate); | |
83 | |
84 parent->SetPosition(gfx::PointF(25.f, 25.f)); | 78 parent->SetPosition(gfx::PointF(25.f, 25.f)); |
85 | 79 |
86 parent->test_properties()->AddChild(std::move(child)); | 80 parent->test_properties()->AddChild(std::move(child)); |
87 root_impl->test_properties()->AddChild(std::move(parent)); | 81 root_impl->test_properties()->AddChild(std::move(parent)); |
88 tree->SetRootLayerForTesting(std::move(root_impl)); | 82 tree->SetRootLayerForTesting(std::move(root_impl)); |
89 | 83 |
90 std::string json = host_impl.LayerTreeAsJson(); | 84 std::string json = host_impl.LayerTreeAsJson(); |
91 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 85 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
92 ASSERT_TRUE(root.get()); | 86 ASSERT_TRUE(root.get()); |
93 EXPECT_TRUE(LayerTreesMatch(host_impl.active_tree()->root_layer_for_testing(), | 87 EXPECT_TRUE(LayerTreesMatch(host_impl.active_tree()->root_layer_for_testing(), |
(...skipping 23 matching lines...) Expand all Loading... | |
117 tree->SetRootLayerForTesting(std::move(root_impl)); | 111 tree->SetRootLayerForTesting(std::move(root_impl)); |
118 | 112 |
119 std::string json = host_impl.LayerTreeAsJson(); | 113 std::string json = host_impl.LayerTreeAsJson(); |
120 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 114 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
121 ASSERT_TRUE(root.get()); | 115 ASSERT_TRUE(root.get()); |
122 EXPECT_TRUE(LayerTreesMatch(host_impl.active_tree()->root_layer_for_testing(), | 116 EXPECT_TRUE(LayerTreesMatch(host_impl.active_tree()->root_layer_for_testing(), |
123 root.get())); | 117 root.get())); |
124 } | 118 } |
125 | 119 |
126 } // namespace cc | 120 } // namespace cc |
OLD | NEW |