testcase for multiline text spacing

This commit is contained in:
wiredfool 2013-09-24 14:23:17 -07:00
parent 02855a86c0
commit 35c9f59c38
2 changed files with 18 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -67,3 +67,21 @@ def test_render_equal():
assert_image_equal(img_path, img_filelike)
_clean()
def test_render_multiline():
im = Image.new(mode='RGB', size=(300,100))
ttf = ImageFont.truetype(font_path, font_size)
draw = ImageDraw.Draw(im)
line_spacing = draw.textsize('A', font=ttf)[1] + 8
lines = ['hey you', 'you are awesome', 'this looks awkward']
y = 0
for line in lines:
draw.text((0, y), line, font=ttf)
y += line_spacing
target = 'Tests/images/multiline_text.png'
target_img = Image.open(target)
assert_image_equal(im, target_img)