Test with bad checksum

This commit is contained in:
hugovk 2017-01-29 22:28:41 +02:00 committed by wiredfool
parent cac235bbd6
commit e44773c76c
2 changed files with 15 additions and 1 deletions

View File

@ -15,7 +15,11 @@
#
# See the README file for information on usage and redistribution.
#
# More info on this format: https://archive.org/details/gg243631
# Page 313:
# Figure 205. Windows Paint Version 1: "DanM" Format
# Figure 206. Windows Paint Version 2: "LinS" Format. Used in Windows V2.03
#
from . import Image, ImageFile
from ._binary import i16le as i16, o16le as o16
@ -92,6 +96,7 @@ def _save(im, fp, filename):
# image body
ImageFile._save(im, fp, [("raw", (0, 0)+im.size, 32, ("1", 0, 1))])
#
# registry

View File

@ -24,6 +24,15 @@ class TestFileMsp(PillowTestCase):
self.assertRaises(SyntaxError,
lambda: MspImagePlugin.MspImageFile(invalid_file))
def test_bad_checksum(self):
# Arrange
# This was created by forcing Pillow to save with checksum=0
bad_checksum = "Tests/images/hopper_bad_checksum.msp"
# Act / Assert
self.assertRaises(SyntaxError,
lambda: MspImagePlugin.MspImageFile(bad_checksum))
def test_open(self):
# Arrange
# Act