Skip to content

Commit

Permalink
Update test expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Jan 21, 2024
1 parent c2b4802 commit df0267b
Showing 1 changed file with 59 additions and 98 deletions.
157 changes: 59 additions & 98 deletions tests/featureWriters/kernFeatureWriter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,29 +595,23 @@ def test_arabic_numerals(self, FontClass):

assert dedent(str(generated)) == dedent(
"""\
lookup kern_Arab {
lookup kern_Arab_Thaa {
lookupflag IgnoreMarks;
pos four-ar seven-ar -30;
} kern_Arab;
lookup kern_Thaa {
lookupflag IgnoreMarks;
pos four-ar seven-ar -30;
} kern_Thaa;
} kern_Arab_Thaa;
feature kern {
script DFLT;
language dflt;
lookup kern_Arab;
lookup kern_Thaa;
lookup kern_Arab_Thaa;
script arab;
language dflt;
lookup kern_Arab;
lookup kern_Arab_Thaa;
script thaa;
language dflt;
lookup kern_Thaa;
lookup kern_Arab_Thaa;
} kern;
"""
)
Expand Down Expand Up @@ -1402,10 +1396,10 @@ def test_kern_split_multi_glyph_class(FontClass):
}
expectation = dedent(
"""\
@kern1.Default.foo = [period];
@kern1.Latn.foo = [a];
@kern2.Default.foo = [period];
@kern1.Latn.foo_1 = [period];
@kern2.Latn.foo = [b];
@kern2.Latn.foo_1 = [period];
lookup kern_Latn {
lookupflag IgnoreMarks;
Expand All @@ -1418,22 +1412,22 @@ def test_kern_split_multi_glyph_class(FontClass):
pos period a 7;
pos period b 8;
enum pos a @kern2.Latn.foo 12;
enum pos a @kern2.Default.foo 12;
enum pos a @kern2.Latn.foo_1 12;
enum pos period @kern2.Latn.foo 13;
enum pos @kern1.Latn.foo b 10;
enum pos @kern1.Latn.foo period 11;
enum pos @kern1.Default.foo b 10;
enum pos @kern1.Latn.foo_1 b 10;
pos @kern1.Latn.foo @kern2.Latn.foo 14;
pos @kern1.Latn.foo @kern2.Default.foo 14;
pos @kern1.Default.foo @kern2.Latn.foo 14;
pos @kern1.Latn.foo @kern2.Latn.foo_1 14;
pos @kern1.Latn.foo_1 @kern2.Latn.foo 14;
} kern_Latn;
lookup kern_Default {
lookupflag IgnoreMarks;
pos period period 9;
enum pos period @kern2.Default.foo 13;
enum pos @kern1.Default.foo period 11;
pos @kern1.Default.foo @kern2.Default.foo 14;
enum pos period @kern2.Latn.foo_1 13;
enum pos @kern1.Latn.foo_1 period 11;
pos @kern1.Latn.foo_1 @kern2.Latn.foo_1 14;
} kern_Default;
feature kern {
Expand Down Expand Up @@ -1496,74 +1490,55 @@ def test_kern_split_and_drop(FontClass, caplog):

assert dedent(str(newFeatures)) == dedent(
"""\
@kern1.Grek.bar = [period];
@kern1.Grek.foo = [alpha];
@kern1.Latn.foo = [a];
@kern1.Orya.foo = [a-orya];
@kern2.Grek.bar = [period];
@kern2.Grek.foo = [alpha];
@kern2.Latn.foo = [a];
@kern2.Orya.foo = [a-orya];
lookup kern_Grek {
lookupflag IgnoreMarks;
pos @kern1.Grek.foo @kern2.Grek.bar 20;
pos @kern1.Grek.bar @kern2.Grek.foo 20;
} kern_Grek;
lookup kern_Latn {
lookupflag IgnoreMarks;
pos @kern1.Latn.foo @kern2.Grek.bar 20;
pos @kern1.Grek.bar @kern2.Latn.foo 20;
} kern_Latn;
lookup kern_Orya {
@kern1.Cyrl_Grek_Latn_Orya.bar = [a-cy];
@kern1.Cyrl_Grek_Latn_Orya.bar_1 = [period];
@kern1.Cyrl_Grek_Latn_Orya.foo = [a a-orya alpha];
@kern2.Cyrl_Grek_Latn_Orya.bar = [a-cy];
@kern2.Cyrl_Grek_Latn_Orya.bar_1 = [period];
@kern2.Cyrl_Grek_Latn_Orya.foo = [a a-orya alpha];
lookup kern_Cyrl_Grek_Latn_Orya {
lookupflag IgnoreMarks;
pos @kern1.Orya.foo @kern2.Grek.bar 20;
pos @kern1.Grek.bar @kern2.Orya.foo 20;
} kern_Orya;
pos @kern1.Cyrl_Grek_Latn_Orya.foo @kern2.Cyrl_Grek_Latn_Orya.bar 20;
pos @kern1.Cyrl_Grek_Latn_Orya.foo @kern2.Cyrl_Grek_Latn_Orya.bar_1 20;
pos @kern1.Cyrl_Grek_Latn_Orya.bar @kern2.Cyrl_Grek_Latn_Orya.foo 20;
pos @kern1.Cyrl_Grek_Latn_Orya.bar_1 @kern2.Cyrl_Grek_Latn_Orya.foo 20;
} kern_Cyrl_Grek_Latn_Orya;
feature kern {
script DFLT;
language dflt;
lookup kern_Grek;
lookup kern_Latn;
lookup kern_Cyrl_Grek_Latn_Orya;
script cyrl;
language dflt;
lookup kern_Cyrl_Grek_Latn_Orya;
script grek;
language dflt;
lookup kern_Grek;
lookup kern_Cyrl_Grek_Latn_Orya;
script latn;
language dflt;
lookup kern_Latn;
lookup kern_Cyrl_Grek_Latn_Orya;
} kern;
feature dist {
script ory2;
language dflt;
lookup kern_Orya;
lookup kern_Cyrl_Grek_Latn_Orya;
script orya;
language dflt;
lookup kern_Orya;
lookup kern_Cyrl_Grek_Latn_Orya;
} dist;
"""
)

msgs = sorted(msg[-30:] for msg in caplog.messages)
msgs = sorted(msg[-31:] for msg in caplog.messages)
assert msgs == [
"with mixed script (Arab, Grek)",
"with mixed script (Arab, Latn)",
"with mixed script (Arab, Orya)",
"with mixed script (Cyrl, Grek)",
"with mixed script (Cyrl, Latn)",
"with mixed script (Cyrl, Orya)",
"with mixed script (Grek, Arab)",
"with mixed script (Grek, Cyrl)",
"with mixed script (Latn, Arab)",
"with mixed script (Latn, Cyrl)",
"with mixed script (Orya, Arab)",
"with mixed script (Orya, Cyrl)",
"with mixed direction (LTR, RTL)",
"with mixed direction (RTL, LTR)",
]


Expand Down Expand Up @@ -1598,7 +1573,7 @@ def test_kern_split_and_drop_mixed(caplog, FontClass):
"""
)
assert (
"Skipping kerning pair <('V', 'W') ('W', 'gba-nko') -20> with mixed script (Latn, Nkoo)"
"Skipping kerning pair <('V', 'W') ('W', 'gba-nko') -20> with mixed direction (LTR, RTL)"
in caplog.text
)

Expand Down Expand Up @@ -1681,33 +1656,26 @@ def test_kern_multi_script(FontClass):

assert dedent(str(newFeatures)) == dedent(
"""\
@kern1.Arab.foo = [lam-ar];
@kern1.Nkoo.foo = [gba-nko];
@kern2.Arab.foo = [comma-ar];
@kern1.Arab_Nkoo.foo = [gba-nko lam-ar];
@kern2.Arab_Nkoo.foo = [comma-ar];
lookup kern_Arab {
lookup kern_Arab_Nkoo {
lookupflag IgnoreMarks;
pos @kern1.Arab.foo @kern2.Arab.foo <-20 0 -20 0>;
} kern_Arab;
lookup kern_Nkoo {
lookupflag IgnoreMarks;
pos @kern1.Nkoo.foo @kern2.Arab.foo <-20 0 -20 0>;
} kern_Nkoo;
pos @kern1.Arab_Nkoo.foo @kern2.Arab_Nkoo.foo <-20 0 -20 0>;
} kern_Arab_Nkoo;
feature kern {
script DFLT;
language dflt;
lookup kern_Arab;
lookup kern_Nkoo;
lookup kern_Arab_Nkoo;
script arab;
language dflt;
lookup kern_Arab;
lookup kern_Arab_Nkoo;
script nko;
language dflt;
lookup kern_Nkoo;
lookup kern_Arab_Nkoo;
} kern;
"""
)
Expand Down Expand Up @@ -1837,13 +1805,14 @@ def test_kern_zyyy_zinh(FontClass):
pos uni1DC0 uni1DC0 6;
} kern_Grek;
lookup kern_Hani {
lookup kern_Hani_Hrkt {
lookupflag IgnoreMarks;
pos uni1D360 uni1D360 37;
pos uni1D370 uni1D370 38;
pos uni1F250 uni1F250 39;
pos uni3010 uni3010 8;
pos uni3030 uni3030 9;
pos uni30A0 uni30A0 10;
pos uni3190 uni3190 11;
pos uni31C0 uni31C0 12;
pos uni31D0 uni31D0 13;
Expand All @@ -1861,15 +1830,8 @@ def test_kern_zyyy_zinh(FontClass):
pos uni33E0 uni33E0 25;
pos uni33F0 uni33F0 26;
pos uniA700 uniA700 27;
} kern_Hani;
lookup kern_Hrkt {
lookupflag IgnoreMarks;
pos uni3010 uni3010 8;
pos uni3030 uni3030 9;
pos uni30A0 uni30A0 10;
pos uniFF70 uniFF70 29;
} kern_Hrkt;
} kern_Hani_Hrkt;
lookup kern_Default {
lookupflag IgnoreMarks;
Expand All @@ -1889,8 +1851,7 @@ def test_kern_zyyy_zinh(FontClass):
language dflt;
lookup kern_Default;
lookup kern_Grek;
lookup kern_Hani;
lookup kern_Hrkt;
lookup kern_Hani_Hrkt;
script grek;
language dflt;
Expand All @@ -1900,12 +1861,12 @@ def test_kern_zyyy_zinh(FontClass):
script hani;
language dflt;
lookup kern_Default;
lookup kern_Hani;
lookup kern_Hani_Hrkt;
script kana;
language dflt;
lookup kern_Default;
lookup kern_Hrkt;
lookup kern_Hani_Hrkt;
} kern;
feature dist {
Expand Down Expand Up @@ -2044,28 +2005,28 @@ def test_defining_classdefs(FontClass):

assert dedent(str(newFeatures)) == dedent(
"""\
@kern1.Default.ssatelugu.alt = [ss-telugu.alt];
@kern1.Telu.shatelugu.below = [sha-telugu.below];
@kern1.Telu.ssatelugu.alt = [ssa-telugu.alt];
@kern1.Telu.ssatelugu.alt_1 = [ss-telugu.alt];
@kern2.Telu.katelugu.below = [ka-telugu.below];
@kern2.Telu.rVocalicMatratelugu = [rVocalicMatra-telugu];
lookup kern_Telu {
lookupflag IgnoreMarks;
enum pos @kern1.Telu.ssatelugu.alt sha-telugu.below 150;
pos @kern1.Telu.shatelugu.below @kern2.Telu.katelugu.below 20;
pos @kern1.Default.ssatelugu.alt @kern2.Telu.katelugu.below 60;
pos @kern1.Telu.ssatelugu.alt_1 @kern2.Telu.katelugu.below 60;
pos @kern1.Telu.ssatelugu.alt @kern2.Telu.katelugu.below 60;
} kern_Telu;
lookup kern_Telu_marks {
pos @kern1.Default.ssatelugu.alt @kern2.Telu.rVocalicMatratelugu 180;
pos @kern1.Telu.ssatelugu.alt_1 @kern2.Telu.rVocalicMatratelugu 180;
pos @kern1.Telu.ssatelugu.alt @kern2.Telu.rVocalicMatratelugu 180;
} kern_Telu_marks;
lookup kern_Default {
lookupflag IgnoreMarks;
enum pos @kern1.Default.ssatelugu.alt sha-telugu.below 150;
enum pos @kern1.Telu.ssatelugu.alt_1 sha-telugu.below 150;
} kern_Default;
feature kern {
Expand Down

0 comments on commit df0267b

Please sign in to comment.