mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +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
 | 
			
		||||
 | 
			
		||||
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 coveralls nose pyroma nose-cov"
 | 
			
		||||
  - 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)      
 | 
			
		||||
        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
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
| 
						 | 
				
			
			@ -194,4 +205,7 @@ def netpbm_available():
 | 
			
		|||
    return command_succeeds(["ppmquant", "--help"]) and \
 | 
			
		||||
           command_succeeds(["ppmtogif", "--help"])
 | 
			
		||||
 | 
			
		||||
def imagemagick_available():
 | 
			
		||||
    return command_succeeds(['convert', '-version'])
 | 
			
		||||
                            
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestFilePalm(PillowTestCase):
 | 
			
		||||
    _roundtrip = imagemagick_available()
 | 
			
		||||
    
 | 
			
		||||
    def helper_save_as_palm(self, mode):
 | 
			
		||||
        # Arrange
 | 
			
		||||
| 
						 | 
				
			
			@ -17,12 +18,25 @@ class TestFilePalm(PillowTestCase):
 | 
			
		|||
        self.assertTrue(os.path.isfile(outfile))
 | 
			
		||||
        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):
 | 
			
		||||
        # Arrange
 | 
			
		||||
        mode = "1"
 | 
			
		||||
 | 
			
		||||
        # Act / Assert
 | 
			
		||||
        self.helper_save_as_palm(mode)
 | 
			
		||||
        self.roundtrip(mode)
 | 
			
		||||
 | 
			
		||||
    def test_p_mode(self):
 | 
			
		||||
        # Arrange
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +44,7 @@ class TestFilePalm(PillowTestCase):
 | 
			
		|||
 | 
			
		||||
        # Act / Assert
 | 
			
		||||
        self.helper_save_as_palm(mode)
 | 
			
		||||
        self.roundtrip(mode)
 | 
			
		||||
        
 | 
			
		||||
    def test_rgb_ioerror(self):
 | 
			
		||||
        # Arrange
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user