mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 01:34:24 +03:00
Test ImageFont getters
This commit is contained in:
parent
d392b423cd
commit
1ae23a807f
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user