Skip to content

Commit 33fa149

Browse files
committed
subset: Add tests for --flavor option
1 parent f07cd0a commit 33fa149

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Tests/subset/data/Lobster.subset.otf

3.67 KB
Binary file not shown.

Tests/subset/subset_test.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,48 @@ def test_HVAR_VVAR_retain_gids(self):
678678
subsetfont = TTFont(subsetpath)
679679
self.expect_ttx(subsetfont, self.getpath("expect_HVVAR_retain_gids.ttx"), ["GlyphOrder", "HVAR", "VVAR", "avar", "fvar"])
680680

681+
def test_subset_flavor(self):
682+
_, fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf")
683+
font = TTFont(fontpath)
684+
685+
woff_path = self.temp_path(".woff")
686+
subset.main(
687+
[
688+
fontpath,
689+
"*",
690+
"--flavor=woff",
691+
"--output-file=%s" % woff_path,
692+
]
693+
)
694+
woff = TTFont(woff_path)
695+
696+
self.assertEqual(woff.flavor, "woff")
697+
698+
woff2_path = self.temp_path(".woff2")
699+
subset.main(
700+
[
701+
woff_path,
702+
"*",
703+
"--flavor=woff2",
704+
"--output-file=%s" % woff2_path,
705+
]
706+
)
707+
woff2 = TTFont(woff2_path)
708+
709+
self.assertEqual(woff2.flavor, "woff2")
710+
711+
ttf_path = self.temp_path(".ttf")
712+
subset.main(
713+
[
714+
woff2_path,
715+
"*",
716+
"--output-file=%s" % ttf_path,
717+
]
718+
)
719+
ttf = TTFont(ttf_path)
720+
721+
self.assertEqual(ttf.flavor, None)
722+
681723

682724
if __name__ == "__main__":
683725
sys.exit(unittest.main())

0 commit comments

Comments
 (0)