From 1ae23a807fc971a00d561a9dd664f8a7910cb8cf Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 7 Dec 2015 20:24:57 +0200 Subject: [PATCH 1/2] Test ImageFont getters --- Tests/test_imagefont.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index dd2234467..c2dd381ff 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -423,6 +423,23 @@ try: self._test_fake_loading_font( font_directory+'/Duplicate.ttf', 'Duplicate') + def test_imagefont_getters(self): + # Arrange + t = ImageFont.truetype(FONT_PATH, FONT_SIZE) + + # Act / Assert + self.assertEqual(t.getmetrics(), (16, 4)) + self.assertEqual(t.font.ascent, 16) + self.assertEqual(t.font.descent, 4) + self.assertEqual(t.font.height, 20) + self.assertEqual(t.font.x_ppem, 20) + self.assertEqual(t.font.y_ppem, 20) + self.assertEqual(t.getsize('A'), (12, 16)) + self.assertEqual(t.getsize('AB'), (24, 16)) + self.assertEqual(t.getsize('M'), (12, 16)) + self.assertEqual(t.getsize('y'), (12, 20)) + self.assertEqual(t.getsize('a'), (12, 16)) + except ImportError: class TestImageFont(PillowTestCase): From 1110978fc77dcb36f675ab2b21ca0fb41716b097 Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 7 Dec 2015 20:44:03 +0200 Subject: [PATCH 2/2] Test another ImageFont getter --- Tests/test_imagefont.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index c2dd381ff..a64eb68ef 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -434,6 +434,7 @@ try: self.assertEqual(t.font.height, 20) self.assertEqual(t.font.x_ppem, 20) self.assertEqual(t.font.y_ppem, 20) + self.assertEqual(t.font.glyphs, 4177) self.assertEqual(t.getsize('A'), (12, 16)) self.assertEqual(t.getsize('AB'), (24, 16)) self.assertEqual(t.getsize('M'), (12, 16))