Test case for #2266

This commit is contained in:
hugovk 2016-11-30 16:36:04 +02:00
parent b341898c7f
commit ed4c0a58e8

View File

@ -61,6 +61,24 @@ class TestFileIco(PillowTestCase):
# Assert # Assert
self.assertEqual(im_saved.size, (256, 256)) 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__': if __name__ == '__main__':
unittest.main() unittest.main()