mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Image.core.open_ppm has been removed. Test the Storage.c fix with an alternate method. Assert that the ordinary opener rejects the negative size in the PPM file
This commit is contained in:
parent
445451c0b9
commit
b3ad80a2bd
|
@ -45,15 +45,13 @@ class TestFilePpm(PillowTestCase):
|
|||
|
||||
|
||||
def test_neg_ppm(self):
|
||||
"""test_neg_ppm
|
||||
|
||||
Storage.c accepted negative values for xsize, ysize.
|
||||
open_ppm is a core debugging item that doesn't check any parameters for
|
||||
sanity.
|
||||
"""
|
||||
# Storage.c accepted negative values for xsize, ysize. the
|
||||
# internal open_ppm function didn't check for sanity but it
|
||||
# has been removed. The default opener doesn't accept negative
|
||||
# sizes.
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
Image.core.open_ppm('Tests/images/negative_size.ppm')
|
||||
with self.assertRaises(IOError):
|
||||
Image.open('Tests/images/negative_size.ppm')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -247,6 +247,18 @@ class TestImage(PillowTestCase):
|
|||
Image.new('RGB', (0,0)) # w,h <= 0
|
||||
|
||||
self.assertTrue(Image.new('RGB', (1,1)))
|
||||
|
||||
def test_storage_neg(self):
|
||||
# Storage.c accepted negative values for xsize, ysize. Was
|
||||
# test_neg_ppm, but the core function for that has been
|
||||
# removed Calling directly into core to test the error in
|
||||
# Storage.c, rather than the size check above
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
Image.core.fill('RGB', (2,-2), (0,0,0))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user