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

Side by Side Diff: cc/trees/property_tree_unittest.cc

Issue 2423483003: cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/trees/property_tree.h" 5 #include "cc/trees/property_tree.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "cc/input/main_thread_scrolling_reason.h" 8 #include "cc/input/main_thread_scrolling_reason.h"
8 #include "cc/proto/property_tree.pb.h" 9 #include "cc/proto/property_tree.pb.h"
9 #include "cc/test/geometry_test_utils.h" 10 #include "cc/test/geometry_test_utils.h"
10 #include "cc/trees/clip_node.h" 11 #include "cc/trees/clip_node.h"
11 #include "cc/trees/draw_property_utils.h" 12 #include "cc/trees/draw_property_utils.h"
12 #include "cc/trees/effect_node.h" 13 #include "cc/trees/effect_node.h"
13 #include "cc/trees/scroll_node.h" 14 #include "cc/trees/scroll_node.h"
14 #include "cc/trees/transform_node.h" 15 #include "cc/trees/transform_node.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 original.resets_clip = false; 120 original.resets_clip = false;
120 121
121 proto::TreeNode proto; 122 proto::TreeNode proto;
122 original.ToProtobuf(&proto); 123 original.ToProtobuf(&proto);
123 ClipNode result; 124 ClipNode result;
124 result.FromProtobuf(proto); 125 result.FromProtobuf(proto);
125 126
126 EXPECT_EQ(original, result); 127 EXPECT_EQ(original, result);
127 } 128 }
128 129
130 TEST(PropertyTreeSerializationTest, ClipNodeWithExpanderSerialization) {
131 ClipNode original;
132 original.id = 3;
133 original.parent_id = 2;
134 original.owner_id = 4;
135 original.clip = gfx::RectF(0.5f, 0.5f);
136 original.combined_clip_in_target_space = gfx::RectF(0.6f, 0.6f);
137 original.clip_in_target_space = gfx::RectF(0.7f, 0.7f);
138 original.transform_id = 2;
139 original.target_transform_id = 3;
140 original.target_effect_id = 4;
141 original.clip_type = ClipNode::ClipType::EXPANDS_CLIP;
142 original.clip_expander =
143 base::MakeUnique<ClipExpander>(ClipExpander::ExpanderType::FILTER, 8);
144 original.layer_clipping_uses_only_local_clip = false;
145 original.target_is_clipped = false;
146 original.layers_are_clipped = false;
147 original.layers_are_clipped_when_surfaces_disabled = false;
148 original.resets_clip = false;
149
150 proto::TreeNode proto;
151 original.ToProtobuf(&proto);
152 ClipNode result;
153 result.FromProtobuf(proto);
154
155 EXPECT_EQ(original, result);
156 }
157
129 TEST(PropertyTreeSerializationTest, ClipTreeSerialization) { 158 TEST(PropertyTreeSerializationTest, ClipTreeSerialization) {
130 ClipTree original; 159 ClipTree original;
131 ClipNode& root = *original.Node(0); 160 ClipNode& root = *original.Node(0);
132 root.owner_id = 1; 161 root.owner_id = 1;
133 root.transform_id = 2; 162 root.transform_id = 2;
134 root.target_transform_id = 1; 163 root.target_transform_id = 1;
135 root.target_effect_id = 1; 164 root.target_effect_id = 1;
136 ClipNode second; 165 ClipNode second;
137 second.owner_id = 2; 166 second.owner_id = 2;
138 second.transform_id = 4; 167 second.transform_id = 4;
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1050
1022 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( 1051 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(
1023 PropertyTreeTestSingularTransformSnapTest); 1052 PropertyTreeTestSingularTransformSnapTest);
1024 1053
1025 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F 1054 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F
1026 #undef SERIALIZED_PROPERTY_TREE_TEST_F 1055 #undef SERIALIZED_PROPERTY_TREE_TEST_F
1027 #undef DIRECT_PROPERTY_TREE_TEST_F 1056 #undef DIRECT_PROPERTY_TREE_TEST_F
1028 1057
1029 } // namespace 1058 } // namespace
1030 } // namespace cc 1059 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698