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

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

Issue 2105743006: cc : Use EXPECT_TRANSFORMATION_MATRIX_EQ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/cc_unittests.gtest-drmemory_win32.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "cc/animation/animation_curve.h" 9 #include "cc/animation/animation_curve.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 Animation* animation = player_impl->element_animations()->GetAnimation( 1195 Animation* animation = player_impl->element_animations()->GetAnimation(
1196 TargetProperty::TRANSFORM); 1196 TargetProperty::TRANSFORM);
1197 1197
1198 // The animation should be starting for the first frame. 1198 // The animation should be starting for the first frame.
1199 EXPECT_EQ(Animation::STARTING, animation->run_state()); 1199 EXPECT_EQ(Animation::STARTING, animation->run_state());
1200 1200
1201 // And the transform should be propogated to the sync tree layer, at its 1201 // And the transform should be propogated to the sync tree layer, at its
1202 // starting state which is 6,7. 1202 // starting state which is 6,7.
1203 gfx::Transform expected_transform; 1203 gfx::Transform expected_transform;
1204 expected_transform.Translate(6.0, 7.0); 1204 expected_transform.Translate(6.0, 7.0);
1205 EXPECT_EQ(expected_transform, child->DrawTransform()); 1205 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, child->DrawTransform());
1206 // And the sync tree layer should know it is animating. 1206 // And the sync tree layer should know it is animating.
1207 EXPECT_TRUE(child->screen_space_transform_is_animating()); 1207 EXPECT_TRUE(child->screen_space_transform_is_animating());
1208 1208
1209 player_impl->element_animations()->AbortAnimations( 1209 player_impl->element_animations()->AbortAnimations(
1210 TargetProperty::TRANSFORM); 1210 TargetProperty::TRANSFORM);
1211 EndTest(); 1211 EndTest();
1212 } 1212 }
1213 1213
1214 void AfterTest() override {} 1214 void AfterTest() override {}
1215 1215
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 break; 1422 break;
1423 case 1: 1423 case 1:
1424 // Animation is started. 1424 // Animation is started.
1425 EXPECT_TRUE(child->screen_space_transform_is_animating()); 1425 EXPECT_TRUE(child->screen_space_transform_is_animating());
1426 break; 1426 break;
1427 case 2: { 1427 case 2: {
1428 // The animation is removed, the transform that was set afterward is 1428 // The animation is removed, the transform that was set afterward is
1429 // applied. 1429 // applied.
1430 gfx::Transform expected_transform; 1430 gfx::Transform expected_transform;
1431 expected_transform.Translate(10.f, 10.f); 1431 expected_transform.Translate(10.f, 10.f);
1432 EXPECT_EQ(expected_transform, child->DrawTransform()); 1432 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform,
1433 child->DrawTransform());
1433 EXPECT_FALSE(child->screen_space_transform_is_animating()); 1434 EXPECT_FALSE(child->screen_space_transform_is_animating());
1434 EndTest(); 1435 EndTest();
1435 break; 1436 break;
1436 } 1437 }
1437 default: 1438 default:
1438 NOTREACHED(); 1439 NOTREACHED();
1439 } 1440 }
1440 } 1441 }
1441 1442
1442 void AfterTest() override {} 1443 void AfterTest() override {}
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 1566
1566 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 1567 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
1567 switch (host_impl->sync_tree()->source_frame_number()) { 1568 switch (host_impl->sync_tree()->source_frame_number()) {
1568 case 1: 1569 case 1:
1569 PostSetNeedsCommitToMainThread(); 1570 PostSetNeedsCommitToMainThread();
1570 break; 1571 break;
1571 case 2: 1572 case 2:
1572 gfx::Transform expected_transform; 1573 gfx::Transform expected_transform;
1573 expected_transform.Translate(5.f, 5.f); 1574 expected_transform.Translate(5.f, 5.f);
1574 LayerImpl* layer_impl = host_impl->sync_tree()->LayerById(layer_->id()); 1575 LayerImpl* layer_impl = host_impl->sync_tree()->LayerById(layer_->id());
1575 EXPECT_EQ(expected_transform, layer_impl->DrawTransform()); 1576 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform,
1577 layer_impl->DrawTransform());
1576 EndTest(); 1578 EndTest();
1577 break; 1579 break;
1578 } 1580 }
1579 } 1581 }
1580 1582
1581 void UpdateAnimationState(LayerTreeHostImpl* host_impl, 1583 void UpdateAnimationState(LayerTreeHostImpl* host_impl,
1582 bool has_unfinished_animation) override { 1584 bool has_unfinished_animation) override {
1583 if (host_impl->active_tree()->source_frame_number() == 1 && 1585 if (host_impl->active_tree()->source_frame_number() == 1 &&
1584 !has_unfinished_animation && !signalled_) { 1586 !has_unfinished_animation && !signalled_) {
1585 // The animation has finished, so allow the main thread to commit. 1587 // The animation has finished, so allow the main thread to commit.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 1679 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
1678 PropertyTrees* property_trees = host_impl->sync_tree()->property_trees(); 1680 PropertyTrees* property_trees = host_impl->sync_tree()->property_trees();
1679 TransformNode* node = 1681 TransformNode* node =
1680 property_trees->transform_tree.Node(host_impl->sync_tree() 1682 property_trees->transform_tree.Node(host_impl->sync_tree()
1681 ->root_layer_for_testing() 1683 ->root_layer_for_testing()
1682 ->transform_tree_index()); 1684 ->transform_tree_index());
1683 gfx::Transform translate; 1685 gfx::Transform translate;
1684 translate.Translate(5, 5); 1686 translate.Translate(5, 5);
1685 switch (host_impl->sync_tree()->source_frame_number()) { 1687 switch (host_impl->sync_tree()->source_frame_number()) {
1686 case 2: 1688 case 2:
1687 EXPECT_EQ(node->data.local, translate); 1689 EXPECT_TRANSFORMATION_MATRIX_EQ(node->data.local, translate);
1688 EndTest(); 1690 EndTest();
1689 break; 1691 break;
1690 default: 1692 default:
1691 break; 1693 break;
1692 } 1694 }
1693 } 1695 }
1694 1696
1695 void DidCommit() override { PostSetNeedsCommitToMainThread(); } 1697 void DidCommit() override { PostSetNeedsCommitToMainThread(); }
1696 1698
1697 void WillBeginMainFrame() override { 1699 void WillBeginMainFrame() override {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 private: 1844 private:
1843 scoped_refptr<Layer> layer_; 1845 scoped_refptr<Layer> layer_;
1844 FakeContentLayerClient client_; 1846 FakeContentLayerClient client_;
1845 }; 1847 };
1846 1848
1847 MULTI_THREAD_TEST_F( 1849 MULTI_THREAD_TEST_F(
1848 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); 1850 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit);
1849 1851
1850 } // namespace 1852 } // namespace
1851 } // namespace cc 1853 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/cc_unittests.gtest-drmemory_win32.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698