[Tests/subset/VarComposite] Add test

This commit is contained in:
Behdad Esfahbod 2023-01-18 16:42:43 -07:00
parent 63d355e37d
commit b657b309e9

View File

@ -32,9 +32,9 @@ class SubsetTest:
shutil.rmtree(cls.tempdir, ignore_errors=True) shutil.rmtree(cls.tempdir, ignore_errors=True)
@staticmethod @staticmethod
def getpath(testfile): def getpath(*testfile):
path, _ = os.path.split(__file__) path, _ = os.path.split(__file__)
return os.path.join(path, "data", testfile) return os.path.join(path, "data", *testfile)
@classmethod @classmethod
def temp_path(cls, suffix): def temp_path(cls, suffix):
@ -425,6 +425,18 @@ class SubsetTest:
subsetfont = TTFont(subsetpath) subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("expect_sbix.ttx"), ["sbix"]) self.expect_ttx(subsetfont, self.getpath("expect_sbix.ttx"), ["sbix"])
def test_varComposite(self):
fontpath = self.getpath("..", "..", "ttLib", "data", "varc-ac00-ac01.ttf")
origfont = TTFont(fontpath)
assert len(origfont.getGlyphOrder()) == 6
subsetpath = self.temp_path(".ttf")
subset.main([fontpath, "--unicodes=ac00", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
assert len(subsetfont.getGlyphOrder()) == 4
subset.main([fontpath, "--unicodes=ac01", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
assert len(subsetfont.getGlyphOrder()) == 5
def test_timing_publishes_parts(self): def test_timing_publishes_parts(self):
fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf") fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf")