From 3df822d1ef0693cf242eb9f8bb2d9de914f9a0fa Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 26 Aug 2014 14:16:01 -0700 Subject: [PATCH] Testing the imagesequence module with the multipage tiffs --- Tests/test_imagesequence.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Tests/test_imagesequence.py b/Tests/test_imagesequence.py index fd10e5989..2470bc732 100644 --- a/Tests/test_imagesequence.py +++ b/Tests/test_imagesequence.py @@ -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()