minor: fix 4-space indentation from PR 2441

This commit is contained in:
Cosimo Lupo 2021-11-08 12:27:26 +00:00
parent de58709fd3
commit 8d6a7617a2
2 changed files with 23 additions and 21 deletions

View File

@ -41,7 +41,7 @@ def parseXML(xmlSnippet):
def parseXmlInto(font, parseInto, xmlSnippet):
parsed_xml = [e for e in parseXML(xmlSnippet.strip()) if not isinstance(e, str)]
for name, attrs, content in parsed_xml:
parseInto.fromXML(name, attrs, content, font)
parseInto.fromXML(name, attrs, content, font)
parseInto.populateDefaults()
return parseInto

View File

@ -689,29 +689,31 @@ def test_splitMarkBasePos():
class ColrV1Test(unittest.TestCase):
def setUp(self):
self.font = FakeFont(['.notdef', 'meh'])
self.font = FakeFont(['.notdef', 'meh'])
def test_traverseEmptyPaintColrLayersNeedsNoLayerList(self):
colr = parseXmlInto(self.font, otTables.COLR(),
'''
<Version value="1"/>
<BaseGlyphList>
<BaseGlyphPaintRecord index="0">
<BaseGlyph value="meh"/>
<Paint Format="1"><!-- PaintColrLayers -->
<NumLayers value="0"/>
<FirstLayerIndex value="42"/>
</Paint>
</BaseGlyphPaintRecord>
</BaseGlyphList>
''')
paint = colr.BaseGlyphList.BaseGlyphPaintRecord[0].Paint
# Just want to confirm we don't crash
visited = []
paint.traverse(colr, lambda p: visited.append(p))
assert len(visited) == 1
colr = parseXmlInto(
self.font,
otTables.COLR(),
'''
<Version value="1"/>
<BaseGlyphList>
<BaseGlyphPaintRecord index="0">
<BaseGlyph value="meh"/>
<Paint Format="1"><!-- PaintColrLayers -->
<NumLayers value="0"/>
<FirstLayerIndex value="42"/>
</Paint>
</BaseGlyphPaintRecord>
</BaseGlyphList>
''',
)
paint = colr.BaseGlyphList.BaseGlyphPaintRecord[0].Paint
# Just want to confirm we don't crash
visited = []
paint.traverse(colr, lambda p: visited.append(p))
assert len(visited) == 1
if __name__ == "__main__":