Skip to content

Commit

Permalink
color emoji modifier tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HinTak committed Nov 12, 2023
1 parent 4cf422e commit 45b25b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Binary file added NotoColorEmoji.ttf
Binary file not shown.
19 changes: 19 additions & 0 deletions tests/test_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,3 +592,22 @@ def test_ttc2():
def test_ttc3():
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
assert isinstance(skia.Typeface.MakeFromFile(os.path.join(root_dir, "MutatorSans.ttc"), 3), skia.Typeface)

@pytest.fixture
def color_emoji_run():
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
typeface = skia.Typeface.MakeFromFile(os.path.join(root_dir, "NotoColorEmoji.ttf"))
text = "✌✌🏻"
font = skia.Font(typeface,109)
blob = skia.TextBlob.MakeFromShapedText(text, font)
run = [x for x in blob]
return run[0]

def test_emoji_count(color_emoji_run):
assert (color_emoji_run.fGlyphCount == 2)

def test_emoji_glyph1(color_emoji_run):
assert (color_emoji_run.fGlyphIndices[0] == 148)

def test_emoji_glyph2(color_emoji_run):
assert (color_emoji_run.fGlyphIndices[1] == 1512)

0 comments on commit 45b25b7

Please sign in to comment.