| Index: cc/output/filter_operations_unittest.cc
|
| diff --git a/cc/output/filter_operations_unittest.cc b/cc/output/filter_operations_unittest.cc
|
| index 64c127c29f2891c032efc6be41fa6045b1f2da25..aaf40b90fe519cacaae0a3b27ab73959331d9b1f 100644
|
| --- a/cc/output/filter_operations_unittest.cc
|
| +++ b/cc/output/filter_operations_unittest.cc
|
| @@ -34,6 +34,13 @@ TEST(FilterOperationsTest, MapRectBlur) {
|
| ops.MapRect(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| }
|
|
|
| +TEST(FilterOperationsTest, MapRectReverseBlur) {
|
| + FilterOperations ops;
|
| + ops.Append(FilterOperation::CreateBlurFilter(20));
|
| + EXPECT_EQ(gfx::Rect(-60, -60, 130, 130),
|
| + ops.MapRectReverse(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| +}
|
| +
|
| TEST(FilterOperationsTest, GetOutsetsDropShadowReferenceFilter) {
|
| // TODO(hendrikw): We need to make outsets for reference filters be in line
|
| // with non-reference filters. See crbug.com/523534
|
| @@ -66,6 +73,18 @@ TEST(FilterOperationsTest, MapRectDropShadowReferenceFilter) {
|
| ops.MapRect(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| }
|
|
|
| +TEST(FilterOperationsTest, MapRectReverseDropShadowReferenceFilter) {
|
| + FilterOperations ops;
|
| + ops.Append(
|
| + FilterOperation::CreateReferenceFilter(SkDropShadowImageFilter::Make(
|
| + SkIntToScalar(3), SkIntToScalar(8), SkIntToScalar(4),
|
| + SkIntToScalar(9), SK_ColorBLACK,
|
| + SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode,
|
| + nullptr)));
|
| + EXPECT_EQ(gfx::Rect(-15, -35, 34, 64),
|
| + ops.MapRectReverse(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| +}
|
| +
|
| TEST(FilterOperationsTest, MapRectOffsetReferenceFilter) {
|
| sk_sp<SkImageFilter> filter = SkOffsetImageFilter::Make(30, 40, nullptr);
|
| FilterOperations ops;
|
| @@ -74,6 +93,14 @@ TEST(FilterOperationsTest, MapRectOffsetReferenceFilter) {
|
| ops.MapRect(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| }
|
|
|
| +TEST(FilterOperationsTest, MapRectReverseOffsetReferenceFilter) {
|
| + sk_sp<SkImageFilter> filter = SkOffsetImageFilter::Make(30, 40, nullptr);
|
| + FilterOperations ops;
|
| + ops.Append(FilterOperation::CreateReferenceFilter(std::move(filter)));
|
| + EXPECT_EQ(gfx::Rect(-30, -40, 10, 10),
|
| + ops.MapRectReverse(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| +}
|
| +
|
| TEST(FilterOperationsTest, GetOutsetsNullReferenceFilter) {
|
| FilterOperations ops;
|
| ops.Append(FilterOperation::CreateReferenceFilter(nullptr));
|
| @@ -94,6 +121,13 @@ TEST(FilterOperationsTest, MapRectNullReferenceFilter) {
|
| ops.MapRect(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| }
|
|
|
| +TEST(FilterOperationsTest, MapRectReverseNullReferenceFilter) {
|
| + FilterOperations ops;
|
| + ops.Append(FilterOperation::CreateReferenceFilter(nullptr));
|
| + EXPECT_EQ(gfx::Rect(0, 0, 10, 10),
|
| + ops.MapRectReverse(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| +}
|
| +
|
| TEST(FilterOperationsTest, GetOutsetsDropShadow) {
|
| FilterOperations ops;
|
| ops.Append(FilterOperation::CreateDropShadowFilter(gfx::Point(3, 8), 20, 0));
|
| @@ -113,6 +147,13 @@ TEST(FilterOperationsTest, MapRectDropShadow) {
|
| ops.MapRect(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| }
|
|
|
| +TEST(FilterOperationsTest, MapRectReverseDropShadow) {
|
| + FilterOperations ops;
|
| + ops.Append(FilterOperation::CreateDropShadowFilter(gfx::Point(3, 8), 20, 0));
|
| + EXPECT_EQ(gfx::Rect(-63, -68, 130, 130),
|
| + ops.MapRectReverse(gfx::Rect(0, 0, 10, 10), SkMatrix::I()));
|
| +}
|
| +
|
| #define SAVE_RESTORE_AMOUNT(filter_name, filter_type, a) \
|
| { \
|
| FilterOperation op = FilterOperation::Create##filter_name##Filter(a); \
|
|
|