actually box can be empty, this is noop

This commit is contained in:
Alexander 2017-08-11 19:36:46 +03:00
parent 09a2e1641b
commit 79eae6e3bf
2 changed files with 6 additions and 6 deletions

View File

@ -379,6 +379,8 @@ class CoreResampleBoxTest(PillowTestCase):
Image.BICUBIC, Image.LANCZOS):
im.resize((32, 32), resample, (0, 0, im.width, im.height))
im.resize((32, 32), resample, (20, 20, im.width, im.height))
im.resize((32, 32), resample, (20, 20, 20, 100))
im.resize((32, 32), resample, (20, 20, 100, 20))
with self.assertRaisesRegexp(TypeError, "must be sequence of length 4"):
im.resize((32, 32), resample, (im.width, im.height))
@ -389,13 +391,11 @@ class CoreResampleBoxTest(PillowTestCase):
im.resize((32, 32), resample, (20, -20, 100, 100))
with self.assertRaisesRegexp(ValueError, "can't be empty"):
im.resize((32, 32), resample, (20, 20, 20, 100))
im.resize((32, 32), resample, (20.1, 20, 20, 100))
with self.assertRaisesRegexp(ValueError, "can't be empty"):
im.resize((32, 32), resample, (100, 20, 20, 100))
im.resize((32, 32), resample, (20, 20.1, 100, 20))
with self.assertRaisesRegexp(ValueError, "can't be empty"):
im.resize((32, 32), resample, (20, 20, 100, 20))
with self.assertRaisesRegexp(ValueError, "can't be empty"):
im.resize((32, 32), resample, (20, 100, 100, 20))
im.resize((32, 32), resample, (20.1, 20.1, 20, 20))
with self.assertRaisesRegexp(ValueError, "can't exceed"):
im.resize((32, 32), resample, (0, 0, im.width + 1, im.height))

View File

@ -1542,7 +1542,7 @@ _resize(ImagingObject* self, PyObject* args)
return ImagingError_ValueError("box can't exceed original image size");
}
if (box[2] - box[0] <= 0 || box[3] - box[1] <= 0) {
if (box[2] - box[0] < 0 || box[3] - box[1] < 0) {
return ImagingError_ValueError("box can't be empty");
}