[gtk+] Add a basic cairo node test
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add a basic cairo node test
- Date: Sun, 8 Oct 2017 16:29:41 +0000 (UTC)
commit df549c4e9f9de34eb4de404f46edee0521cf35c6
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 8 11:51:00 2017 -0400
Add a basic cairo node test
testsuite/gsk/cairo.node | Bin 0 -> 480079 bytes
testsuite/gsk/cairo.png | Bin 0 -> 1614 bytes
testsuite/gsk/test-render-nodes.c | 29 +++++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/testsuite/gsk/cairo.node b/testsuite/gsk/cairo.node
new file mode 100644
index 0000000..fbddbf3
Binary files /dev/null and b/testsuite/gsk/cairo.node differ
diff --git a/testsuite/gsk/cairo.png b/testsuite/gsk/cairo.png
new file mode 100644
index 0000000..65b25cb
Binary files /dev/null and b/testsuite/gsk/cairo.png differ
diff --git a/testsuite/gsk/test-render-nodes.c b/testsuite/gsk/test-render-nodes.c
index d9d937e..67f7e30 100644
--- a/testsuite/gsk/test-render-nodes.c
+++ b/testsuite/gsk/test-render-nodes.c
@@ -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 ***/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]