Test that G* table compilation does not change data

This commit is contained in:
Nikolaus Waxweiler 2021-03-22 16:47:44 +00:00 committed by Behdad Esfahbod
parent 7297659c0b
commit cc76169074

View File

@ -142,10 +142,15 @@ class BuilderTest(unittest.TestCase):
feapath = self.getpath("%s.fea" % name) feapath = self.getpath("%s.fea" % name)
addOpenTypeFeatures(font, feapath) addOpenTypeFeatures(font, feapath)
self.expect_ttx(font, self.getpath("%s.ttx" % name)) self.expect_ttx(font, self.getpath("%s.ttx" % name))
# Make sure we can produce binary OpenType tables, not just XML. # Check that
# 1) tables do compile (only G* tables as long as we have a mock font)
# 2) dumping after save-reload yields the same TTX dump as before
for tag in ('GDEF', 'GSUB', 'GPOS'): for tag in ('GDEF', 'GSUB', 'GPOS'):
if tag in font: if tag in font:
font[tag].compile(font) data = font[tag].compile(font)
font[tag].decompile(data, font)
self.expect_ttx(font, self.getpath("%s.ttx" % name))
# Optionally check a debug dump.
debugttx = self.getpath("%s-debug.ttx" % name) debugttx = self.getpath("%s-debug.ttx" % name)
if os.path.exists(debugttx): if os.path.exists(debugttx):
addOpenTypeFeatures(font, feapath, debug=True) addOpenTypeFeatures(font, feapath, debug=True)