diff --git a/Tests/test_file_wmf.py b/Tests/test_file_wmf.py index 64a78f400..bdfca80de 100644 --- a/Tests/test_file_wmf.py +++ b/Tests/test_file_wmf.py @@ -1,9 +1,21 @@ from helper import unittest, PillowTestCase from PIL import Image +from io import BytesIO class TestFileWmf(PillowTestCase): + def as_png(self, im): + # Pass the image through PNG save/load + out = BytesIO() + im.save(out, "PNG") + test_bytes = out.tell() + out.seek(0) + im = Image.open(out) + im.bytes = test_bytes # for testing only + im.load() + return im + def test_load_raw(self): # Test basic EMF open and rendering @@ -14,7 +26,7 @@ class TestFileWmf(PillowTestCase): # Compare to reference rendering imref = Image.open('Tests/images/drawing_emf_ref.png') imref.load() - self.assert_image_equal(im, imref) + self.assert_image_equal(self.as_png(im), imref) # Test basic WMF open and rendering im = Image.open('Tests/images/drawing.wmf') @@ -24,7 +36,7 @@ class TestFileWmf(PillowTestCase): # Compare to reference rendering imref = Image.open('Tests/images/drawing_wmf_ref.png') imref.load() - self.assert_image_equal(im, imref) + self.assert_image_equal(self.as_png(im), imref) if __name__ == '__main__':