test the accuracy of the font file conversion

This commit is contained in:
Eric Soroos 2017-11-02 11:37:24 +00:00
parent 7a5d215022
commit ebb0a491b6
3 changed files with 8 additions and 0 deletions

BIN
Tests/fonts/10x20.pbm Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
Tests/fonts/10x20.pil Normal file

Binary file not shown.

View File

@ -26,6 +26,14 @@ class TestFontPcf(PillowTestCase):
tempname = self.tempfile("temp.pil")
self.addCleanup(self.delete_tempfile, tempname[:-4]+'.pbm')
font.save(tempname)
with Image.open(tempname.replace('.pil', '.pbm')) as loaded:
with Image.open('Tests/fonts/10x20.pbm') as target:
self.assert_image_equal(loaded, target)
with open(tempname, 'rb') as f_loaded:
with open('Tests/fonts/10x20.pil', 'rb') as f_target:
self.assertEqual(f_loaded.read(), f_target.read())
return tempname
def test_sanity(self):