mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Test MicImagePlugin for correctness
This commit is contained in:
parent
92c32ccf37
commit
b7d14b04b6
|
@ -96,6 +96,7 @@ class MicImageFile(TiffImagePlugin.TiffImageFile):
|
|||
|
||||
return self.frame
|
||||
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,10 +1,46 @@
|
|||
from helper import unittest, PillowTestCase
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import MicImagePlugin
|
||||
from PIL import Image, MicImagePlugin
|
||||
|
||||
TEST_FILE = "Tests/images/hopper.mic"
|
||||
|
||||
|
||||
class TestFileMic(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im = Image.open(TEST_FILE)
|
||||
im.load()
|
||||
self.assertEqual(im.mode, "RGBA")
|
||||
self.assertEqual(im.size, (128, 128))
|
||||
self.assertEqual(im.format, "MIC")
|
||||
|
||||
im2 = hopper("RGBA")
|
||||
self.assert_image_similar(im, im2, 123.5)
|
||||
|
||||
def test_n_frames(self):
|
||||
im = Image.open(TEST_FILE)
|
||||
|
||||
self.assertEqual(im.n_frames, 1)
|
||||
|
||||
def test_is_animated(self):
|
||||
im = Image.open(TEST_FILE)
|
||||
|
||||
self.assertFalse(im.is_animated)
|
||||
|
||||
def test_tell(self):
|
||||
im = Image.open(TEST_FILE)
|
||||
|
||||
self.assertEqual(im.tell(), 0)
|
||||
|
||||
def test_seek(self):
|
||||
im = Image.open(TEST_FILE)
|
||||
|
||||
im.seek(0)
|
||||
self.assertEqual(im.tell(), 0)
|
||||
|
||||
self.assertRaises(EOFError, lambda: im.seek(99))
|
||||
self.assertEqual(im.tell(), 0)
|
||||
|
||||
def test_invalid_file(self):
|
||||
# Test an invalid OLE file
|
||||
invalid_file = "Tests/images/flower.jpg"
|
||||
|
|
Loading…
Reference in New Issue
Block a user