mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 01:04:29 +03:00
Test Windows v2 MSP files
This commit is contained in:
parent
e44773c76c
commit
98b19a9f68
|
@ -2,7 +2,10 @@ from helper import unittest, PillowTestCase, hopper
|
|||
|
||||
from PIL import Image, MspImagePlugin
|
||||
|
||||
import os
|
||||
|
||||
TEST_FILE = "Tests/images/hopper.msp"
|
||||
EXTRA_DIR = "Tests/images/picins"
|
||||
|
||||
|
||||
class TestFileMsp(PillowTestCase):
|
||||
|
@ -33,7 +36,7 @@ class TestFileMsp(PillowTestCase):
|
|||
self.assertRaises(SyntaxError,
|
||||
lambda: MspImagePlugin.MspImageFile(bad_checksum))
|
||||
|
||||
def test_open(self):
|
||||
def test_open_windows_v1(self):
|
||||
# Arrange
|
||||
# Act
|
||||
im = Image.open(TEST_FILE)
|
||||
|
@ -41,6 +44,18 @@ class TestFileMsp(PillowTestCase):
|
|||
# Assert
|
||||
self.assertEqual(im.size, (128, 128))
|
||||
self.assert_image_equal(im, hopper("1"), 4)
|
||||
self.assertIsInstance(im, MspImagePlugin.MspImageFile)
|
||||
|
||||
@unittest.skipIf(not os.path.exists(EXTRA_DIR),
|
||||
"Extra image files not installed")
|
||||
def test_others_windows_v2(self):
|
||||
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:
|
||||
with Image.open(path) as im:
|
||||
self.assertEqual(im.mode, "1")
|
||||
self.assertGreater(im.size, (360, 332))
|
||||
self.assertIsInstance(im, MspImagePlugin.MspImageFile)
|
||||
|
||||
def test_cannot_save_wrong_mode(self):
|
||||
# Arrange
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#!/bin/bash
|
||||
# install extra test images
|
||||
|
||||
if [ ! -f test_images.tar.gz ]; then
|
||||
wget -O 'test_images.tar.gz' 'https://github.com/python-pillow/pillow-depends/blob/master/test_images.tar.gz?raw=true'
|
||||
fi
|
||||
|
||||
rm -r test_images
|
||||
tar -xvzf test_images.tar.gz
|
||||
|
||||
# Use SVN to just fetch a single git subdirectory
|
||||
svn checkout https://github.com/python-pillow/pillow-depends/trunk/test_images
|
||||
|
||||
cp -r test_images/* ../Tests/images
|
||||
|
|
Loading…
Reference in New Issue
Block a user