aboutsummaryrefslogtreecommitdiff
path: root/Tests/colorLib/unbuilder_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/colorLib/unbuilder_test.py')
-rw-r--r--Tests/colorLib/unbuilder_test.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/Tests/colorLib/unbuilder_test.py b/Tests/colorLib/unbuilder_test.py
index 35489680..fe5dc7d5 100644
--- a/Tests/colorLib/unbuilder_test.py
+++ b/Tests/colorLib/unbuilder_test.py
@@ -221,7 +221,26 @@ TEST_COLOR_GLYPHS = {
"Glyph": "glyph00012",
},
],
- }
+ },
+ # When PaintColrLayers contains more than 255 layers, we build a tree
+ # of nested PaintColrLayers of max 255 items (NumLayers field is a uint8).
+ # Below we test that unbuildColrV1 restores a flat list of layers without
+ # nested PaintColrLayers.
+ "glyph00017": {
+ "Format": int(ot.PaintFormat.PaintColrLayers),
+ "Layers": [
+ {
+ "Format": int(ot.PaintFormat.PaintGlyph),
+ "Paint": {
+ "Format": int(ot.PaintFormat.PaintSolid),
+ "PaletteIndex": i,
+ "Alpha": 1.0,
+ },
+ "Glyph": "glyph{str(18 + i).zfill(5)}",
+ }
+ for i in range(256)
+ ],
+ },
}
@@ -230,7 +249,8 @@ def test_unbuildColrV1():
colorGlyphs = unbuildColrV1(layers, baseGlyphs)
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) \ No newline at end of file
+ unbuildColrV1(None, baseGlyphsV1)