mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
rename test
This commit is contained in:
parent
87b20389d8
commit
467f6cfcbb
|
@ -60,9 +60,9 @@ class TestFilePcx(PillowTestCase):
|
|||
px[x, 0] = x // 67 * 67
|
||||
self._roundtrip(im)
|
||||
|
||||
def _test_overflow(self, im):
|
||||
def _test_buffer_overflow(self, im, size=1024):
|
||||
_last = ImageFile.MAXBLOCK
|
||||
ImageFile.MAXBLOCK = 1024
|
||||
ImageFile.MAXBLOCK = size
|
||||
try:
|
||||
self._roundtrip(im)
|
||||
finally:
|
||||
|
@ -74,7 +74,7 @@ class TestFilePcx(PillowTestCase):
|
|||
for y in range(4):
|
||||
for x in range(256):
|
||||
px[x, y] = x % 128
|
||||
self._test_overflow(im)
|
||||
self._test_buffer_overflow(im)
|
||||
|
||||
def test_break_one_in_loop(self):
|
||||
im = Image.new('L', (256, 5))
|
||||
|
@ -82,7 +82,7 @@ class TestFilePcx(PillowTestCase):
|
|||
for y in range(5):
|
||||
for x in range(256):
|
||||
px[x, y] = x % 128
|
||||
self._test_overflow(im)
|
||||
self._test_buffer_overflow(im)
|
||||
|
||||
def test_break_many_in_loop(self):
|
||||
im = Image.new('L', (256, 5))
|
||||
|
@ -92,7 +92,7 @@ class TestFilePcx(PillowTestCase):
|
|||
px[x, y] = x % 128
|
||||
for x in range(8):
|
||||
px[x, 4] = 16
|
||||
self._test_overflow(im)
|
||||
self._test_buffer_overflow(im)
|
||||
|
||||
def test_break_one_at_end(self):
|
||||
im = Image.new('L', (256, 5))
|
||||
|
@ -101,7 +101,7 @@ class TestFilePcx(PillowTestCase):
|
|||
for x in range(256):
|
||||
px[x, y] = x % 128
|
||||
px[0, 3] = 128 + 64
|
||||
self._test_overflow(im)
|
||||
self._test_buffer_overflow(im)
|
||||
|
||||
def test_break_many_at_end(self):
|
||||
im = Image.new('L', (256, 5))
|
||||
|
@ -112,7 +112,7 @@ class TestFilePcx(PillowTestCase):
|
|||
for x in range(4):
|
||||
px[x * 2, 3] = 128 + 64
|
||||
px[x + 256 - 4, 3] = 0
|
||||
self._test_overflow(im)
|
||||
self._test_buffer_overflow(im)
|
||||
|
||||
def test_break_padding(self):
|
||||
im = Image.new('L', (257, 5))
|
||||
|
@ -122,7 +122,7 @@ class TestFilePcx(PillowTestCase):
|
|||
px[x, y] = x % 128
|
||||
for x in range(5):
|
||||
px[x, 3] = 0
|
||||
self._test_overflow(im)
|
||||
self._test_buffer_overflow(im)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user