| Index: cc/trees/occlusion_unittest.cc
|
| diff --git a/cc/trees/occlusion_unittest.cc b/cc/trees/occlusion_unittest.cc
|
| index da2f6fd0b6ebece769eac89ba4e74ffdbc70d8bc..caaaa506c5b1275527c572d5207efd6d711deab7 100644
|
| --- a/cc/trees/occlusion_unittest.cc
|
| +++ b/cc/trees/occlusion_unittest.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <stddef.h>
|
|
|
| +#include "cc/base/region.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace cc {
|
| @@ -270,5 +271,49 @@ TEST(OcclusionTest, GetUnoccludedContentRectTranslated) {
|
| EXPECT_EQ(gfx::Rect(10, 0, 10, 10), half_query_result_down);
|
| }
|
|
|
| +TEST(OcclusionTest, OccludeContentRegionScaled) {
|
| + gfx::Transform half_scale;
|
| + half_scale.Scale(0.5, 0.5);
|
| +
|
| + gfx::Transform double_scale;
|
| + double_scale.Scale(2, 2);
|
| +
|
| + Occlusion some_occluded_half(half_scale, SimpleEnclosedRegion(5, 5),
|
| + SimpleEnclosedRegion(5, 5, 5, 5));
|
| + Occlusion some_occluded_double(double_scale, SimpleEnclosedRegion(20, 20),
|
| + SimpleEnclosedRegion(19, 20, 21, 20));
|
| +
|
| + Region region_half(gfx::Rect(5, 0, 15, 20));
|
| + some_occluded_half.OccludeContentRegion(®ion_half);
|
| +
|
| + Region result_region;
|
| + // Top right and bottom left rectangles should remain.
|
| + result_region.Union(gfx::Rect(10, 0, 10, 10));
|
| + result_region.Union(gfx::Rect(5, 10, 5, 10));
|
| + EXPECT_EQ(result_region.ToString(), region_half.ToString());
|
| +
|
| + // The result should be the same as above, as the additional half-pixel
|
| + // occlusion should be ignored.
|
| + Region region_double(gfx::Rect(5, 0, 15, 20));
|
| + some_occluded_double.OccludeContentRegion(®ion_double);
|
| + EXPECT_EQ(result_region.ToString(), region_double.ToString());
|
| +}
|
| +
|
| +TEST(OcclusionTest, OccludeContentRegionRotate) {
|
| + gfx::Transform rotate_transform;
|
| + // Extremely small rotation.
|
| + rotate_transform.Rotate(1);
|
| +
|
| + Occlusion occlusion(rotate_transform, SimpleEnclosedRegion(10, 10),
|
| + SimpleEnclosedRegion(10, 10, 10, 10));
|
| +
|
| + Region region(gfx::Rect(1, 1, 1, 1));
|
| + Region occluded_region(region);
|
| + occlusion.OccludeContentRegion(&occluded_region);
|
| +
|
| + // Transform isn't axis-aligned, so no occlusion should be done.
|
| + EXPECT_EQ(region.ToString(), occluded_region.ToString());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|