diff --git a/Tests/test_file_ico.py b/Tests/test_file_ico.py index dc5c041b2..3904340f3 100644 --- a/Tests/test_file_ico.py +++ b/Tests/test_file_ico.py @@ -61,6 +61,24 @@ class TestFileIco(PillowTestCase): # Assert self.assertEqual(im_saved.size, (256, 256)) + def test_only_save_relevant_sizes(self): + """Issue #2266 https://github.com/python-pillow/Pillow/issues/2266 + Should save in 16x16, 24x24, 32x32, 48x48 sizes + and not in 16x16, 24x24, 32x32, 48x48, 48x48, 48x48, 48x48 sizes + """ + # Arrange + im = Image.open("Tests/images/python.ico") # 16x16, 32x32, 48x48 + outfile = self.tempfile("temp_saved_python.ico") + + # Act + im.save(outfile) + im_saved = Image.open(outfile) + + # Assert + self.assertEqual( + im_saved.info['sizes'], + set([(16, 16), (24, 24), (32, 32), (48, 48)])) + if __name__ == '__main__': unittest.main()