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

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

Issue 2105673003: cc: Compute animation scale on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error Created 4 years, 5 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 unified diff | Download patch
« cc/trees/property_tree.cc ('K') | « cc/trees/property_tree_builder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/input/main_thread_scrolling_reason.h" 7 #include "cc/input/main_thread_scrolling_reason.h"
8 #include "cc/proto/property_tree.pb.h" 8 #include "cc/proto/property_tree.pb.h"
9 #include "cc/test/geometry_test_utils.h" 9 #include "cc/test/geometry_test_utils.h"
10 #include "cc/trees/draw_property_utils.h" 10 #include "cc/trees/draw_property_utils.h"
(...skipping 20 matching lines...) Expand all
31 original.node_and_ancestors_are_flat = false; 31 original.node_and_ancestors_are_flat = false;
32 original.node_and_ancestors_have_only_integer_translation = false; 32 original.node_and_ancestors_have_only_integer_translation = false;
33 original.scrolls = false; 33 original.scrolls = false;
34 original.needs_sublayer_scale = false; 34 original.needs_sublayer_scale = false;
35 original.affected_by_inner_viewport_bounds_delta_x = false; 35 original.affected_by_inner_viewport_bounds_delta_x = false;
36 original.affected_by_inner_viewport_bounds_delta_y = false; 36 original.affected_by_inner_viewport_bounds_delta_y = false;
37 original.affected_by_outer_viewport_bounds_delta_x = false; 37 original.affected_by_outer_viewport_bounds_delta_x = false;
38 original.affected_by_outer_viewport_bounds_delta_y = false; 38 original.affected_by_outer_viewport_bounds_delta_y = false;
39 original.in_subtree_of_page_scale_layer = false; 39 original.in_subtree_of_page_scale_layer = false;
40 original.post_local_scale_factor = 0.5f; 40 original.post_local_scale_factor = 0.5f;
41 original.local_maximum_animation_target_scale = 0.6f;
42 original.local_starting_animation_scale = 0.7f;
43 original.combined_maximum_animation_target_scale = 0.8f;
44 original.combined_starting_animation_scale = 0.9f;
45 original.sublayer_scale = gfx::Vector2dF(0.5f, 0.5f); 41 original.sublayer_scale = gfx::Vector2dF(0.5f, 0.5f);
46 original.scroll_offset = gfx::ScrollOffset(1.5f, 1.5f); 42 original.scroll_offset = gfx::ScrollOffset(1.5f, 1.5f);
47 original.scroll_snap = gfx::Vector2dF(0.4f, 0.4f); 43 original.scroll_snap = gfx::Vector2dF(0.4f, 0.4f);
48 original.source_offset = gfx::Vector2dF(2.5f, 2.4f); 44 original.source_offset = gfx::Vector2dF(2.5f, 2.4f);
49 original.source_to_parent = gfx::Vector2dF(3.2f, 3.2f); 45 original.source_to_parent = gfx::Vector2dF(3.2f, 3.2f);
50 46
51 proto::TreeNode proto; 47 proto::TreeNode proto;
52 original.ToProtobuf(&proto); 48 original.ToProtobuf(&proto);
53 TransformNodeData result; 49 TransformNodeData result;
54 result.FromProtobuf(proto); 50 result.FromProtobuf(proto);
55 51
56 EXPECT_EQ(original, result); 52 EXPECT_EQ(original, result);
57 } 53 }
58 54
59 TEST(PropertyTreeSerializationTest, TransformNodeSerialization) { 55 TEST(PropertyTreeSerializationTest, TransformNodeSerialization) {
60 TransformNode original; 56 TransformNode original;
61 original.id = 3; 57 original.id = 3;
62 original.parent_id = 2; 58 original.parent_id = 2;
63 original.owner_id = 4; 59 original.owner_id = 4;
64 60
65 proto::TreeNode proto; 61 proto::TreeNode proto;
66 original.ToProtobuf(&proto); 62 original.ToProtobuf(&proto);
67 TransformNode result; 63 TransformNode result;
68 result.FromProtobuf(proto); 64 result.FromProtobuf(proto);
69 65
70 EXPECT_EQ(original, result); 66 EXPECT_EQ(original, result);
71 } 67 }
72 68
73 TEST(PropertyTreeSerializationTest, TransformTreeSerialization) { 69 TEST(PropertyTreeSerializationTest, TransformTreeSerialization) {
74 TransformTree original; 70 PropertyTrees property_trees;
71 TransformTree original = property_trees.transform_tree;
75 TransformNode& root = *original.Node(0); 72 TransformNode& root = *original.Node(0);
76 root.id = 0; 73 root.id = 0;
77 root.owner_id = 1; 74 root.owner_id = 1;
78 original.SetTargetId(root.id, 3); 75 original.SetTargetId(root.id, 3);
79 original.SetContentTargetId(root.id, 4); 76 original.SetContentTargetId(root.id, 4);
80 TransformNode second; 77 TransformNode second;
81 second.owner_id = 2; 78 second.owner_id = 2;
82 second.data.local.Translate3d(2.f, 2.f, 0.f); 79 second.data.local.Translate3d(2.f, 2.f, 0.f);
83 second.data.source_node_id = 0; 80 second.data.source_node_id = 0;
84 second.id = original.Insert(second, 0); 81 second.id = original.Insert(second, 0);
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1152
1156 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( 1153 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(
1157 PropertyTreeTestSingularTransformSnapTest); 1154 PropertyTreeTestSingularTransformSnapTest);
1158 1155
1159 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F 1156 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F
1160 #undef SERIALIZED_PROPERTY_TREE_TEST_F 1157 #undef SERIALIZED_PROPERTY_TREE_TEST_F
1161 #undef DIRECT_PROPERTY_TREE_TEST_F 1158 #undef DIRECT_PROPERTY_TREE_TEST_F
1162 1159
1163 } // namespace 1160 } // namespace
1164 } // namespace cc 1161 } // namespace cc
OLDNEW
« cc/trees/property_tree.cc ('K') | « cc/trees/property_tree_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698