Add a basic cairo node test

This commit is contained in:
Matthias Clasen 2017-10-08 11:51:00 -04:00
parent 95f29de710
commit df549c4e9f
3 changed files with 29 additions and 0 deletions

BIN
testsuite/gsk/cairo.node Normal file

Binary file not shown.

BIN
testsuite/gsk/cairo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -126,11 +126,40 @@ colors (void)
return container;
}
static GskRenderNode *
cairo (void)
{
GskRenderNode *node;
cairo_surface_t *surface;
cairo_t *cr;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 200, 600);
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_rectangle (cr, 0, 0, 200, 200);
cairo_fill (cr);
cairo_set_source_rgb (cr, 0, 1, 0);
cairo_rectangle (cr, 0, 200, 200, 200);
cairo_fill (cr);
cairo_set_source_rgb (cr, 0, 0, 1);
cairo_rectangle (cr, 0, 400, 200, 200);
cairo_fill (cr);
node = gsk_cairo_node_new_for_surface (&GRAPHENE_RECT_INIT (0, 0, 200, 600), surface);
cairo_destroy (cr);
cairo_surface_destroy (surface);
return node;
}
static const struct {
const char *name;
GskRenderNode * (* func) (void);
} functions[] = {
{ "colors.node", colors },
{ "cairo.node", cairo },
};
/*** test setup ***/