fix C_O_L_R_test.py following recent changes

This commit is contained in:
Cosimo Lupo 2021-07-22 12:44:23 +01:00
parent e5d0c00fab
commit 6ba0163614

View File

@ -104,13 +104,14 @@ COLR_V1_SAMPLE = (
(b"\x00\x01", "Version (1)"), (b"\x00\x01", "Version (1)"),
(b"\x00\x01", "BaseGlyphRecordCount (1)"), (b"\x00\x01", "BaseGlyphRecordCount (1)"),
( (
b"\x00\x00\x00\x1a", b"\x00\x00\x00\x1e",
"Offset to BaseGlyphRecordArray from beginning of table (26)", "Offset to BaseGlyphRecordArray from beginning of table (30)",
), ),
(b"\x00\x00\x00 ", "Offset to LayerRecordArray from beginning of table (32)"), (b"\x00\x00\x00\x24", "Offset to LayerRecordArray from beginning of table (36)"),
(b"\x00\x03", "LayerRecordCount (3)"), (b"\x00\x03", "LayerRecordCount (3)"),
(b"\x00\x00\x00,", "Offset to BaseGlyphList from beginning of table (44)"), (b"\x00\x00\x00\x30", "Offset to BaseGlyphList from beginning of table (48)"),
(b"\x00\x00\x00\xab", "Offset to LayerList from beginning of table (171)"), (b"\x00\x00\x00\x9b", "Offset to LayerList from beginning of table (155)"),
(b"\x00\x00\x00\x00", "Offset to DeltaSetIndexMap (NULL)"),
(b"\x00\x00\x00\x00", "Offset to VarStore (NULL)"), (b"\x00\x00\x00\x00", "Offset to VarStore (NULL)"),
(b"\x00\x06", "BaseGlyphRecord[0].BaseGlyph (6)"), (b"\x00\x06", "BaseGlyphRecord[0].BaseGlyph (6)"),
(b"\x00\x00", "BaseGlyphRecord[0].FirstLayerIndex (0)"), (b"\x00\x00", "BaseGlyphRecord[0].FirstLayerIndex (0)"),
@ -135,8 +136,8 @@ COLR_V1_SAMPLE = (
), ),
(b"\x00\x0f", "BaseGlyphList.BaseGlyphPaintRecord[2].BaseGlyph (15)"), (b"\x00\x0f", "BaseGlyphList.BaseGlyphPaintRecord[2].BaseGlyph (15)"),
( (
b"\x00\x00\x00\x5e", b"\x00\x00\x00\x4a",
"Offset to Paint table from beginning of BaseGlyphList (94)", "Offset to Paint table from beginning of BaseGlyphList (74)",
), ),
# BaseGlyphPaintRecord[0] # BaseGlyphPaintRecord[0]
(b"\x01", "BaseGlyphPaintRecord[0].Paint.Format (1)"), (b"\x01", "BaseGlyphPaintRecord[0].Paint.Format (1)"),
@ -152,12 +153,13 @@ COLR_V1_SAMPLE = (
(b"\x00\x00\x0a", "Offset to VarAffine2x3 from beginning of PaintVarTransform (10)"), (b"\x00\x00\x0a", "Offset to VarAffine2x3 from beginning of PaintVarTransform (10)"),
(b"\x0b", "BaseGlyphPaintRecord[1].Paint.BackdropPaint.Format (11)"), (b"\x0b", "BaseGlyphPaintRecord[1].Paint.BackdropPaint.Format (11)"),
(b"\x00\x0a", "BaseGlyphPaintRecord[1].Paint.BackdropPaint.Glyph (10)"), (b"\x00\x0a", "BaseGlyphPaintRecord[1].Paint.BackdropPaint.Glyph (10)"),
(b"\x00\x01\x00\x00\xff\xff\xff\xff", "VarAffine2x3.xx (1.0)"), (b"\x00\x01\x00\x00", "VarAffine2x3.xx (1.0)"),
(b"\x00\x00\x00\x00\xff\xff\xff\xff", "VarAffine2x3.xy (0.0)"), (b"\x00\x00\x00\x00", "VarAffine2x3.xy (0.0)"),
(b"\x00\x00\x00\x00\xff\xff\xff\xff", "VarAffine2x3.yx (0.0)"), (b"\x00\x00\x00\x00", "VarAffine2x3.yx (0.0)"),
(b"\x00\x01\x00\x00\xff\xff\xff\xff", "VarAffine2x3.yy (1.0)"), (b"\x00\x01\x00\x00", "VarAffine2x3.yy (1.0)"),
(b"\x01\x2c\x00\x00\xff\xff\xff\xff", "VarAffine2x3.dx (300.0)"), (b"\x01\x2c\x00\x00", "VarAffine2x3.dx (300.0)"),
(b"\x00\x00\x00\x00\xff\xff\xff\xff", "VarAffine2x3.dy (0.0)"), (b"\x00\x00\x00\x00", "VarAffine2x3.dy (0.0)"),
(b"\xff\xff\xff\xff", "VarIndexBase (0xFFFFFFF)"),
(b"\x0a", "BaseGlyphPaintRecord[1].Paint.SourcePaint.Format (10)"), (b"\x0a", "BaseGlyphPaintRecord[1].Paint.SourcePaint.Format (10)"),
(b"\x00\x00\x06", "Offset to Paint subtable from beginning of PaintGlyph (6)"), (b"\x00\x00\x06", "Offset to Paint subtable from beginning of PaintGlyph (6)"),
(b"\x00\x0b", "BaseGlyphPaintRecord[1].Paint.SourcePaint.Glyph (11)"), (b"\x00\x0b", "BaseGlyphPaintRecord[1].Paint.SourcePaint.Glyph (11)"),
@ -170,11 +172,11 @@ COLR_V1_SAMPLE = (
(b"\x00", "ColorLine.Extend (0; pad)"), (b"\x00", "ColorLine.Extend (0; pad)"),
(b"\x00\x02", "ColorLine.StopCount (2)"), (b"\x00\x02", "ColorLine.StopCount (2)"),
(b"\x00\x00", "ColorLine.ColorStop[0].StopOffset (0.0)"), (b"\x00\x00", "ColorLine.ColorStop[0].StopOffset (0.0)"),
(b"\x00\x03", "ColorLine.ColorStop[0].Color.PaletteIndex (3)"), (b"\x00\x03", "ColorLine.ColorStop[0].PaletteIndex (3)"),
(b"@\x00", "ColorLine.ColorStop[0].Color.Alpha (1.0)"), (b"@\x00", "ColorLine.ColorStop[0].Alpha (1.0)"),
(b"@\x00", "ColorLine.ColorStop[1].StopOffset (1.0)"), (b"@\x00", "ColorLine.ColorStop[1].StopOffset (1.0)"),
(b"\x00\x05", "ColorLine.ColorStop[1].Color.PaletteIndex (5)"), (b"\x00\x05", "ColorLine.ColorStop[1].PaletteIndex (5)"),
(b"@\x00", "ColorLine.ColorStop[1].Color.Alpha (1.0)"), (b"@\x00", "ColorLine.ColorStop[1].Alpha (1.0)"),
# LayerList # LayerList
(b"\x00\x00\x00\x04", "LayerList.LayerCount (4)"), (b"\x00\x00\x00\x04", "LayerList.LayerCount (4)"),
( (
@ -190,8 +192,8 @@ COLR_V1_SAMPLE = (
"Third Offset to Paint table from beginning of LayerList (78)", "Third Offset to Paint table from beginning of LayerList (78)",
), ),
( (
b"\x00\x00\x00\xba", b"\x00\x00\x00\x9e",
"Fourth Offset to Paint table from beginning of LayerList (186)", "Fourth Offset to Paint table from beginning of LayerList (158)",
), ),
# BaseGlyphPaintRecord[2] # BaseGlyphPaintRecord[2]
(b"\x0a", "BaseGlyphPaintRecord[2].Paint.Format (10)"), (b"\x0a", "BaseGlyphPaintRecord[2].Paint.Format (10)"),
@ -199,9 +201,9 @@ COLR_V1_SAMPLE = (
(b"\x00\x0b", "BaseGlyphPaintRecord[2].Paint.Glyph (11)"), (b"\x00\x0b", "BaseGlyphPaintRecord[2].Paint.Glyph (11)"),
# PaintVarSolid # PaintVarSolid
(b"\x03", "LayerList.Paint[0].Paint.Format (3)"), (b"\x03", "LayerList.Paint[0].Paint.Format (3)"),
(b"\x00\x02", "Paint.Color.PaletteIndex (2)"), (b"\x00\x02", "Paint.PaletteIndex (2)"),
(b" \x00", "Paint.Color.Alpha.value (0.5)"), (b" \x00", "Paint.Alpha.value (0.5)"),
(b"\xff\xff\xff\xff", "Paint.Color.Alpha.varIdx (0xFFFFFFFF)"), (b"\xff\xff\xff\xff", "VarIndexBase (0xFFFFFFFF)"),
# PaintGlyph glyph00012 # PaintGlyph glyph00012
(b"\x0a", "LayerList.Paint[1].Format (10)"), (b"\x0a", "LayerList.Paint[1].Format (10)"),
(b"\x00\x00\x06", "Offset to Paint subtable from beginning of PaintGlyph (6)"), (b"\x00\x00\x06", "Offset to Paint subtable from beginning of PaintGlyph (6)"),
@ -217,37 +219,40 @@ COLR_V1_SAMPLE = (
(b"\x01", "ColorLine.Extend (1; repeat)"), (b"\x01", "ColorLine.Extend (1; repeat)"),
(b"\x00\x03", "ColorLine.StopCount (3)"), (b"\x00\x03", "ColorLine.StopCount (3)"),
(b"\x00\x00", "ColorLine.ColorStop[0].StopOffset (0.0)"), (b"\x00\x00", "ColorLine.ColorStop[0].StopOffset (0.0)"),
(b"\x00\x03", "ColorLine.ColorStop[0].Color.PaletteIndex (3)"), (b"\x00\x03", "ColorLine.ColorStop[0].PaletteIndex (3)"),
(b"@\x00", "ColorLine.ColorStop[0].Color.Alpha (1.0)"), (b"@\x00", "ColorLine.ColorStop[0].Alpha (1.0)"),
(b" \x00", "ColorLine.ColorStop[1].StopOffset (0.5)"), (b" \x00", "ColorLine.ColorStop[1].StopOffset (0.5)"),
(b"\x00\x04", "ColorLine.ColorStop[1].Color.PaletteIndex (4)"), (b"\x00\x04", "ColorLine.ColorStop[1].PaletteIndex (4)"),
(b"@\x00", "ColorLine.ColorStop[1].Color.Alpha (1.0)"), (b"@\x00", "ColorLine.ColorStop[1].Alpha (1.0)"),
(b"@\x00", "ColorLine.ColorStop[2].StopOffset (1.0)"), (b"@\x00", "ColorLine.ColorStop[2].StopOffset (1.0)"),
(b"\x00\x05", "ColorLine.ColorStop[2].Color.PaletteIndex (5)"), (b"\x00\x05", "ColorLine.ColorStop[2].PaletteIndex (5)"),
(b"@\x00", "ColorLine.ColorStop[2].Color.Alpha (1.0)"), (b"@\x00", "ColorLine.ColorStop[2].Alpha (1.0)"),
# PaintGlyph glyph00013 # PaintGlyph glyph00013
(b"\x0a", "LayerList.Paint[2].Format (10)"), (b"\x0a", "LayerList.Paint[2].Format (10)"),
(b"\x00\x00\x06", "Offset to Paint subtable from beginning of PaintGlyph (6)"), (b"\x00\x00\x06", "Offset to Paint subtable from beginning of PaintGlyph (6)"),
(b"\x00\x0d", "LayerList.Paint[2].Glyph (13)"), (b"\x00\x0d", "LayerList.Paint[2].Glyph (13)"),
(b"\x0c", "LayerList.Paint[2].Paint.Format (12)"), (b"\x0c", "LayerList.Paint[2].Paint.Format (12)"),
(b"\x00\x00\x07", "Offset to Paint subtable from beginning of PaintTransform (7)"), (b"\x00\x00\x07", "Offset to Paint subtable from beginning of PaintTransform (7)"),
(b"\x00\x00\x4e", "Offset to Affine2x3 subtable from beginning of PaintTransform (78)"), (b"\x00\x00\x32", "Offset to Affine2x3 subtable from beginning of PaintTransform (50)"),
(b"\x07", "LayerList.Paint[2].Paint.Paint.Format (7)"), (b"\x07", "LayerList.Paint[2].Paint.Paint.Format (7)"),
(b"\x00\x00(", "Offset to ColorLine from beginning of PaintVarRadialGradient (40)"), (b"\x00\x00\x14", "Offset to ColorLine from beginning of PaintVarRadialGradient (20)"),
(b"\x00\x07\xff\xff\xff\xff", "Paint.x0.value (7)"), (b"\x00\x07", "Paint.x0.value (7)"),
(b"\x00\x08\xff\xff\xff\xff", "Paint.y0.value (8)"), (b"\x00\x08", "Paint.y0.value (8)"),
(b"\x00\t\xff\xff\xff\xff", "Paint.r0.value (9)"), (b"\x00\t", "Paint.r0.value (9)"),
(b"\x00\n\xff\xff\xff\xff", "Paint.x1.value (10)"), (b"\x00\n", "Paint.x1.value (10)"),
(b"\x00\x0b\xff\xff\xff\xff", "Paint.y1.value (11)"), (b"\x00\x0b", "Paint.y1.value (11)"),
(b"\x00\x0c\xff\xff\xff\xff", "Paint.r1.value (12)"), (b"\x00\x0c", "Paint.r1.value (12)"),
(b"\xff\xff\xff\xff", "VarIndexBase (0xFFFFFFFF)"),
(b"\x00", "ColorLine.Extend (0; pad)"), (b"\x00", "ColorLine.Extend (0; pad)"),
(b"\x00\x02", "ColorLine.StopCount (2)"), (b"\x00\x02", "ColorLine.StopCount (2)"),
(b"\x00\x00\xff\xff\xff\xff", "ColorLine.ColorStop[0].StopOffset.value (0.0)"), (b"\x00\x00", "ColorLine.ColorStop[0].StopOffset.value (0.0)"),
(b"\x00\x06", "ColorLine.ColorStop[0].Color.PaletteIndex (6)"), (b"\x00\x06", "ColorLine.ColorStop[0].PaletteIndex (6)"),
(b"@\x00\xff\xff\xff\xff", "ColorLine.ColorStop[0].Color.Alpha.value (1.0)"), (b"@\x00", "ColorLine.ColorStop[0].Alpha.value (1.0)"),
(b"@\x00\xff\xff\xff\xff", "ColorLine.ColorStop[1].StopOffset.value (1.0)"), (b"\xff\xff\xff\xff", "VarIndexBase (0xFFFFFFFF)"),
(b"\x00\x07", "ColorLine.ColorStop[1].Color.PaletteIndex (7)"), (b"@\x00", "ColorLine.ColorStop[1].StopOffset.value (1.0)"),
(b"\x19\x9a\xff\xff\xff\xff", "ColorLine.ColorStop[1].Color.Alpha.value (0.4)"), (b"\x00\x07", "ColorLine.ColorStop[1].PaletteIndex (7)"),
(b"\x19\x9a", "ColorLine.ColorStop[1].Alpha.value (0.4)"),
(b"\xff\xff\xff\xff", "VarIndexBase (0xFFFFFFFF)"),
(b"\xff\xf3\x00\x00", "Affine2x3.xx (-13)"), (b"\xff\xf3\x00\x00", "Affine2x3.xx (-13)"),
(b"\x00\x0e\x00\x00", "Affine2x3.xy (14)"), (b"\x00\x0e\x00\x00", "Affine2x3.xy (14)"),
@ -288,8 +293,8 @@ COLR_V1_SAMPLE = (
# PaintSolid # PaintSolid
(b"\x02", "LayerList.Paint[0].Paint.Paint.Paint.Paint.Format (2)"), (b"\x02", "LayerList.Paint[0].Paint.Paint.Paint.Paint.Format (2)"),
(b"\x00\x02", "Paint.Color.PaletteIndex (2)"), (b"\x00\x02", "Paint.PaletteIndex (2)"),
(b" \x00", "Paint.Color.Alpha (0.5)"), (b" \x00", "Paint.Alpha (0.5)"),
) )
COLR_V1_DATA = b"".join(t[0] for t in COLR_V1_SAMPLE) COLR_V1_DATA = b"".join(t[0] for t in COLR_V1_SAMPLE)
@ -346,6 +351,7 @@ COLR_V1_XML = [
' <yy value="1.0"/>', ' <yy value="1.0"/>',
' <dx value="300.0"/>', ' <dx value="300.0"/>',
' <dy value="0.0"/>', ' <dy value="0.0"/>',
' <VarIndexBase value="4294967295"/>',
" </Transform>", " </Transform>",
" </BackdropPaint>", " </BackdropPaint>",
" </Paint>", " </Paint>",
@ -359,17 +365,13 @@ COLR_V1_XML = [
" <!-- StopCount=2 -->", " <!-- StopCount=2 -->",
' <ColorStop index="0">', ' <ColorStop index="0">',
' <StopOffset value="0.0"/>', ' <StopOffset value="0.0"/>',
" <Color>", ' <PaletteIndex value="3"/>',
' <PaletteIndex value="3"/>', ' <Alpha value="1.0"/>',
' <Alpha value="1.0"/>',
" </Color>",
" </ColorStop>", " </ColorStop>",
' <ColorStop index="1">', ' <ColorStop index="1">',
' <StopOffset value="1.0"/>', ' <StopOffset value="1.0"/>',
" <Color>", ' <PaletteIndex value="5"/>',
' <PaletteIndex value="5"/>', ' <Alpha value="1.0"/>',
' <Alpha value="1.0"/>',
" </Color>",
" </ColorStop>", " </ColorStop>",
" </ColorLine>", " </ColorLine>",
' <centerX value="259"/>', ' <centerX value="259"/>',
@ -385,10 +387,9 @@ COLR_V1_XML = [
" <!-- LayerCount=4 -->", " <!-- LayerCount=4 -->",
' <Paint index="0" Format="10"><!-- PaintGlyph -->', ' <Paint index="0" Format="10"><!-- PaintGlyph -->',
' <Paint Format="3"><!-- PaintVarSolid -->', ' <Paint Format="3"><!-- PaintVarSolid -->',
" <Color>", ' <PaletteIndex value="2"/>',
' <PaletteIndex value="2"/>', ' <Alpha value="0.5"/>',
' <Alpha value="0.5"/>', ' <VarIndexBase value="4294967295"/>',
" </Color>",
" </Paint>", " </Paint>",
' <Glyph value="glyph00011"/>', ' <Glyph value="glyph00011"/>',
" </Paint>", " </Paint>",
@ -399,24 +400,18 @@ COLR_V1_XML = [
" <!-- StopCount=3 -->", " <!-- StopCount=3 -->",
' <ColorStop index="0">', ' <ColorStop index="0">',
' <StopOffset value="0.0"/>', ' <StopOffset value="0.0"/>',
" <Color>", ' <PaletteIndex value="3"/>',
' <PaletteIndex value="3"/>', ' <Alpha value="1.0"/>',
' <Alpha value="1.0"/>',
" </Color>",
" </ColorStop>", " </ColorStop>",
' <ColorStop index="1">', ' <ColorStop index="1">',
' <StopOffset value="0.5"/>', ' <StopOffset value="0.5"/>',
" <Color>", ' <PaletteIndex value="4"/>',
' <PaletteIndex value="4"/>', ' <Alpha value="1.0"/>',
' <Alpha value="1.0"/>',
" </Color>",
" </ColorStop>", " </ColorStop>",
' <ColorStop index="2">', ' <ColorStop index="2">',
' <StopOffset value="1.0"/>', ' <StopOffset value="1.0"/>',
" <Color>", ' <PaletteIndex value="5"/>',
' <PaletteIndex value="5"/>', ' <Alpha value="1.0"/>',
' <Alpha value="1.0"/>',
" </Color>",
" </ColorStop>", " </ColorStop>",
" </ColorLine>", " </ColorLine>",
' <x0 value="1"/>', ' <x0 value="1"/>',
@ -436,17 +431,15 @@ COLR_V1_XML = [
" <!-- StopCount=2 -->", " <!-- StopCount=2 -->",
' <ColorStop index="0">', ' <ColorStop index="0">',
' <StopOffset value="0.0"/>', ' <StopOffset value="0.0"/>',
" <Color>", ' <PaletteIndex value="6"/>',
' <PaletteIndex value="6"/>', ' <Alpha value="1.0"/>',
' <Alpha value="1.0"/>', ' <VarIndexBase value="4294967295"/>',
" </Color>",
" </ColorStop>", " </ColorStop>",
' <ColorStop index="1">', ' <ColorStop index="1">',
' <StopOffset value="1.0"/>', ' <StopOffset value="1.0"/>',
" <Color>", ' <PaletteIndex value="7"/>',
' <PaletteIndex value="7"/>', ' <Alpha value="0.4"/>',
' <Alpha value="0.4"/>', ' <VarIndexBase value="4294967295"/>',
" </Color>",
" </ColorStop>", " </ColorStop>",
" </ColorLine>", " </ColorLine>",
' <x0 value="7"/>', ' <x0 value="7"/>',
@ -455,6 +448,7 @@ COLR_V1_XML = [
' <x1 value="10"/>', ' <x1 value="10"/>',
' <y1 value="11"/>', ' <y1 value="11"/>',
' <r1 value="12"/>', ' <r1 value="12"/>',
' <VarIndexBase value="4294967295"/>',
" </Paint>", " </Paint>",
" <Transform>", " <Transform>",
' <xx value="-13.0"/>', ' <xx value="-13.0"/>',
@ -472,10 +466,8 @@ COLR_V1_XML = [
' <Paint Format="28"><!-- PaintSkew -->', ' <Paint Format="28"><!-- PaintSkew -->',
' <Paint Format="10"><!-- PaintGlyph -->', ' <Paint Format="10"><!-- PaintGlyph -->',
' <Paint Format="2"><!-- PaintSolid -->', ' <Paint Format="2"><!-- PaintSolid -->',
" <Color>", ' <PaletteIndex value="2"/>',
' <PaletteIndex value="2"/>', ' <Alpha value="0.5"/>',
' <Alpha value="0.5"/>',
" </Color>",
" </Paint>", " </Paint>",
' <Glyph value="glyph00011"/>', ' <Glyph value="glyph00011"/>',
" </Paint>", " </Paint>",