mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 01:34:24 +03:00
Test with bad checksum
This commit is contained in:
parent
cac235bbd6
commit
e44773c76c
|
@ -15,7 +15,11 @@
|
||||||
#
|
#
|
||||||
# See the README file for information on usage and redistribution.
|
# 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 . import Image, ImageFile
|
||||||
from ._binary import i16le as i16, o16le as o16
|
from ._binary import i16le as i16, o16le as o16
|
||||||
|
@ -92,6 +96,7 @@ def _save(im, fp, filename):
|
||||||
# image body
|
# image body
|
||||||
ImageFile._save(im, fp, [("raw", (0, 0)+im.size, 32, ("1", 0, 1))])
|
ImageFile._save(im, fp, [("raw", (0, 0)+im.size, 32, ("1", 0, 1))])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# registry
|
# registry
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,15 @@ class TestFileMsp(PillowTestCase):
|
||||||
self.assertRaises(SyntaxError,
|
self.assertRaises(SyntaxError,
|
||||||
lambda: MspImagePlugin.MspImageFile(invalid_file))
|
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):
|
def test_open(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
# Act
|
# Act
|
||||||
|
|
Loading…
Reference in New Issue
Block a user