Skip to content

Commit

Permalink
Merge branch 'main' into Add-worflow-to-run-test
Browse files Browse the repository at this point in the history
  • Loading branch information
moi15moi committed Jan 21, 2024
2 parents 3800e60 + fe6e65d commit fb4490d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_fonts_filename.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from pathlib import Path
from find_system_fonts_filename import get_system_fonts_filename
from os.path import isfile


def test_get_system_fonts_filename():
fonts_filename = get_system_fonts_filename()

for filename in fonts_filename:
assert isfile(filename)
assert isinstance(filename, str)
assert Path(filename).suffix.lstrip(".").strip().lower() in ["ttf", "otf", "ttc", "otc"]

with open(filename, "rb") as font_file:
truetype_signature = b"\x00\x01\x00\x00"
opentype_signature = b"OTTO"
collection_signature = b"ttcf"

signature = font_file.read(4)
assert signature in [truetype_signature, opentype_signature, collection_signature]

0 comments on commit fb4490d

Please sign in to comment.