Skip to content

Commit

Permalink
Restored testing of non-TrueType default font
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 23, 2024
1 parent 1185fb8 commit 8caae87
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Tests/test_font_leaks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from __future__ import annotations

from PIL import Image, ImageDraw, ImageFont
from PIL import Image, ImageDraw, ImageFont, _util

from .helper import PillowLeakTestCase, skip_unless_feature
from .helper import PillowLeakTestCase, features, skip_unless_feature

original_core = ImageFont.core


class TestTTypeFontLeak(PillowLeakTestCase):
Expand Down Expand Up @@ -31,5 +33,9 @@ class TestDefaultFontLeak(TestTTypeFontLeak):
mem_limit = 1024 # k

def test_leak(self):
if features.check_module("freetype2"):
ImageFont.core = _util.DeferredError(ImportError)
default_font = ImageFont.load_default()
ImageFont.core = original_core

self._test_font(default_font)

0 comments on commit 8caae87

Please sign in to comment.