From 124c1f6bced9dbaba5ae369a44ac826eae0de0fa Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 26 Apr 2019 22:14:15 +1000 Subject: [PATCH] Added tests --- Tests/test_imagefont.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 91ff44c13..9f1f10c95 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -141,6 +141,18 @@ class TestImageFont(PillowTestCase): ImageFont.truetype(tempfile, FONT_SIZE) + def test_unavailable_layout_engine(self): + have_raqm = ImageFont.core.HAVE_RAQM + ImageFont.core.HAVE_RAQM = False + + try: + ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE, + layout_engine=ImageFont.LAYOUT_RAQM) + finally: + ImageFont.core.HAVE_RAQM = have_raqm + + self.assertEqual(ttf.layout_engine, ImageFont.LAYOUT_BASIC) + def _render(self, font): txt = "Hello World!" ttf = ImageFont.truetype(font, FONT_SIZE, @@ -410,6 +422,7 @@ class TestImageFont(PillowTestCase): # Act/Assert self.assertRaises(IOError, ImageFont.load_path, filename) + self.assertRaises(IOError, ImageFont.truetype, filename) def test_default_font(self): # Arrange