EMF/WMF comparison: use assert_image_similar()

This commit is contained in:
aagaidiu 2016-11-25 15:56:24 -08:00
parent b06103acc7
commit 62baf977fb

View File

@ -5,17 +5,6 @@ from io import BytesIO
class TestFileWmf(PillowTestCase): 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): def test_load_raw(self):
# Test basic EMF open and rendering # Test basic EMF open and rendering
@ -26,7 +15,7 @@ class TestFileWmf(PillowTestCase):
# Compare to reference rendering # Compare to reference rendering
imref = Image.open('Tests/images/drawing_emf_ref.png') imref = Image.open('Tests/images/drawing_emf_ref.png')
imref.load() imref.load()
self.assert_image_equal(self.as_png(im), imref) self.assert_image_similar(im, imref, 0)
# Test basic WMF open and rendering # Test basic WMF open and rendering
im = Image.open('Tests/images/drawing.wmf') im = Image.open('Tests/images/drawing.wmf')
@ -36,7 +25,7 @@ class TestFileWmf(PillowTestCase):
# Compare to reference rendering # Compare to reference rendering
imref = Image.open('Tests/images/drawing_wmf_ref.png') imref = Image.open('Tests/images/drawing_wmf_ref.png')
imref.load() imref.load()
self.assert_image_equal(self.as_png(im), imref) self.assert_image_similar(im, imref, 0)
if __name__ == '__main__': if __name__ == '__main__':