Skip to content

Commit 74e0b95

Browse files
committed
test {ImageFont,TransposedFont}.getsize() deprecation
1 parent a37c21e commit 74e0b95

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Tests/test_font_pcf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def test_textsize(request, tmp_path):
8282
assert dy == 20
8383
assert dx in (0, 10)
8484
assert font.getlength(chr(i)) == dx
85+
with pytest.warns(DeprecationWarning) as log:
86+
assert font.getsize(chr(i)) == (dx, dy)
87+
assert len(log) == 1
8588
for i in range(len(message)):
8689
msg = message[: i + 1]
8790
assert font.getlength(msg) == len(msg) * 10

Tests/test_imagefont.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,16 @@ def test_rotated_transposed_font(self):
317317
draw.font = font
318318
with pytest.warns(DeprecationWarning) as log:
319319
box_size_a = draw.textsize(word)
320-
assert len(log) == 1
320+
assert box_size_a == font.getsize(word)
321+
assert len(log) == 2
321322
bbox_a = draw.textbbox((10, 10), word)
322323

323324
# Rotated font
324325
draw.font = transposed_font
325326
with pytest.warns(DeprecationWarning) as log:
326327
box_size_b = draw.textsize(word)
327-
assert len(log) == 1
328+
assert box_size_b == transposed_font.getsize(word)
329+
assert len(log) == 2
328330
bbox_b = draw.textbbox((20, 20), word)
329331

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

0 commit comments

Comments
 (0)