svg: test foreground colors

Convert the ft-svg-render-palette test to a color test that test
both palettes and foreground colors.
This commit is contained in:
Adrian Johnson 2023-01-27 19:18:10 +10:30
parent c8695f0503
commit 9e59808ecb
13 changed files with 57 additions and 9 deletions

View file

@ -18,12 +18,12 @@
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.0"/>
<checkSumAdjustment value="0x1b8ac35c"/>
<checkSumAdjustment value="0x1d3a9a74"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000011"/>
<unitsPerEm value="1000"/>
<created value="Wed Jun 15 00:00:00 2022"/>
<modified value="Fri Jan 27 07:13:15 2023"/>
<modified value="Fri Jan 27 08:44:23 2023"/>
<xMin value="0"/>
<yMin value="0"/>
<xMax value="1000"/>
@ -248,13 +248,13 @@
<name>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Cairo Svg Test Palette
Cairo Svg Test Color
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
Cairo Svg Test Palette Regular
Cairo Svg Test Color Regular
</namerecord>
</name>

View file

@ -32,7 +32,7 @@
#define WIDTH (FONT_SIZE*8 + MARGIN*9)
#define HEIGHT (FONT_SIZE*2 + MARGIN*3)
#define FONT_FILE "cairo-svg-test-palette.ttf"
#define FONT_FILE "cairo-svg-test-color.ttf"
#define PALETTE_TEXT "01"
#define FOREGROUND_TEXT "234567"
@ -90,8 +90,8 @@ draw (cairo_t *cr, int width, int height)
return CAIRO_TEST_SUCCESS;
}
CAIRO_TEST (ft_svg_render_palette,
"Test cairo SVG font palettes",
CAIRO_TEST (ft_svg_render_color,
"Test cairo SVG font colors",
"svgrender", /* keywords */
NULL, /* requirements */
WIDTH, HEIGHT,

View file

@ -436,7 +436,7 @@ test_ft_svg_font_sources = [
test_ft_svg_ttx_font_sources = [
'ft-svg-cairo-logo.c',
'ft-svg-render.c',
'ft-svg-render-palette.c'
'ft-svg-render-color.c'
]
test_gl_sources = [
@ -532,10 +532,10 @@ ps2png_sources = [
test_ttx_fonts = [
'cairo-logo-font.ttx',
'cairo-svg-test-color.ttx',
'cairo-svg-test-doc.ttx',
'cairo-svg-test-fill.ttx',
'cairo-svg-test-gradient.ttx',
'cairo-svg-test-palette.ttx',
'cairo-svg-test-path.ttx',
'cairo-svg-test-shapes.ttx',
'cairo-svg-test-stroke.ttx',

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 B

View file

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B

View file

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 150 B

View file

@ -0,0 +1,4 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="100" y="-750" width="800" height="500"
fill="currentColor" />
</svg>

After

Width:  |  Height:  |  Size: 143 B

View file

@ -0,0 +1,4 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="100" y="-750" width="800" height="500"
fill="currentColor" fill-opacity="0.5" />
</svg>

After

Width:  |  Height:  |  Size: 163 B

View file

@ -0,0 +1,10 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad" x1="33%" x21="66%">
<stop offset="0%" stop-color="currentColor" stop-opacity="1" />
<stop offset="100%" stop-color="red" stop-opacity="1" />
</linearGradient>
</defs>
<rect x="100" y="-900" width="800" height="800" fill="url(#grad)" />
</svg>

After

Width:  |  Height:  |  Size: 358 B

View file

@ -0,0 +1,10 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad" x1="33%" x21="66%">
<stop offset="0%" stop-color="currentColor" stop-opacity="0.3" />
<stop offset="100%" stop-color="red" stop-opacity="0.3" />
</linearGradient>
</defs>
<rect x="100" y="-900" width="800" height="800" fill="url(#grad)" />
</svg>

After

Width:  |  Height:  |  Size: 362 B

View file

@ -0,0 +1,10 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<radialGradient id="grad" cx="50%" cy="50%"
fx="0.75" fy="0.35" r="0.5">
<stop offset="0%" stop-color="currentColor" stop-opacity="1" />
<stop offset="100%" stop-color="blue" stop-opacity="1" />
</radialGradient>
</defs>
<rect x="100" y="-900" width="800" height="800" fill="url(#grad)" />
</svg>

After

Width:  |  Height:  |  Size: 405 B

View file

@ -0,0 +1,10 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<radialGradient id="grad" cx="50%" cy="50%"
fx="0.75" fy="0.35" r="0.5">
<stop offset="0%" stop-color="currentColor" stop-opacity="0.5" />
<stop offset="100%" stop-color="blue" stop-opacity="0.5" />
</radialGradient>
</defs>
<rect x="100" y="-900" width="800" height="800" fill="url(#grad)" />
</svg>

After

Width:  |  Height:  |  Size: 409 B