diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index 06a7e39bb..b19cf2e4c 100644 --- a/Tests/test_file_icns.py +++ b/Tests/test_file_icns.py @@ -64,6 +64,10 @@ class TestFileIcns(PillowTestCase): self.assertEqual(im2.mode, 'RGBA') self.assertEqual(im2.size, (wr, hr)) + # Check that we cannot load an incorrect size + with self.assertRaises(ValueError): + im.size = (1, 1) + def test_older_icon(self): # This icon was made with Icon Composer rather than iconutil; it still # uses PNG rather than JP2, however (since it was made on 10.9). diff --git a/Tests/test_file_ico.py b/Tests/test_file_ico.py index 20f21db57..d3024ee90 100644 --- a/Tests/test_file_ico.py +++ b/Tests/test_file_ico.py @@ -47,6 +47,11 @@ class TestFileIco(PillowTestCase): self.assert_image_equal(reloaded, hopper().resize((32, 32), Image.LANCZOS)) + def test_incorrect_size(self): + im = Image.open(TEST_ICO_FILE) + with self.assertRaises(ValueError): + im.size = (1, 1) + def test_save_256x256(self): """Issue #2264 https://github.com/python-pillow/Pillow/issues/2264""" # Arrange