diff options
Diffstat (limited to 'Tests/fontBuilder/fontBuilder_test.py')
-rw-r--r-- | Tests/fontBuilder/fontBuilder_test.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/Tests/fontBuilder/fontBuilder_test.py b/Tests/fontBuilder/fontBuilder_test.py index 6368cb87..775e94d9 100644 --- a/Tests/fontBuilder/fontBuilder_test.py +++ b/Tests/fontBuilder/fontBuilder_test.py @@ -1,13 +1,13 @@ import os import pytest -import re from fontTools.ttLib import TTFont from fontTools.pens.ttGlyphPen import TTGlyphPen from fontTools.pens.t2CharStringPen import T2CharStringPen from fontTools.fontBuilder import FontBuilder from fontTools.ttLib.tables.TupleVariation import TupleVariation from fontTools.misc.psCharStrings import T2CharString +from fontTools.misc.testTools import stripVariableItemsFromTTX def getTestData(fileName, mode="r"): @@ -16,16 +16,6 @@ def getTestData(fileName, mode="r"): return f.read() -def strip_VariableItems(string): - # ttlib changes with the fontTools version - string = re.sub(' ttLibVersion=".*"', '', string) - # head table checksum and creation and mod date changes with each save. - string = re.sub('<checkSumAdjustment value="[^"]+"/>', '', string) - string = re.sub('<modified value="[^"]+"/>', '', string) - string = re.sub('<created value="[^"]+"/>', '', string) - return string - - def drawTestGlyph(pen): pen.moveTo((100, 100)) pen.lineTo((100, 1000)) @@ -91,8 +81,8 @@ def _verifyOutput(outPath, tables=None): f = TTFont(outPath) f.saveXML(outPath + ".ttx", tables=tables) with open(outPath + ".ttx") as f: - testData = strip_VariableItems(f.read()) - refData = strip_VariableItems(getTestData(os.path.basename(outPath) + ".ttx")) + testData = stripVariableItemsFromTTX(f.read()) + refData = stripVariableItemsFromTTX(getTestData(os.path.basename(outPath) + ".ttx")) assert refData == testData |