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

Side by Side Diff: cc/occlusion_tracker_unittest.cc

Issue 11293194: ui: Prefer +/- operators to apply offsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: floats Created 8 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/occlusion_tracker.h" 7 #include "cc/occlusion_tracker.h"
8 8
9 #include "cc/layer.h" 9 #include "cc/layer.h"
10 #include "cc/layer_animation_controller.h" 10 #include "cc/layer_animation_controller.h"
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); 898 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect());
899 899
900 this->visitLayer(layer, occlusion); 900 this->visitLayer(layer, occlusion);
901 this->enterContributingSurface(child, occlusion); 901 this->enterContributingSurface(child, occlusion);
902 902
903 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInScreenSpace().ToS tring()); 903 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInScreenSpace().ToS tring());
904 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusionInTargetSur face().ToString()); 904 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusionInTargetSur face().ToString());
905 905
906 EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild)); 906 EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild));
907 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInCh ild).IsEmpty()); 907 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInCh ild).IsEmpty());
908 clippedLayerInChild.Offset(-1, 0); 908 clippedLayerInChild += gfx::Vector2d(-1, 0);
909 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 909 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
910 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 910 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
911 clippedLayerInChild.Offset(1, 0); 911 clippedLayerInChild += gfx::Vector2d(1, 0);
912 clippedLayerInChild.Offset(1, 0); 912 clippedLayerInChild += gfx::Vector2d(1, 0);
913 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 913 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
914 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 914 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
915 clippedLayerInChild.Offset(-1, 0); 915 clippedLayerInChild += gfx::Vector2d(-1, 0);
916 clippedLayerInChild.Offset(0, -1); 916 clippedLayerInChild += gfx::Vector2d(0, -1);
917 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 917 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
918 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 918 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
919 clippedLayerInChild.Offset(0, 1); 919 clippedLayerInChild += gfx::Vector2d(0, 1);
920 clippedLayerInChild.Offset(0, 1); 920 clippedLayerInChild += gfx::Vector2d(0, 1);
921 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild)); 921 EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
922 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty()); 922 EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInC hild).IsEmpty());
923 clippedLayerInChild.Offset(0, -1); 923 clippedLayerInChild += gfx::Vector2d(0, -1);
924 924
925 this->leaveContributingSurface(child, occlusion); 925 this->leaveContributingSurface(child, occlusion);
926 this->enterLayer(parent, occlusion); 926 this->enterLayer(parent, occlusion);
927 927
928 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInScreenSpace().ToS tring()); 928 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInScreenSpace().ToS tring());
929 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString()); 929 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T oString());
930 930
931 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1))); 931 EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1)));
932 EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContent Rect(parent, gfx::Rect(75, 55, 1, 1))); 932 EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContent Rect(parent, gfx::Rect(75, 55, 1, 1)));
933 } 933 }
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 this->visitLayer(large, occlusion); 3073 this->visitLayer(large, occlusion);
3074 3074
3075 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInScreenSpace().ToString()); 3075 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInScreenSpace().ToString());
3076 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInTargetSurface().ToString()); 3076 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInTargetSurface().ToString());
3077 } 3077 }
3078 }; 3078 };
3079 3079
3080 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); 3080 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize);
3081 3081
3082 } // anonymous namespace 3082 } // anonymous namespace
OLDNEW
« .gitmodules ('K') | « cc/math_util.cc ('k') | cc/page_scale_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698