mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +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
|
from PIL import Image, MspImagePlugin
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
TEST_FILE = "Tests/images/hopper.msp"
|
TEST_FILE = "Tests/images/hopper.msp"
|
||||||
|
EXTRA_DIR = "Tests/images/picins"
|
||||||
|
|
||||||
|
|
||||||
class TestFileMsp(PillowTestCase):
|
class TestFileMsp(PillowTestCase):
|
||||||
|
@ -33,7 +36,7 @@ class TestFileMsp(PillowTestCase):
|
||||||
self.assertRaises(SyntaxError,
|
self.assertRaises(SyntaxError,
|
||||||
lambda: MspImagePlugin.MspImageFile(bad_checksum))
|
lambda: MspImagePlugin.MspImageFile(bad_checksum))
|
||||||
|
|
||||||
def test_open(self):
|
def test_open_windows_v1(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
# Act
|
# Act
|
||||||
im = Image.open(TEST_FILE)
|
im = Image.open(TEST_FILE)
|
||||||
|
@ -41,6 +44,18 @@ class TestFileMsp(PillowTestCase):
|
||||||
# Assert
|
# Assert
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
self.assert_image_equal(im, hopper("1"), 4)
|
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):
|
def test_cannot_save_wrong_mode(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# install extra test images
|
# 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
|
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
|
cp -r test_images/* ../Tests/images
|
||||||
|
|
Loading…
Reference in New Issue
Block a user