fix tests

This commit is contained in:
nulano 2020-10-07 03:49:19 +01:00
parent bf529303de
commit 28d313305a
2 changed files with 15 additions and 17 deletions

View File

@ -852,11 +852,9 @@ class TestImageFont:
with Image.open("Tests/images/standard_embedded.png") as expected: with Image.open("Tests/images/standard_embedded.png") as expected:
assert_image_similar(img, expected, max(self.metrics["multiline"], 3)) assert_image_similar(img, expected, max(self.metrics["multiline"], 3))
@pytest.mark.skipif(
parse_version(features.version_module("freetype2")) < parse_version("2.5.0"),
reason="Freetype 2.5.0 or newer required",
)
def test_cbdt(self): def test_cbdt(self):
if parse_version(features.version_module("freetype2")) < parse_version("2.5.0"):
pytest.skip("Freetype 2.5.0 or newer required")
try: try:
font = ImageFont.truetype( font = ImageFont.truetype(
"Tests/fonts/NotoColorEmoji.ttf", "Tests/fonts/NotoColorEmoji.ttf",
@ -875,11 +873,9 @@ class TestImageFont:
assert str(ex) in ("unimplemented feature", "unknown file format") assert str(ex) in ("unimplemented feature", "unknown file format")
pytest.skip("freetype compiled without libpng or unsupported") pytest.skip("freetype compiled without libpng or unsupported")
@pytest.mark.skipif(
parse_version(features.version_module("freetype2")) < parse_version("2.5.0"),
reason="Freetype 2.5.0 or newer required",
)
def test_cbdt_mask(self): def test_cbdt_mask(self):
if parse_version(features.version_module("freetype2")) < parse_version("2.5.0"):
pytest.skip("Freetype 2.5.0 or newer required")
try: try:
font = ImageFont.truetype( font = ImageFont.truetype(
"Tests/fonts/NotoColorEmoji.ttf", "Tests/fonts/NotoColorEmoji.ttf",
@ -898,11 +894,12 @@ class TestImageFont:
assert str(ex) in ("unimplemented feature", "unknown file format") assert str(ex) in ("unimplemented feature", "unknown file format")
pytest.skip("freetype compiled without libpng or unsupported") pytest.skip("freetype compiled without libpng or unsupported")
@pytest.mark.skipif(
parse_version(features.version_module("freetype2")) < parse_version("2.10.0"),
reason="Freetype 2.10.0 or newer required",
)
def test_colr(self): def test_colr(self):
if parse_version(features.version_module("freetype2")) < parse_version(
"2.10.0"
):
pytest.skip("Freetype 2.10.0 or newer required")
font = ImageFont.truetype( font = ImageFont.truetype(
"Tests/fonts/BungeeColor-Regular_colr_Windows.ttf", "Tests/fonts/BungeeColor-Regular_colr_Windows.ttf",
size=64, size=64,
@ -917,11 +914,12 @@ class TestImageFont:
with Image.open("Tests/images/colr_bungee.png") as expected: with Image.open("Tests/images/colr_bungee.png") as expected:
assert_image_similar(im, expected, 21) assert_image_similar(im, expected, 21)
@pytest.mark.skipif(
parse_version(features.version_module("freetype2")) < parse_version("2.10.0"),
reason="Freetype 2.10.0 or newer required",
)
def test_colr_mask(self): def test_colr_mask(self):
if parse_version(features.version_module("freetype2")) < parse_version(
"2.10.0"
):
pytest.skip("Freetype 2.10.0 or newer required")
font = ImageFont.truetype( font = ImageFont.truetype(
"Tests/fonts/BungeeColor-Regular_colr_Windows.ttf", "Tests/fonts/BungeeColor-Regular_colr_Windows.ttf",
size=64, size=64,

View File

@ -40,4 +40,4 @@ def test_similar():
fill=(0, 0, 0), fill=(0, 0, 0),
font=font_outline, font=font_outline,
) )
assert_image_similar(im_bitmap, im_outline, 44) assert_image_similar(im_bitmap, im_outline, 4)