Chromium Code Reviews| 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 91043e67b48006e13d72f42781c97fd55828fcdb..65205f0be08ed2ee43b7a5109b807311adacb951 100644 |
| --- a/cc/resources/picture_layer_tiling_unittest.cc |
| +++ b/cc/resources/picture_layer_tiling_unittest.cc |
| @@ -21,9 +21,22 @@ class PictureLayerTilingIteratorTest : public testing::Test { |
| float contents_scale, |
| gfx::Size layer_bounds) { |
| client_.SetTileSize(tile_size); |
| - tiling_ = PictureLayerTiling::Create(contents_scale); |
| - tiling_->SetClient(&client_); |
| - tiling_->SetLayerBounds(layer_bounds); |
| + tiling_ = PictureLayerTiling::Create(contents_scale, |
| + layer_bounds, |
| + &client_); |
| + } |
| + |
| + void VerifyTilesExistOnlyInLiveRect(gfx::Rect live_tiles_rect) { |
|
enne (OOO)
2013/04/10 20:25:30
This function is named oddly. Maybe SetLiveRectAn
whunt
2013/04/10 20:52:30
sure.
|
| + |
| + tiling_->SetLiveTilesRect(live_tiles_rect); |
| + for (TilingData::Iterator iter(&tiling_->tiling_data(), |
|
enne (OOO)
2013/04/10 20:25:30
Shouldn't you iterate over all tiles and not just
whunt
2013/04/10 20:52:30
Yes, it should be iterating over the content rect,
enne (OOO)
2013/04/10 21:21:24
No, it's more than that. I'm saying that you need
|
| + live_tiles_rect); |
| + iter; |
| + ++iter) { |
| + Tile* tile = tiling_->TileAt(iter.index_x(), iter.index_y()); |
| + EXPECT_EQ(tile != NULL, |
| + live_tiles_rect.Intersects(tile->content_rect())); |
| + } |
| } |
| void VerifyTilesExactlyCoverRect( |
| @@ -83,6 +96,16 @@ class PictureLayerTilingIteratorTest : public testing::Test { |
| DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest); |
| }; |
| +TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) { |
| + Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801)); |
| + VerifyTilesExistOnlyInLiveRect(gfx::Rect(100, 100)); |
| + VerifyTilesExistOnlyInLiveRect(gfx::Rect(101, 99)); |
| + VerifyTilesExistOnlyInLiveRect(gfx::Rect(1099, 1)); |
| + VerifyTilesExistOnlyInLiveRect(gfx::Rect(1, 801)); |
| + VerifyTilesExistOnlyInLiveRect(gfx::Rect(1099, 1)); |
| + VerifyTilesExistOnlyInLiveRect(gfx::Rect(201, 800)); |
| +} |
| + |
| TEST_F(PictureLayerTilingIteratorTest, IteratorCoversLayerBoundsNoScale) { |
| Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801)); |
| VerifyTilesExactlyCoverRect(1, gfx::Rect()); |