Don't crash if there is no layer list
This commit is contained in:
parent
b11d6f79ba
commit
6144202cd9
@ -2,11 +2,14 @@ from fontTools.ttLib.tables import otTables as ot
|
|||||||
from .table_builder import TableUnbuilder
|
from .table_builder import TableUnbuilder
|
||||||
|
|
||||||
|
|
||||||
def unbuildColrV1(layerV1List, baseGlyphV1List):
|
def unbuildColrV1(layerList, baseGlyphList):
|
||||||
unbuilder = LayerListUnbuilder(layerV1List.Paint)
|
layers = []
|
||||||
|
if layerList:
|
||||||
|
layers = layerList.Paint
|
||||||
|
unbuilder = LayerListUnbuilder(layers)
|
||||||
return {
|
return {
|
||||||
rec.BaseGlyph: unbuilder.unbuildPaint(rec.Paint)
|
rec.BaseGlyph: unbuilder.unbuildPaint(rec.Paint)
|
||||||
for rec in baseGlyphV1List.BaseGlyphPaintRecord
|
for rec in baseGlyphList.BaseGlyphPaintRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,11 +221,16 @@ TEST_COLOR_GLYPHS = {
|
|||||||
"Glyph": "glyph00012",
|
"Glyph": "glyph00012",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_unbuildColrV1():
|
def test_unbuildColrV1():
|
||||||
layersV1, baseGlyphsV1 = buildColrV1(TEST_COLOR_GLYPHS)
|
layers, baseGlyphs = buildColrV1(TEST_COLOR_GLYPHS)
|
||||||
colorGlyphs = unbuildColrV1(layersV1, baseGlyphsV1)
|
colorGlyphs = unbuildColrV1(layers, baseGlyphs)
|
||||||
assert colorGlyphs == TEST_COLOR_GLYPHS
|
assert colorGlyphs == TEST_COLOR_GLYPHS
|
||||||
|
|
||||||
|
def test_unbuildColrV1_noLayers():
|
||||||
|
_, baseGlyphsV1 = buildColrV1(TEST_COLOR_GLYPHS)
|
||||||
|
# Just looking to see we don't crash
|
||||||
|
unbuildColrV1(None, baseGlyphsV1)
|
Loading…
x
Reference in New Issue
Block a user