refactor output verifying
This commit is contained in:
parent
9d73327f3b
commit
c663e7f299
@ -53,6 +53,15 @@ def _setupFontBuilder(isTTF):
|
|||||||
return fb, advanceWidths, nameStrings
|
return fb, advanceWidths, nameStrings
|
||||||
|
|
||||||
|
|
||||||
|
def _verifyOutput(outPath):
|
||||||
|
f = TTFont(outPath)
|
||||||
|
f.saveXML(outPath + ".ttx")
|
||||||
|
with open(outPath + ".ttx") as f:
|
||||||
|
testData = strip_VariableItems(f.read())
|
||||||
|
refData = strip_VariableItems(getTestData(os.path.basename(outPath) + ".ttx"))
|
||||||
|
assert refData == testData
|
||||||
|
|
||||||
|
|
||||||
def test_build_ttf(tmpdir):
|
def test_build_ttf(tmpdir):
|
||||||
outPath = os.path.join(str(tmpdir), "test.ttf")
|
outPath = os.path.join(str(tmpdir), "test.ttf")
|
||||||
|
|
||||||
@ -77,12 +86,7 @@ def test_build_ttf(tmpdir):
|
|||||||
|
|
||||||
fb.save(outPath)
|
fb.save(outPath)
|
||||||
|
|
||||||
f = TTFont(outPath)
|
_verifyOutput(outPath)
|
||||||
f.saveXML(outPath + ".ttx")
|
|
||||||
with open(outPath + ".ttx") as f:
|
|
||||||
testData = strip_VariableItems(f.read())
|
|
||||||
refData = strip_VariableItems(getTestData("test.ttf.ttx"))
|
|
||||||
assert refData == testData
|
|
||||||
|
|
||||||
|
|
||||||
def test_build_otf(tmpdir):
|
def test_build_otf(tmpdir):
|
||||||
@ -108,12 +112,7 @@ def test_build_otf(tmpdir):
|
|||||||
|
|
||||||
fb.save(outPath)
|
fb.save(outPath)
|
||||||
|
|
||||||
f = TTFont(outPath)
|
_verifyOutput(outPath)
|
||||||
f.saveXML(outPath + ".ttx")
|
|
||||||
with open(outPath + ".ttx") as f:
|
|
||||||
testData = strip_VariableItems(f.read())
|
|
||||||
refData = strip_VariableItems(getTestData("test.otf.ttx"))
|
|
||||||
assert refData == testData
|
|
||||||
|
|
||||||
|
|
||||||
def test_build_var(tmpdir):
|
def test_build_var(tmpdir):
|
||||||
@ -185,12 +184,7 @@ def test_build_var(tmpdir):
|
|||||||
|
|
||||||
fb.save(outPath)
|
fb.save(outPath)
|
||||||
|
|
||||||
f = TTFont(outPath)
|
_verifyOutput(outPath)
|
||||||
f.saveXML(outPath + ".ttx")
|
|
||||||
with open(outPath + ".ttx") as f:
|
|
||||||
testData = strip_VariableItems(f.read())
|
|
||||||
refData = strip_VariableItems(getTestData("test_var.ttf.ttx"))
|
|
||||||
assert refData == testData
|
|
||||||
|
|
||||||
|
|
||||||
def test_build_cff2(tmpdir):
|
def test_build_cff2(tmpdir):
|
||||||
@ -242,9 +236,4 @@ def test_build_cff2(tmpdir):
|
|||||||
|
|
||||||
fb.save(outPath)
|
fb.save(outPath)
|
||||||
|
|
||||||
f = TTFont(outPath)
|
_verifyOutput(outPath)
|
||||||
f.saveXML(outPath + ".ttx")
|
|
||||||
with open(outPath + ".ttx") as f:
|
|
||||||
testData = strip_VariableItems(f.read())
|
|
||||||
refData = strip_VariableItems(getTestData("test_var.otf.ttx"))
|
|
||||||
assert refData == testData
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user