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

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

Issue 2493943003: TransformTree::SetRootTransformsAndScales should set 'needs_update' on transform tree only if we ar… (Closed)
Patch Set: 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
« no previous file with comments | « cc/trees/property_tree.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/clip_node.h" 10 #include "cc/trees/clip_node.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 expected.Translate(-2, -2); 414 expected.Translate(-2, -2);
415 success = tree.ComputeTransform(-1, 0, &transform); 415 success = tree.ComputeTransform(-1, 0, &transform);
416 EXPECT_TRUE(success); 416 EXPECT_TRUE(success);
417 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); 417 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform);
418 } 418 }
419 }; 419 };
420 420
421 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( 421 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(
422 PropertyTreeTestComputeTransformRoot); 422 PropertyTreeTestComputeTransformRoot);
423 423
424 class PropertyTreeTestSetNeedsUpdate : public PropertyTreeTest {
425 protected:
426 void StartTest() override {
427 PropertyTrees property_trees;
428 TransformTree& tree = property_trees.transform_tree;
429 TransformNode contents_root;
430 contents_root.source_node_id = 0;
431 contents_root.id = tree.Insert(contents_root, 0);
432 tree.SetTargetId(contents_root.id, 0);
433 SetupTransformTreeForTest(&tree);
434
435 EXPECT_FALSE(tree.needs_update());
436 tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform(), gfx::PointF());
437 EXPECT_TRUE(tree.needs_update());
438 tree.set_needs_update(false);
439 tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform(), gfx::PointF());
440 EXPECT_FALSE(tree.needs_update());
441 }
442 };
443
444 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(PropertyTreeTestSetNeedsUpdate);
445
424 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest { 446 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest {
425 protected: 447 protected:
426 void StartTest() override { 448 void StartTest() override {
427 PropertyTrees property_trees; 449 PropertyTrees property_trees;
428 TransformTree& tree = property_trees.transform_tree; 450 TransformTree& tree = property_trees.transform_tree;
429 TransformNode& root = *tree.Node(0); 451 TransformNode& root = *tree.Node(0);
430 root.local.Translate(2, 2); 452 root.local.Translate(2, 2);
431 tree.SetTargetId(root.id, 0); 453 tree.SetTargetId(root.id, 0);
432 tree.UpdateTransforms(0); 454 tree.UpdateTransforms(0);
433 455
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 1181
1160 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( 1182 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(
1161 PropertyTreeTestSingularTransformSnapTest); 1183 PropertyTreeTestSingularTransformSnapTest);
1162 1184
1163 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F 1185 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F
1164 #undef SERIALIZED_PROPERTY_TREE_TEST_F 1186 #undef SERIALIZED_PROPERTY_TREE_TEST_F
1165 #undef DIRECT_PROPERTY_TREE_TEST_F 1187 #undef DIRECT_PROPERTY_TREE_TEST_F
1166 1188
1167 } // namespace 1189 } // namespace
1168 } // namespace cc 1190 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698