mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +03:00
Merge pull request #91 from radarhere/invalid-box-blur-filter
This commit is contained in:
commit
d504d2a47e
|
@ -179,3 +179,9 @@ def test_consistency_5x5(mode):
|
||||||
def test_invalid_box_blur_filter():
|
def test_invalid_box_blur_filter():
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
ImageFilter.BoxBlur(-2)
|
ImageFilter.BoxBlur(-2)
|
||||||
|
|
||||||
|
im = hopper()
|
||||||
|
box_blur_filter = ImageFilter.BoxBlur(2)
|
||||||
|
box_blur_filter.radius = -2
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
im.filter(box_blur_filter)
|
||||||
|
|
|
@ -237,6 +237,9 @@ ImagingBoxBlur(Imaging imOut, Imaging imIn, float radius, int n) {
|
||||||
if (n < 1) {
|
if (n < 1) {
|
||||||
return ImagingError_ValueError("number of passes must be greater than zero");
|
return ImagingError_ValueError("number of passes must be greater than zero");
|
||||||
}
|
}
|
||||||
|
if (radius < 0) {
|
||||||
|
return ImagingError_ValueError("radius must be >= 0");
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(imIn->mode, imOut->mode) || imIn->type != imOut->type ||
|
if (strcmp(imIn->mode, imOut->mode) || imIn->type != imOut->type ||
|
||||||
imIn->bands != imOut->bands || imIn->xsize != imOut->xsize ||
|
imIn->bands != imOut->bands || imIn->xsize != imOut->xsize ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user