Simplified test

This commit is contained in:
Andrew Murray 2020-11-04 22:39:25 +11:00
parent 4ca8a3507d
commit a357ff12ad

View File

@ -87,19 +87,15 @@ def test_only_save_relevant_sizes(tmp_path):
def test_only_save_append_images(tmp_path): def test_only_save_append_images(tmp_path):
"""append_images should work to provide alternative sizes""" """append_images should work to provide alternative sizes"""
im = hopper() im = hopper("RGBA")
provided_im = Image.new("RGBA", (32, 32), (255, 0, 0, 255)) provided_im = Image.new("RGBA", (32, 32), (255, 0, 0))
outfile = str(tmp_path / "temp_saved_multi_icon.ico") outfile = str(tmp_path / "temp_saved_multi_icon.ico")
im.save(outfile, sizes=[(32, 32), (64, 64)], append_images=[provided_im]) im.save(outfile, sizes=[(32, 32), (128, 128)], append_images=[provided_im])
with Image.open(outfile) as reread: with Image.open(outfile) as reread:
reread.size = (64, 64) assert_image_equal(reread, hopper("RGBA"))
reread.load()
assert_image_equal(reread, hopper().resize((64, 64), Image.LANCZOS))
with Image.open(outfile) as reread:
reread.size = (32, 32) reread.size = (32, 32)
reread.load()
assert_image_equal(reread, provided_im) assert_image_equal(reread, provided_im)