2014-07-07 21:03:50 +04:00
|
|
|
from helper import unittest, PillowTestCase, lena
|
2012-10-16 00:26:38 +04:00
|
|
|
|
|
|
|
from PIL import ImageSequence
|
|
|
|
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
class TestImageSequence(PillowTestCase):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def test_sanity(self):
|
2013-07-01 02:42:19 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
file = self.tempfile("temp.im")
|
2013-07-01 02:42:19 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
im = lena("RGB")
|
|
|
|
im.save(file)
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
seq = ImageSequence.Iterator(im)
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
index = 0
|
|
|
|
for frame in seq:
|
|
|
|
self.assert_image_equal(im, frame)
|
|
|
|
self.assertEqual(im.tell(), index)
|
2014-06-23 14:39:27 +04:00
|
|
|
index += 1
|
2014-06-10 13:10:47 +04:00
|
|
|
|
|
|
|
self.assertEqual(index, 1)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|
|
|
|
|
|
|
|
# End of file
|