mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Test for #2639
This commit is contained in:
parent
0cd84cf9b3
commit
10c7e20045
|
@ -40,13 +40,15 @@ class SimplePatcher(object):
|
|||
else:
|
||||
delattr(self._parent_obj, self._attr_name)
|
||||
|
||||
|
||||
@unittest.skipUnless(HAS_FREETYPE, "ImageFont not Available")
|
||||
class TestImageFont(PillowTestCase):
|
||||
LAYOUT_ENGINE = ImageFont.LAYOUT_BASIC
|
||||
|
||||
# Freetype has different metrics depending on the version.
|
||||
# (and, other things, but first things first)
|
||||
METRICS = { ('2', '3'): {'multiline': 30,
|
||||
METRICS = {
|
||||
('2', '3'): {'multiline': 30,
|
||||
'textsize': 12,
|
||||
'getters': (13, 16)},
|
||||
('2', '7'): {'multiline': 6.2,
|
||||
|
@ -213,6 +215,14 @@ class TestImageFont(PillowTestCase):
|
|||
font=ttf,
|
||||
align="unknown"))
|
||||
|
||||
def test_draw_align(self):
|
||||
im = Image.new('RGB', (300, 100), 'white')
|
||||
draw = ImageDraw.Draw(im)
|
||||
ttf = self.get_font()
|
||||
line = "some text"
|
||||
draw.text((100, 40), line, (0, 0, 0), font=ttf, align='left')
|
||||
del draw
|
||||
|
||||
def test_multiline_size(self):
|
||||
ttf = self.get_font()
|
||||
im = Image.new(mode='RGB', size=(300, 100))
|
||||
|
@ -395,7 +405,7 @@ class TestImageFont(PillowTestCase):
|
|||
|
||||
def test_getsize_empty(self):
|
||||
font = self.get_font()
|
||||
# should not crash.
|
||||
# should not crash.
|
||||
self.assertEqual((0, 0), font.getsize(''))
|
||||
|
||||
def _test_fake_loading_font(self, path_to_fake, fontname):
|
||||
|
@ -494,5 +504,6 @@ class TestImageFont(PillowTestCase):
|
|||
class TestImageFont_RaqmLayout(TestImageFont):
|
||||
LAYOUT_ENGINE = ImageFont.LAYOUT_RAQM
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user