testsuite: Make offload tests more robust

Skip the offload tests when we find ourselves in situations
where offloading won't work.
This commit is contained in:
Matthias Clasen 2024-04-28 21:34:20 -04:00
parent 9a5f482e1a
commit d274c7df06

View File

@ -23,6 +23,7 @@
#include <gtk/gtk.h>
#include <gdk/gdksurfaceprivate.h>
#include <gdk/gdksubsurfaceprivate.h>
#include <gdk/gdkdebugprivate.h>
#include <gsk/gskrendernodeparserprivate.h>
#include <gsk/gskrendernodeprivate.h>
#include <gsk/gskoffloadprivate.h>
@ -382,6 +383,18 @@ parse_node_file (GFile *file, const char *generate)
surface = make_toplevel ();
if (!GDK_DISPLAY_DEBUG_CHECK (gdk_display_get_default (), FORCE_OFFLOAD))
{
g_print ("Offload tests require GDK_DEBUG=force-offload");
exit (77);
}
if (gdk_surface_get_scale (surface) != 1.0)
{
g_print ("Offload tests don't work with fractional scales");
exit (77);
}
subsurface = gdk_surface_create_subsurface (surface);
if (subsurface == NULL)
exit (77); /* subsurfaces aren't supported, skip these tests */
@ -389,9 +402,7 @@ parse_node_file (GFile *file, const char *generate)
node = node_from_file (file);
if (node == NULL)
{
return FALSE;
}
tmp = gsk_render_node_attach (node, surface);
gsk_render_node_unref (node);
@ -510,7 +521,7 @@ test_file (GFile *file)
if (g_test_verbose ())
g_test_message ("%s", g_file_peek_path (file));
return parse_node_file (file, FALSE);
return parse_node_file (file, NULL);
}
static int