mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
actually box can be empty, this is noop
This commit is contained in:
parent
09a2e1641b
commit
79eae6e3bf
|
@ -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))
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user