2016-03-26 14:25:28 +03:00
|
|
|
from PIL import Image
|
|
|
|
from helper import unittest, PillowTestCase
|
|
|
|
|
2016-08-04 09:40:12 +03:00
|
|
|
|
2016-03-26 14:25:28 +03:00
|
|
|
class TestJ2kEncodeOverflow(PillowTestCase):
|
|
|
|
def test_j2k_overflow(self):
|
|
|
|
|
|
|
|
im = Image.new('RGBA', (1024, 131584))
|
|
|
|
target = self.tempfile('temp.jpc')
|
|
|
|
try:
|
|
|
|
im.save(target)
|
|
|
|
self.assertTrue(False, "Expected IOError, save succeeded?")
|
|
|
|
except IOError as err:
|
|
|
|
self.assertTrue(True, "IOError is expected")
|
|
|
|
except Exception as err:
|
2016-08-04 09:40:12 +03:00
|
|
|
self.assertTrue(False, "Expected IOError, got %s" % type(err))
|
2016-03-26 14:25:28 +03:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|