Skip to content

Commit

Permalink
tests: defs/lookups insert order
Browse files Browse the repository at this point in the history
  • Loading branch information
moyogo committed Jun 30, 2021
1 parent 0a4b703 commit 86c3357
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/featureWriters/markFeatureWriter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,66 @@ def test_insert_comment_outside_block(self, testufo):
writer = MarkFeatureWriter(mode="append")
assert writer.write(testufo, feaFile)

def test_defs_and_lookups_first(self, testufo):
testufo.newGlyph("circumflexcomb")
writer = MarkFeatureWriter()
testufo.features.text = dedent(
"""\
feature mkmk {
# Automatic Code
# Move acutecomb down and right if preceded by circumflexcomb
lookup move_acutecomb {
lookupflag UseMarkFilteringSet [acutecomb circumflexcomb];
pos circumflexcomb acutecomb' <0 20 0 20>;
} move_acutecomb;
} mkmk;
"""
)
feaFile = parseLayoutFeatures(testufo)

assert writer.write(testufo, feaFile)

assert str(feaFile) == dedent(
"""\
markClass acutecomb <anchor 100 200> @MC_top;
markClass tildecomb <anchor 100 200> @MC_top;
feature mkmk {
lookup mark2mark_top {
@MFS_mark2mark_top = [acutecomb tildecomb];
lookupflag UseMarkFilteringSet @MFS_mark2mark_top;
pos mark tildecomb
<anchor 100 300> mark @MC_top;
} mark2mark_top;
} mkmk;
feature mkmk {
# Move acutecomb down and right if preceded by circumflexcomb
lookup move_acutecomb {
lookupflag UseMarkFilteringSet [acutecomb circumflexcomb];
pos circumflexcomb acutecomb' <0 20 0 20>;
} move_acutecomb;
} mkmk;
feature mark {
lookup mark2base {
pos base a
<anchor 100 200> mark @MC_top;
} mark2base;
lookup mark2liga {
pos ligature f_i
<anchor 100 500> mark @MC_top
ligComponent
<anchor 600 500> mark @MC_top;
} mark2liga;
} mark;
"""
)

def test_mark_mkmk_features(self, testufo):
writer = MarkFeatureWriter() # by default both mark + mkmk are built
feaFile = ast.FeatureFile()
Expand Down

0 comments on commit 86c3357

Please sign in to comment.