[gtk+/wip/baedert/gl: 134/216] testsuite: Add render node tests for simple color nodes



commit df462d3b16d8a36d356363aed524cbbda40c4360
Author: Timm Bäder <mail baedert org>
Date:   Thu Nov 16 08:12:20 2017 +0100

    testsuite: Add render node tests for simple color nodes

 testsuite/gsk/colors-simple.node  |  Bin 0 -> 837 bytes
 testsuite/gsk/colors-simple.png   |  Bin 0 -> 2978 bytes
 testsuite/gsk/test-render-nodes.c |   47 +++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/testsuite/gsk/colors-simple.node b/testsuite/gsk/colors-simple.node
new file mode 100644
index 0000000..1bf852f
Binary files /dev/null and b/testsuite/gsk/colors-simple.node differ
diff --git a/testsuite/gsk/colors-simple.png b/testsuite/gsk/colors-simple.png
new file mode 100644
index 0000000..ea59736
Binary files /dev/null and b/testsuite/gsk/colors-simple.png differ
diff --git a/testsuite/gsk/test-render-nodes.c b/testsuite/gsk/test-render-nodes.c
index 6763068..9bc3b18 100644
--- a/testsuite/gsk/test-render-nodes.c
+++ b/testsuite/gsk/test-render-nodes.c
@@ -128,6 +128,52 @@ colors (void)
 }
 
 static GskRenderNode *
+colors_simple (void)
+{
+  const int width = 200;
+  const int height = 200;
+  GskRenderNode *container;
+  GskRenderNode *nodes[9];
+
+  nodes[0] = gsk_color_node_new (&(GdkRGBA){1, 0, 0, 1},
+                                 &GRAPHENE_RECT_INIT (0, 0, width, height));
+  nodes[1] = gsk_color_node_new (&(GdkRGBA){0, 1, 0, 1},
+                                 &GRAPHENE_RECT_INIT (width, 0, width, height));
+  nodes[2] = gsk_color_node_new (&(GdkRGBA){0, 0, 1, 1},
+                                 &GRAPHENE_RECT_INIT (width * 2, 0, width, height));
+  nodes[3] = gsk_color_node_new (&(GdkRGBA){1, 0, 0, 0.5},
+                                 &GRAPHENE_RECT_INIT (width * 3, 0, width, height));
+  nodes[4] = gsk_color_node_new (&(GdkRGBA){0, 1, 0, 0.5},
+                                 &GRAPHENE_RECT_INIT (width * 4, 0, width, height));
+  nodes[5] = gsk_color_node_new (&(GdkRGBA){0, 0, 1, 0.5},
+                                 &GRAPHENE_RECT_INIT (width * 5, 0, width, height));
+
+  /* Now draw some over others, checking that the blending works correctly. */
+  nodes[6] = gsk_color_node_new (&(GdkRGBA){0, 1, 0, 0.5},
+                                 &GRAPHENE_RECT_INIT (width * 2.5, height, width, height));
+  nodes[7] = gsk_color_node_new (&(GdkRGBA){1, 0, 0, 0.5},
+                                 &GRAPHENE_RECT_INIT (width * 2, height, width, height));
+  nodes[8] = gsk_color_node_new (&(GdkRGBA){0, 0, 1, 0.5},
+                                 &GRAPHENE_RECT_INIT (width * 3, height, width, height));
+
+
+
+  container = gsk_container_node_new (nodes, 9);
+
+  gsk_render_node_unref (nodes[0]);
+  gsk_render_node_unref (nodes[1]);
+  gsk_render_node_unref (nodes[2]);
+  gsk_render_node_unref (nodes[3]);
+  gsk_render_node_unref (nodes[4]);
+  gsk_render_node_unref (nodes[5]);
+  gsk_render_node_unref (nodes[6]);
+  gsk_render_node_unref (nodes[7]);
+  gsk_render_node_unref (nodes[8]);
+
+  return container;
+}
+
+static GskRenderNode *
 cairo (void)
 {
   GskRenderNode *node;
@@ -523,6 +569,7 @@ static const struct {
   GskRenderNode * (* func) (void);
 } functions[] = {
   { "colors.node", colors },
+  { "colors-simple.node", colors_simple },
   { "cairo.node", cairo },
   { "repeat.node", repeat },
   { "blendmode.node", blendmode },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]