Skip to content

Commit

Permalink
Load MSP files to test MSP decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 30, 2017
1 parent 4696b21 commit 5708cee
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Tests/test_file_msp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from helper import unittest, PillowTestCase, hopper

from PIL import Image, MspImagePlugin
from PIL import Image, ImageFile, MspImagePlugin

import os

Expand Down Expand Up @@ -48,14 +48,22 @@ def test_open_windows_v1(self):

@unittest.skipIf(not os.path.exists(EXTRA_DIR),
"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)
if os.path.splitext(f)[1] == '.msp')
for path in files:

# Act
with Image.open(path) as im:
im.load()

# Assert
self.assertEqual(im.mode, "1")
self.assertGreater(im.size, (360, 332))
self.assertIsInstance(im, MspImagePlugin.MspImageFile)
ImageFile.LOAD_TRUNCATED_IMAGES = False

def test_cannot_save_wrong_mode(self):
# Arrange
Expand Down

0 comments on commit 5708cee

Please sign in to comment.