mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
Added test for ImageDraw2 textbbox
This commit is contained in:
parent
adbb04d5dc
commit
b27794fc01
|
@ -2,7 +2,7 @@ import os.path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from PIL import Image, ImageDraw, ImageDraw2
|
from PIL import Image, ImageDraw, ImageDraw2, features
|
||||||
|
|
||||||
from .helper import (
|
from .helper import (
|
||||||
assert_image_equal,
|
assert_image_equal,
|
||||||
|
@ -170,6 +170,21 @@ def test_text():
|
||||||
assert_image_similar_tofile(im, expected, 13)
|
assert_image_similar_tofile(im, expected, 13)
|
||||||
|
|
||||||
|
|
||||||
|
@skip_unless_feature("freetype2")
|
||||||
|
def test_textbbox():
|
||||||
|
# Arrange
|
||||||
|
im = Image.new("RGB", (W, H))
|
||||||
|
draw = ImageDraw2.Draw(im)
|
||||||
|
font = ImageDraw2.Font("white", FONT_PATH)
|
||||||
|
|
||||||
|
# Act
|
||||||
|
bbox = draw.textbbox((0, 0), "ImageDraw2", font)
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
right = 72 if features.check_feature("raqm") else 70
|
||||||
|
assert bbox == (0, 2, right, 12)
|
||||||
|
|
||||||
|
|
||||||
@skip_unless_feature("freetype2")
|
@skip_unless_feature("freetype2")
|
||||||
def test_textsize_empty_string():
|
def test_textsize_empty_string():
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
Loading…
Reference in New Issue
Block a user