Chromium Code Reviews| Index: cc/output/filter_operations_unittest.cc |
| diff --git a/cc/output/filter_operations_unittest.cc b/cc/output/filter_operations_unittest.cc |
| index dbf3736ccb0b62b7d986b2336dc4c0665e9ac281..daca97b0e6c8df806295e51e3a9e78516771bbc8 100644 |
| --- a/cc/output/filter_operations_unittest.cc |
| +++ b/cc/output/filter_operations_unittest.cc |
| @@ -3,7 +3,9 @@ |
| // found in the LICENSE file. |
| #include "cc/output/filter_operations.h" |
| +#include "skia/ext/refptr.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +#include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| #include "ui/gfx/point.h" |
| namespace cc { |
| @@ -497,6 +499,43 @@ TEST(FilterOperationsTest, BlendSaturatingBrightnessWithNull) { |
| EXPECT_EQ(expected, blended); |
| } |
| +TEST(FilterOperationsTest, BlendReferenceFilters) { |
| + skia::RefPtr<SkImageFilter> from_filter = skia::AdoptRef( |
| + new SkBlurImageFilter(1.f, 1.f)); |
| + skia::RefPtr<SkImageFilter> to_filter = skia::AdoptRef( |
| + new SkBlurImageFilter(2.f, 2.f)); |
| + FilterOperation from = FilterOperation::CreateReferenceFilter(from_filter); |
| + FilterOperation to = FilterOperation::CreateReferenceFilter(to_filter); |
| + |
| + FilterOperation blended = FilterOperation::Blend(&from, &to, -0.75); |
| + EXPECT_EQ(from, blended); |
| + |
| + blended = FilterOperation::Blend(&from, &to, 0.5); |
| + EXPECT_EQ(from, blended); |
| + |
| + blended = FilterOperation::Blend(&from, &to, 0.6); |
| + EXPECT_EQ(to, blended); |
| + |
| + blended = FilterOperation::Blend(&from, &to, 1.5); |
| + EXPECT_EQ(to, blended); |
| +} |
| + |
| +TEST(FilterOperationsTest, BlendReferenceWithNull) { |
| + skia::RefPtr<SkImageFilter> image_filter = skia::AdoptRef( |
| + new SkBlurImageFilter(1.f, 1.f)); |
| + FilterOperation filter = FilterOperation::CreateReferenceFilter(image_filter); |
|
danakj
2013/09/09 22:04:50
nit: s/filter/from/
ajuma
2013/09/10 21:17:58
This is used as the 'from' filter in the first two
|
| + |
| + FilterOperation blended = FilterOperation::Blend(&filter, NULL, 0.25); |
| + EXPECT_EQ(filter, blended); |
| + blended = FilterOperation::Blend(&filter, NULL, 0.75); |
| + EXPECT_EQ(FilterOperation::CreateEmptyFilter(), blended); |
| + |
| + blended = FilterOperation::Blend(NULL, &filter, 0.25); |
| + EXPECT_EQ(FilterOperation::CreateEmptyFilter(), blended); |
| + blended = FilterOperation::Blend(NULL, &filter, 0.75); |
| + EXPECT_EQ(filter, blended); |
| +} |
| + |
| // Tests blending non-empty sequences that have the same length and matching |
| // operations. |
| TEST(FilterOperationsTest, BlendMatchingSequences) { |