mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-27 04:23:40 +03:00
Failing test for messed up P image on write only format
This commit is contained in:
parent
a035ecc2ca
commit
cedd8c2106
|
@ -14,7 +14,7 @@ python:
|
||||||
- 3.4
|
- 3.4
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- "sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev cmake"
|
- "sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev cmake imagemagick"
|
||||||
- "pip install cffi"
|
- "pip install cffi"
|
||||||
- "pip install coveralls nose pyroma nose-cov"
|
- "pip install coveralls nose pyroma nose-cov"
|
||||||
- if [ "$TRAVIS_PYTHON_VERSION" == "2.6" ]; then pip install unittest2; fi
|
- if [ "$TRAVIS_PYTHON_VERSION" == "2.6" ]; then pip install unittest2; fi
|
||||||
|
|
|
@ -131,6 +131,17 @@ class PillowTestCase(unittest.TestCase):
|
||||||
self.addCleanup(self.delete_tempfile, path)
|
self.addCleanup(self.delete_tempfile, path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def open_withImagemagick(self, f):
|
||||||
|
if not imagemagick_available():
|
||||||
|
raise IOError()
|
||||||
|
|
||||||
|
outfile = self.tempfile("temp.png")
|
||||||
|
if command_succeeds(['convert', f, outfile]):
|
||||||
|
from PIL import Image
|
||||||
|
return Image.open(outfile)
|
||||||
|
raise IOError()
|
||||||
|
|
||||||
|
|
||||||
# helpers
|
# helpers
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -194,4 +205,7 @@ def netpbm_available():
|
||||||
return command_succeeds(["ppmquant", "--help"]) and \
|
return command_succeeds(["ppmquant", "--help"]) and \
|
||||||
command_succeeds(["ppmtogif", "--help"])
|
command_succeeds(["ppmtogif", "--help"])
|
||||||
|
|
||||||
|
def imagemagick_available():
|
||||||
|
return command_succeeds(['convert', '-version'])
|
||||||
|
|
||||||
# End of file
|
# End of file
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
from helper import unittest, PillowTestCase, tearDownModule, lena
|
from helper import unittest, PillowTestCase, tearDownModule, lena, imagemagick_available
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
|
||||||
class TestFilePalm(PillowTestCase):
|
class TestFilePalm(PillowTestCase):
|
||||||
|
_roundtrip = imagemagick_available()
|
||||||
|
|
||||||
def helper_save_as_palm(self, mode):
|
def helper_save_as_palm(self, mode):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
@ -17,12 +18,25 @@ class TestFilePalm(PillowTestCase):
|
||||||
self.assertTrue(os.path.isfile(outfile))
|
self.assertTrue(os.path.isfile(outfile))
|
||||||
self.assertGreater(os.path.getsize(outfile), 0)
|
self.assertGreater(os.path.getsize(outfile), 0)
|
||||||
|
|
||||||
|
def roundtrip(self, mode):
|
||||||
|
if not self._roundtrip:
|
||||||
|
return
|
||||||
|
|
||||||
|
im = lena(mode)
|
||||||
|
outfile = self.tempfile("temp.palm")
|
||||||
|
|
||||||
|
im.save(outfile)
|
||||||
|
converted = self.open_withImagemagick(outfile)
|
||||||
|
self.assert_image_equal(converted, im)
|
||||||
|
|
||||||
|
|
||||||
def test_monochrome(self):
|
def test_monochrome(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
mode = "1"
|
mode = "1"
|
||||||
|
|
||||||
# Act / Assert
|
# Act / Assert
|
||||||
self.helper_save_as_palm(mode)
|
self.helper_save_as_palm(mode)
|
||||||
|
self.roundtrip(mode)
|
||||||
|
|
||||||
def test_p_mode(self):
|
def test_p_mode(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
@ -30,6 +44,7 @@ class TestFilePalm(PillowTestCase):
|
||||||
|
|
||||||
# Act / Assert
|
# Act / Assert
|
||||||
self.helper_save_as_palm(mode)
|
self.helper_save_as_palm(mode)
|
||||||
|
self.roundtrip(mode)
|
||||||
|
|
||||||
def test_rgb_ioerror(self):
|
def test_rgb_ioerror(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
Loading…
Reference in New Issue
Block a user