mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-09-21 11:28:58 +03:00
Load MSP files to test MSP decoder
This commit is contained in:
parent
98b19a9f68
commit
38c6771be0
|
@ -1,6 +1,6 @@
|
||||||
from helper import unittest, PillowTestCase, hopper
|
from helper import unittest, PillowTestCase, hopper
|
||||||
|
|
||||||
from PIL import Image, MspImagePlugin
|
from PIL import Image, ImageFile, MspImagePlugin
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -48,14 +48,22 @@ class TestFileMsp(PillowTestCase):
|
||||||
|
|
||||||
@unittest.skipIf(not os.path.exists(EXTRA_DIR),
|
@unittest.skipIf(not os.path.exists(EXTRA_DIR),
|
||||||
"Extra image files not installed")
|
"Extra image files not installed")
|
||||||
def test_others_windows_v2(self):
|
def test_open_windows_v2(self):
|
||||||
|
# Arrange
|
||||||
|
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||||
files = (os.path.join(EXTRA_DIR, f) for f in os.listdir(EXTRA_DIR)
|
files = (os.path.join(EXTRA_DIR, f) for f in os.listdir(EXTRA_DIR)
|
||||||
if os.path.splitext(f)[1] == '.msp')
|
if os.path.splitext(f)[1] == '.msp')
|
||||||
for path in files:
|
for path in files:
|
||||||
|
|
||||||
|
# Act
|
||||||
with Image.open(path) as im:
|
with Image.open(path) as im:
|
||||||
|
im.load()
|
||||||
|
|
||||||
|
# Assert
|
||||||
self.assertEqual(im.mode, "1")
|
self.assertEqual(im.mode, "1")
|
||||||
self.assertGreater(im.size, (360, 332))
|
self.assertGreater(im.size, (360, 332))
|
||||||
self.assertIsInstance(im, MspImagePlugin.MspImageFile)
|
self.assertIsInstance(im, MspImagePlugin.MspImageFile)
|
||||||
|
ImageFile.LOAD_TRUNCATED_IMAGES = False
|
||||||
|
|
||||||
def test_cannot_save_wrong_mode(self):
|
def test_cannot_save_wrong_mode(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
Loading…
Reference in New Issue
Block a user