Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: tests/ImageFilterTest.cpp

Issue 612483005: Port of https://skia.googlesource.com/skia.git/+/3a49520696b2eca69e57884657d23fd2402ccfd1 to M38 br… (Closed) Base URL: https://skia.googlesource.com/skia.git@m38_2125
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 9f6144bf29132b8cebdd7c9a3e0eeba104c4a188..8767ff2047fe9019fe2ed60822e3907d5ec0f97a 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -774,6 +774,60 @@ DEF_TEST(HugeBlurImageFilter, reporter) {
test_huge_blur(&device, reporter);
}
+DEF_TEST(MatrixConvolutionSanityTest, reporter) {
+ SkScalar kernel[1] = { 0 };
+ SkScalar gain = SK_Scalar1, bias = 0;
+ SkIPoint kernelOffset = SkIPoint::Make(1, 1);
+
+ // Check that an enormous (non-allocatable) kernel gives a NULL filter.
+ SkAutoTUnref<SkImageFilter> conv(SkMatrixConvolutionImageFilter::Create(
+ SkISize::Make(1<<30, 1<<30),
+ kernel,
+ gain,
+ bias,
+ kernelOffset,
+ SkMatrixConvolutionImageFilter::kRepeat_TileMode,
+ false));
+
+ REPORTER_ASSERT(reporter, NULL == conv.get());
+
+ // Check that a NULL kernel gives a NULL filter.
+ conv.reset(SkMatrixConvolutionImageFilter::Create(
+ SkISize::Make(1, 1),
+ NULL,
+ gain,
+ bias,
+ kernelOffset,
+ SkMatrixConvolutionImageFilter::kRepeat_TileMode,
+ false));
+
+ REPORTER_ASSERT(reporter, NULL == conv.get());
+
+ // Check that a kernel width < 1 gives a NULL filter.
+ conv.reset(SkMatrixConvolutionImageFilter::Create(
+ SkISize::Make(0, 1),
+ kernel,
+ gain,
+ bias,
+ kernelOffset,
+ SkMatrixConvolutionImageFilter::kRepeat_TileMode,
+ false));
+
+ REPORTER_ASSERT(reporter, NULL == conv.get());
+
+ // Check that kernel height < 1 gives a NULL filter.
+ conv.reset(SkMatrixConvolutionImageFilter::Create(
+ SkISize::Make(1, -1),
+ kernel,
+ gain,
+ bias,
+ kernelOffset,
+ SkMatrixConvolutionImageFilter::kRepeat_TileMode,
+ false));
+
+ REPORTER_ASSERT(reporter, NULL == conv.get());
+}
+
static void test_xfermode_cropped_input(SkBaseDevice* device, skiatest::Reporter* reporter) {
SkCanvas canvas(device);
canvas.clear(0);
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698