fonttools/Tests/feaLib/ast_test.py
Khaled Hosny 41c7760be3 [feaLib] don’t write None in ast.ValueRecord.asFea()
The code tries to write the short format when some values as None, but
when writing the long format it would write any None value as is which
is invalid, use 0 for None values instead.
2019-05-03 00:53:09 +02:00

22 lines
667 B
Python

from __future__ import print_function, division, absolute_import
from __future__ import unicode_literals
from fontTools.feaLib import ast
import unittest
class AstTest(unittest.TestCase):
def test_glyphname_escape(self):
statement = ast.GlyphClass()
for name in ("BASE", "NULL", "foo", "a"):
statement.append(ast.GlyphName(name))
self.assertEqual(statement.asFea(), r"[\BASE \NULL foo a]")
def test_valuerecord_none(self):
statement = ast.ValueRecord(xPlacement=10, xAdvance=20)
self.assertEqual(statement.asFea(), "<10 0 20 0>")
if __name__ == "__main__":
import sys
sys.exit(unittest.main())