added text size test

This commit is contained in:
Eric Soroos 2017-11-02 12:04:24 +00:00
parent ebb0a491b6
commit ab61cedbdc

View File

@ -52,9 +52,16 @@ class TestFontPcf(PillowTestCase):
with Image.open('Tests/images/test_draw_pbm_target.png') as target:
self.assert_image_similar(im, target, 0)
def test_textsize(self):
tempname = self.save_font()
font = ImageFont.load(tempname)
for i in range(255):
(dx,dy) = font.getsize(chr(i))
self.assertEqual(dy, 20)
self.assertIn(dx, (0,10))
self.assertEqual(font.getsize(message), (len(message)*10,20))
def _test_high_characters(self, message):
tempname = self.save_font()
font = ImageFont.load(tempname)
im = Image.new("L", (750,30) , "white")