From fa6cd4a19519c7c6af06265e39dc5f0e51fdd734 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 10 Apr 2023 17:34:33 +1000 Subject: [PATCH] Only check width and height of transposed fonts once --- Tests/test_imagefont.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index a614b0fe5..623365d53 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -305,7 +305,7 @@ def test_rotated_transposed_font(font, orientation): draw.font = transposed_font bbox_b = draw.textbbox((20, 20), word) - # Check (w,h) of box a is (h,w) of box b + # Check (w, h) of box a is (h, w) of box b assert ( bbox_a[2] - bbox_a[0], bbox_a[3] - bbox_a[1], @@ -314,11 +314,8 @@ def test_rotated_transposed_font(font, orientation): bbox_b[2] - bbox_b[0], ) - # Check bbox b is (20, 20, 20 + h, 20 + w) - assert bbox_b[0] == 20 - assert bbox_b[1] == 20 - assert bbox_b[2] == 20 + bbox_a[3] - bbox_a[1] - assert bbox_b[3] == 20 + bbox_a[2] - bbox_a[0] + # Check top left co-ordinates are correct + assert bbox_b[:2] == (20, 20) # text length is undefined for vertical text with pytest.raises(ValueError): @@ -360,11 +357,8 @@ def test_unrotated_transposed_font(font, orientation): bbox_b[3] - bbox_b[1], ) - # Check bbox b is (20, 20, 20 + w, 20 + h) - assert bbox_b[0] == 20 - assert bbox_b[1] == 20 - assert bbox_b[2] == 20 + bbox_a[2] - bbox_a[0] - assert bbox_b[3] == 20 + bbox_a[3] - bbox_a[1] + # Check top left co-ordinates are correct + assert bbox_b[:2] == (20, 20) assert length_a == length_b