Testing the imagesequence module with the multipage tiffs

This commit is contained in:
wiredfool 2014-08-26 14:16:01 -07:00
parent d5b4f136c5
commit 3df822d1ef

View File

@ -1,6 +1,6 @@
from helper import unittest, PillowTestCase, lena
from PIL import ImageSequence
from PIL import Image, ImageSequence, TiffImagePlugin
class TestImageSequence(PillowTestCase):
@ -22,7 +22,26 @@ class TestImageSequence(PillowTestCase):
self.assertEqual(index, 1)
def _test_multipage_tiff(self):
im = Image.open('Tests/images/multipage.tiff')
for index, frame in enumerate(ImageSequence.Iterator(im)):
frame.load()
self.assertEqual(index, im.tell())
frame.convert('RGB')
def test_tiff(self):
return self._test_multipage_tiff()
def test_libtiff(self):
codecs = dir(Image.core)
if "libtiff_encoder" not in codecs or "libtiff_decoder" not in codecs:
self.skipTest("tiff support not available")
TiffImagePlugin.READ_LIBTIFF = True
self._test_multipage_tiff()
TiffImagePlugin.READ_LIBTIFF = False
if __name__ == '__main__':
unittest.main()