Skip to content

Commit

Permalink
test {ImageFont,TransposedFont}.getsize() deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Jul 1, 2022
1 parent a37c21e commit 74e0b95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Tests/test_font_pcf.py
Expand Up @@ -82,6 +82,9 @@ def test_textsize(request, tmp_path):
assert dy == 20
assert dx in (0, 10)
assert font.getlength(chr(i)) == dx
with pytest.warns(DeprecationWarning) as log:
assert font.getsize(chr(i)) == (dx, dy)
assert len(log) == 1
for i in range(len(message)):
msg = message[: i + 1]
assert font.getlength(msg) == len(msg) * 10
Expand Down
6 changes: 4 additions & 2 deletions Tests/test_imagefont.py
Expand Up @@ -317,14 +317,16 @@ def test_rotated_transposed_font(self):
draw.font = font
with pytest.warns(DeprecationWarning) as log:
box_size_a = draw.textsize(word)
assert len(log) == 1
assert box_size_a == font.getsize(word)
assert len(log) == 2
bbox_a = draw.textbbox((10, 10), word)

# Rotated font
draw.font = transposed_font
with pytest.warns(DeprecationWarning) as log:
box_size_b = draw.textsize(word)
assert len(log) == 1
assert box_size_b == transposed_font.getsize(word)
assert len(log) == 2
bbox_b = draw.textbbox((20, 20), word)

# Check (w,h) of box a is (h,w) of box b
Expand Down

0 comments on commit 74e0b95

Please sign in to comment.