[gtk+] Add a test for opacity render nodes



commit 82e33823a91bc2a24f5c7e88de37587ad595bb4d
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 18 01:22:27 2017 +0800

    Add a test for opacity render nodes
    
    This test currently fails with the Vulkan renderer, despite
    having its own reference image.

 testsuite/gsk/meson.build         |    3 +++
 testsuite/gsk/opacity.node        |  Bin 0 -> 183252 bytes
 testsuite/gsk/opacity.png         |  Bin 0 -> 36738 bytes
 testsuite/gsk/test-render-nodes.c |   31 +++++++++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build
index 8e4e397..1bba933 100644
--- a/testsuite/gsk/meson.build
+++ b/testsuite/gsk/meson.build
@@ -65,6 +65,9 @@ test_data = [
   'transform.node',
   'transform.png',
   'transform.vulkan.png',
+  'opacity.node',
+  'opacity.png',
+  'opacity.vulkan.png',
 ]
 
 if get_option('install-tests')
diff --git a/testsuite/gsk/opacity.node b/testsuite/gsk/opacity.node
new file mode 100644
index 0000000..6f0fd72
Binary files /dev/null and b/testsuite/gsk/opacity.node differ
diff --git a/testsuite/gsk/opacity.png b/testsuite/gsk/opacity.png
new file mode 100644
index 0000000..78fef46
Binary files /dev/null and b/testsuite/gsk/opacity.png differ
diff --git a/testsuite/gsk/test-render-nodes.c b/testsuite/gsk/test-render-nodes.c
index 53fc98e..29119ae 100644
--- a/testsuite/gsk/test-render-nodes.c
+++ b/testsuite/gsk/test-render-nodes.c
@@ -411,6 +411,36 @@ transform (void)
   return container;
 }
 
+static GskRenderNode *
+opacity (void)
+{
+  GskRenderNode *child;
+  GskRenderNode *node;
+  GskRenderNode *nodes[5];
+  GskRenderNode *container;
+  graphene_matrix_t matrix;
+  int i;
+
+  child = ducky ();
+
+  for (i = 0; i < 5; i++)
+    {
+      node = gsk_opacity_node_new (child, i / 4.0);
+      graphene_matrix_init_translate (&matrix, &(const graphene_point3d_t) { i* 210, 0, 0 });
+      nodes[i] = gsk_transform_node_new (node, &matrix);
+      gsk_render_node_unref (node);
+    }
+
+  gsk_render_node_unref (child);
+
+  container = gsk_container_node_new (nodes, 5);
+
+  for (i = 0; i < 5; i++)
+    gsk_render_node_unref (nodes[i]);
+
+  return container;
+}
+
 static const struct {
   const char *name;
   GskRenderNode * (* func) (void);
@@ -423,6 +453,7 @@ static const struct {
   { "blendmodes.node", blendmodes },
   { "cross-fades.node", cross_fades },
   { "transform.node", transform },
+  { "opacity.node", opacity },
 };
 
 /*** test setup ***/


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