Skip to content

Commit

Permalink
Initial set of coverage testing (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanone authored Nov 7, 2024
1 parent 3dc6e30 commit 038f8d4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 38 deletions.
20 changes: 11 additions & 9 deletions Lib/glyphsets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def sort_unicodes_by_name(a, b):
return 0


def sort_unicodes_by_glyphobject(a, b):
if a.unicode and b.unicode:
return int(a.unicode, 16) - int(b.unicode, 16)
elif a.unicode:
return -1
elif b.unicode:
return 1
else:
return 0
# def sort_unicodes_by_glyphobject(a, b):
# if a.unicode and b.unicode:
# return int(a.unicode, 16) - int(b.unicode, 16)
# elif a.unicode:
# return -1
# elif b.unicode:
# return 1
# else:
# return 0


def sort_by_category(a, b):
Expand Down Expand Up @@ -661,6 +661,7 @@ def unicodes_per_glyphset(glyphset_name):
return read_nam_file(nam_path)


# Public API (used by fontbakery, gftools, etc.)
def glyphs_in_glyphsets(glyphset_names, production_names=False):
glyphs = set()
for glyphset_name in glyphset_names:
Expand All @@ -669,6 +670,7 @@ def glyphs_in_glyphsets(glyphset_names, production_names=False):
return sorted(list(glyphs))


# Public API (used by fontbakery, gftools, etc.)
def languages_per_glyphset(glyphset_name):
return GlyphSet.load(glyphset_name).get_language_codes()

Expand Down
5 changes: 5 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage run -m pytest
coverage run -a scripts/assemble_charactersets.py
coverage run -a scripts/assemble_description.py
coverage html
rm .coverage
28 changes: 0 additions & 28 deletions tests/test_dependencies.py

This file was deleted.

9 changes: 8 additions & 1 deletion tests/test_glyphsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
build_glyphsapp_filter_list,
glyphs_in_glyphset,
GlyphSet,
extended_glyphsets,
analyze_font,
find_character,
)
import plistlib

Expand Down Expand Up @@ -53,6 +54,7 @@ def test_coverage():

ttFont = TTFont(FONT_PATH)
assert get_glyphsets_fulfilled(ttFont)["GF_Latin_Core"]["percentage"] > 0.99
analyze_font(ttFont)


def test_compare():
Expand All @@ -72,3 +74,8 @@ def test_filter_lists():
assert test[1]["list"] == glyphs_in_glyphset("GF_Latin_Kernel")
assert test[2]["list"] == glyphs_in_glyphset("GF_Latin_Plus")
os.remove("CustomFiltertest.plist")


def test_find():
find_character("ß")
find_character("0x00DF")

0 comments on commit 038f8d4

Please sign in to comment.