Test mandelbrot with bad arguments

This commit is contained in:
hugovk 2014-09-02 16:39:35 +03:00
parent ed85a03db0
commit 3a9612af50
2 changed files with 15 additions and 2 deletions

View File

@ -155,6 +155,19 @@ class TestImage(PillowTestCase):
im2 = Image.open('Tests/images/effect_mandelbrot.png') im2 = Image.open('Tests/images/effect_mandelbrot.png')
self.assert_image_equal(im, im2) self.assert_image_equal(im, im2)
def test_effect_mandelbrot_bad_arguments(self):
# Arrange
size = (512, 512)
# Get coordinates the wrong way round:
extent = (+3, +2.5, -2, -2.5)
# Quality < 2:
quality = 1
# Act/Assert
self.assertRaises(
ValueError,
lambda: Image.effect_mandelbrot(size, extent, quality))
@unittest.skipUnless(sys.platform.startswith('win32'), @unittest.skipUnless(sys.platform.startswith('win32'),
"Stalls on Travis CI, passes on Windows") "Stalls on Travis CI, passes on Windows")
def test_effect_noise(self): def test_effect_noise(self):

View File

@ -139,9 +139,9 @@ ImagingEffectSpread(Imaging imIn, int distance)
} }
if (imIn->image8) { if (imIn->image8) {
SPREAD(UINT8, image8); SPREAD(UINT8, image8);
} else { } else {
SPREAD(INT32, image32); SPREAD(INT32, image32);
} }
ImagingCopyInfo(imOut, imIn); ImagingCopyInfo(imOut, imIn);