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): def parseXmlInto(font, parseInto, xmlSnippet):
parsed_xml = [e for e in parseXML(xmlSnippet.strip()) if not isinstance(e, str)] parsed_xml = [e for e in parseXML(xmlSnippet.strip()) if not isinstance(e, str)]
for name, attrs, content in parsed_xml: for name, attrs, content in parsed_xml:
parseInto.fromXML(name, attrs, content, font) parseInto.fromXML(name, attrs, content, font)
parseInto.populateDefaults() parseInto.populateDefaults()
return parseInto return parseInto

View File

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