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

Unified Diff: cc/resources/picture_layer_tiling_unittest.cc

Issue 1021663002: cc: Fix skewport math (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for empty viewport Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling_unittest.cc
diff --git a/cc/resources/picture_layer_tiling_unittest.cc b/cc/resources/picture_layer_tiling_unittest.cc
index 230e31dd1aa1fbd68575e478abad7259740e4848..5999ecd55e7b52b6005dc2faebb323de24e74a52 100644
--- a/cc/resources/picture_layer_tiling_unittest.cc
+++ b/cc/resources/picture_layer_tiling_unittest.cc
@@ -591,7 +591,7 @@ TEST(PictureLayerTilingTest, SkewportLimits) {
EXPECT_EQ(350, expand_skewport.height());
EXPECT_TRUE(expand_skewport.Contains(gfx::Rect(-50, -50, 200, 200)));
- // Expand the viewport past the limit.
+ // Expand the viewport past the limit in all directions.
gfx::Rect big_expand_skewport =
tiling->ComputeSkewport(1.5, gfx::Rect(-500, -500, 1500, 1500));
@@ -600,6 +600,23 @@ TEST(PictureLayerTilingTest, SkewportLimits) {
EXPECT_EQ(1650, big_expand_skewport.width());
EXPECT_EQ(1650, big_expand_skewport.height());
EXPECT_TRUE(big_expand_skewport.Contains(gfx::Rect(-500, -500, 1500, 1500)));
+
+ // Shrink the skewport in all directions.
+ gfx::Rect shrink_viewport =
+ tiling->ComputeSkewport(1.5, gfx::Rect(0, 0, 100, 100));
+ EXPECT_EQ(0, shrink_viewport.x());
+ EXPECT_EQ(0, shrink_viewport.y());
+ EXPECT_EQ(100, shrink_viewport.width());
+ EXPECT_EQ(100, shrink_viewport.height());
+
+ // Move the skewport really far in one direction.
+ gfx::Rect move_skewport_far =
+ tiling->ComputeSkewport(1.5, gfx::Rect(0, 5000, 100, 100));
+ EXPECT_EQ(0, move_skewport_far.x());
+ EXPECT_EQ(5000, move_skewport_far.y());
+ EXPECT_EQ(100, move_skewport_far.width());
+ EXPECT_EQ(175, move_skewport_far.height());
+ EXPECT_TRUE(move_skewport_far.Contains(gfx::Rect(0, 5000, 100, 100)));
}
TEST(PictureLayerTilingTest, ComputeSkewport) {
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698