Skip to content

Commit

Permalink
Added unittest test_ot_layout_lookup_get_glyph_alternates
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-99 authored and khaledhosny committed Jan 6, 2024
1 parent 0d93f3b commit 907ec8a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Binary file added tests/data/SourceSansPro-Regular.otf
Binary file not shown.
18 changes: 18 additions & 0 deletions tests/test_uharfbuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
TESTDATA = Path(__file__).parent / "data"
ADOBE_BLANK_TTF_PATH = TESTDATA / "AdobeBlank.subset.ttf"
OPEN_SANS_TTF_PATH = TESTDATA / "OpenSans.subset.ttf"
SOURCE_SANS_PRO_OTF_PATH = TESTDATA / "SourceSansPro-Regular.otf"
MUTATOR_SANS_TTF_PATH = TESTDATA / "MutatorSans-VF.subset.ttf"
SPARSE_FONT_TTF_PATH = TESTDATA / "SparseFont.ttf"
MATH_FONT_TTF_PATH = TESTDATA / "STIXTwoMath-Regular.ttf"
Expand All @@ -34,6 +35,15 @@ def blankfont():
return font


@pytest.fixture
def sourcesance():
"""Returns the full Source sans Pro Regular font."""
blob = hb.Blob.from_file_path(SOURCE_SANS_PRO_OTF_PATH)
face = hb.Face(blob)
font = hb.Font(face)
return font


@pytest.fixture
def opensans():
"""Return a subset of OpenSans.ttf containing the following glyphs/characters:
Expand Down Expand Up @@ -872,6 +882,14 @@ def test_ot_layout_script_get_language_tags(self, blankfont):
assert tags == []


class TestGetAlternates:
def test_ot_layout_lookup_get_glyph_alternates(self, sourcesance):
alternate_glyphs = hb.ot_layout_lookup_get_glyph_alternates(
sourcesance.face, 1, 1091
)
assert alternate_glyphs == [1549, 1620, 1606, 1578, 1592, 1103, 1115]


class TestOTMath:
def test_ot_math_has_data(self, mathfont):
assert hb.ot_math_has_data(mathfont.face)
Expand Down

0 comments on commit 907ec8a

Please sign in to comment.