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

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

Issue 2490773002: cc : Set 'needs update' on transform tree only when something changes (Closed)
Patch Set: unittest 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 expected.Translate(-2, -2); 409 expected.Translate(-2, -2);
410 bool success = tree.CombineInversesBetween(0, 1, &transform); 410 bool success = tree.CombineInversesBetween(0, 1, &transform);
411 EXPECT_TRUE(success); 411 EXPECT_TRUE(success);
412 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); 412 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform);
413 } 413 }
414 }; 414 };
415 415
416 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( 416 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(
417 PropertyTreeTestComputeTransformRoot); 417 PropertyTreeTestComputeTransformRoot);
418 418
419 class PropertyTreeTestSetNeedsUpdate : public PropertyTreeTest {
420 protected:
421 void StartTest() override {
422 PropertyTrees property_trees;
423 TransformTree& tree = property_trees.transform_tree;
424 TransformNode contents_root;
425 contents_root.source_node_id = 0;
426 contents_root.id = tree.Insert(contents_root, 0);
427 tree.SetTargetId(contents_root.id, 0);
428 SetupTransformTreeForTest(&tree);
429
430 EXPECT_FALSE(tree.needs_update());
431 tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform(), gfx::PointF());
432 EXPECT_TRUE(tree.needs_update());
433 tree.set_needs_update(false);
434 tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform(), gfx::PointF());
435 EXPECT_FALSE(tree.needs_update());
436 }
437 };
438
439 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(PropertyTreeTestSetNeedsUpdate);
440
419 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest { 441 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest {
420 protected: 442 protected:
421 void StartTest() override { 443 void StartTest() override {
422 PropertyTrees property_trees; 444 PropertyTrees property_trees;
423 TransformTree& tree = property_trees.transform_tree; 445 TransformTree& tree = property_trees.transform_tree;
424 TransformNode contents_root; 446 TransformNode contents_root;
425 contents_root.local.Translate(2, 2); 447 contents_root.local.Translate(2, 2);
426 contents_root.source_node_id = 0; 448 contents_root.source_node_id = 0;
427 contents_root.id = tree.Insert(contents_root, 0); 449 contents_root.id = tree.Insert(contents_root, 0);
428 tree.SetTargetId(contents_root.id, 0); 450 tree.SetTargetId(contents_root.id, 0);
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 1040
1019 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( 1041 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(
1020 PropertyTreeTestSingularTransformSnapTest); 1042 PropertyTreeTestSingularTransformSnapTest);
1021 1043
1022 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F 1044 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F
1023 #undef SERIALIZED_PROPERTY_TREE_TEST_F 1045 #undef SERIALIZED_PROPERTY_TREE_TEST_F
1024 #undef DIRECT_PROPERTY_TREE_TEST_F 1046 #undef DIRECT_PROPERTY_TREE_TEST_F
1025 1047
1026 } // namespace 1048 } // namespace
1027 } // namespace cc 1049 } // 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