Merge pull request #802 from hugovk/SunImagePlugin

Sanity test for SunImagePlugin.py
This commit is contained in:
wiredfool 2014-07-16 09:00:25 -07:00
commit c22c8eefcc
3 changed files with 26 additions and 2 deletions

View File

@ -29,6 +29,7 @@ i32 = _binary.i32be
def _accept(prefix):
return i32(prefix) == 0x59a66a95
##
# Image plugin for Sun raster files.
@ -70,9 +71,9 @@ class SunImageFile(ImageFile.ImageFile):
stride = (((self.size[0] * depth + 7) // 8) + 3) & (~3)
if compression == 1:
self.tile = [("raw", (0,0)+self.size, offset, (rawmode, stride))]
self.tile = [("raw", (0, 0)+self.size, offset, (rawmode, stride))]
elif compression == 2:
self.tile = [("sun_rle", (0,0)+self.size, offset, rawmode)]
self.tile = [("sun_rle", (0, 0)+self.size, offset, rawmode)]
#
# registry

BIN
Tests/images/lena.ras Normal file

Binary file not shown.

23
Tests/test_file_sun.py Normal file
View File

@ -0,0 +1,23 @@
from helper import unittest, PillowTestCase
from PIL import Image
class TestFileSun(PillowTestCase):
def test_sanity(self):
# Arrange
# Created with ImageMagick: convert lena.ppm lena.ras
test_file = "Tests/images/lena.ras"
# Act
im = Image.open(test_file)
# Assert
self.assertEqual(im.size, (128, 128))
if __name__ == '__main__':
unittest.main()
# End of file