2019-02-05 12:27:36 +02:00
|
|
|
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]")
|
|
|
|
|
2019-05-03 00:53:09 +02:00
|
|
|
def test_valuerecord_none(self):
|
|
|
|
statement = ast.ValueRecord(xPlacement=10, xAdvance=20)
|
|
|
|
self.assertEqual(statement.asFea(), "<10 0 20 0>")
|
|
|
|
|
2020-07-02 14:09:10 +01:00
|
|
|
def test_non_object_location(self):
|
|
|
|
el = ast.Element(location=("file.fea", 1, 2))
|
|
|
|
self.assertEqual(el.location.file, "file.fea")
|
|
|
|
self.assertEqual(el.location.line, 1)
|
|
|
|
self.assertEqual(el.location.column, 2)
|
|
|
|
|
2019-02-05 12:27:36 +02:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
import sys
|
2022-12-13 11:26:36 +00:00
|
|
|
|
2019-02-05 12:27:36 +02:00
|
|
|
sys.exit(unittest.main())
|