Index: tests/ImageFilterTest.cpp |
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp |
index 97d3d0fbfb353210d2a1d7663e06759a589174ae..993a1e2f2bfde470323d6681d2ce0fd2c20ab751 100644 |
--- a/tests/ImageFilterTest.cpp |
+++ b/tests/ImageFilterTest.cpp |
@@ -295,6 +295,29 @@ DEF_TEST(ImageFilterMatrixTest, reporter) { |
canvas.drawPicture(picture); |
} |
+void test_huge_blur(SkBaseDevice* device, skiatest::Reporter* reporter) { |
+ SkCanvas canvas(device); |
+ |
+ SkBitmap bitmap; |
+ bitmap.allocN32Pixels(100, 100); |
+ bitmap.eraseARGB(0, 0, 0, 0); |
+ |
+ // Check that a blur with an insane radius does not crash or assert. |
+ SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(SkIntToScalar(1<<30), SkIntToScalar(1<<30))); |
+ |
+ SkPaint paint; |
+ paint.setImageFilter(blur); |
+ canvas.drawSprite(bitmap, 0, 0, &paint); |
+} |
+ |
+DEF_TEST(HugeBlurImageFilter, reporter) { |
+ SkBitmap temp; |
+ temp.allocN32Pixels(100, 100); |
+ SkBitmapDevice device(temp); |
+ test_huge_blur(&device, reporter); |
+} |
+ |
+ |
#if SK_SUPPORT_GPU |
DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { |
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0)); |
@@ -303,4 +326,12 @@ DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { |
0)); |
test_crop_rects(device, reporter); |
} |
+ |
+DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) { |
+ GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0)); |
+ SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
+ SkImageInfo::MakeN32Premul(100, 100), |
+ 0)); |
+ test_huge_blur(device, reporter); |
+} |
#endif |