def test_default_font(self): # Arrange txt = 'This is a "better than nothing" default font.' im = Image.new(mode='RGB', size=(300, 100)) draw = ImageDraw.Draw(im) target = 'Tests/images/default_font.png' target_img = Image.open(target) # Act default_font = ImageFont.load_default() draw.text((10, 10), txt, font=default_font) # Assert self.assert_image_equal(im, target_img)
def test_leak(self): default_font = ImageFont.load_default() self._test_font(default_font)
def test_unicode_pilfont(self): # should not segfault, should return UnicodeDecodeError # issue #2826 font = ImageFont.load_default() with self.assertRaises(UnicodeEncodeError): font.getsize(u"’")