mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
testcase for multiline text spacing
This commit is contained in:
parent
02855a86c0
commit
35c9f59c38
BIN
Tests/images/multiline_text.png
Normal file
BIN
Tests/images/multiline_text.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user