Skip to content

Commit 2dd9324

Browse files
committed
add mono color text test
1 parent 9fbd35f commit 2dd9324

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

Tests/images/text_mono.gif

1.52 KB
Loading

Tests/test_imagefont.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from .helper import (
1313
assert_image_equal,
14+
assert_image_equal_tofile,
1415
assert_image_similar,
1516
assert_image_similar_tofile,
1617
is_pypy,
@@ -724,3 +725,19 @@ def _check_text(font, path, epsilon):
724725
@skip_unless_feature("raqm")
725726
class TestImageFont_RaqmLayout(TestImageFont):
726727
LAYOUT_ENGINE = ImageFont.LAYOUT_RAQM
728+
729+
730+
def test_render_mono_size():
731+
# issue 4177
732+
733+
if distutils.version.StrictVersion(ImageFont.core.freetype2_version) < "2.4":
734+
pytest.skip("Different metrics")
735+
736+
im = Image.new("P", (100, 30), "white")
737+
draw = ImageDraw.Draw(im)
738+
ttf = ImageFont.truetype(
739+
"Tests/fonts/DejaVuSans.ttf", 18, layout_engine=ImageFont.LAYOUT_BASIC
740+
)
741+
742+
draw.text((10, 10), "r" * 10, "black", ttf)
743+
assert_image_equal_tofile(im, "Tests/images/text_mono.gif")

0 commit comments

Comments
 (0)