From ed4c0a58e8c84ee842e88d2c3fc81ca54e1596bb Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 30 Nov 2016 16:36:04 +0200 Subject: [PATCH] Test case for #2266 --- Tests/test_file_ico.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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()