[gtk/wip/otte/for-master] testsuite: Add workarounds for non-gl backends



commit a85947196051ef6c3aef6c9e85821bc4443f4214
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 18 13:38:35 2021 +0200

    testsuite: Add workarounds for non-gl backends
    
    read: Fix tests for broadway

 testsuite/gdk/memorytexture.c   |  3 ++-
 testsuite/gdk/texture-threads.c | 11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/testsuite/gdk/memorytexture.c b/testsuite/gdk/memorytexture.c
index 806f7f1d0a..03f8634c3f 100644
--- a/testsuite/gdk/memorytexture.c
+++ b/testsuite/gdk/memorytexture.c
@@ -526,7 +526,8 @@ create_texture (GdkMemoryFormat  format,
 
     case TEXTURE_METHOD_GL_RELEASED:
       texture = upload_to_gl (texture);
-      gdk_gl_texture_release (GDK_GL_TEXTURE (texture));
+      if (GDK_IS_GL_TEXTURE (texture))
+        gdk_gl_texture_release (GDK_GL_TEXTURE (texture));
       break;
 
     case TEXTURE_METHOD_PNG:
diff --git a/testsuite/gdk/texture-threads.c b/testsuite/gdk/texture-threads.c
index 11598812bf..5ca16e0ec5 100644
--- a/testsuite/gdk/texture-threads.c
+++ b/testsuite/gdk/texture-threads.c
@@ -70,11 +70,20 @@ texture_threads (void)
   GMainLoop *loop;
   GdkTexture *texture;
   GTask *task;
+  GError *error = NULL;
 
   /* 1. Get a GL renderer */
   surface = gdk_surface_new_toplevel (gdk_display_get_default());
   gl_renderer = gsk_gl_renderer_new ();
-  g_assert_true (gsk_renderer_realize (gl_renderer, surface, NULL));
+  if (!gsk_renderer_realize (gl_renderer, surface, &error))
+    {
+      g_test_skip (error->message);
+
+      g_clear_error (&error);
+      g_clear_object (&gl_renderer);
+      g_clear_object (&surface);
+      return;
+    }
 
   /* 2. Get a GL texture */
   node = gsk_color_node_new (&(GdkRGBA) { 1, 0, 0, 1 }, &GRAPHENE_RECT_INIT(0, 0, 1, 1));


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