testsuite: Allow renderers in misc test to fail

When GL or Vulkan is not supported, the test should not fail.

It would be nicer if we could detect GL/Vulkan not being available
otherwise, but I'm not aware of a better solution, in particular because
rendeers might have stricter requirements than GTK itself.

So this is the next best fix.
This commit is contained in:
Benjamin Otte 2024-10-28 08:31:04 +01:00
parent 1b33e2c3b2
commit d2930695ca

View File

@ -155,7 +155,6 @@ test_renderer (GskRenderer *renderer)
GdkDisplay *display;
gboolean realized;
GdkSurface *surface;
gboolean res;
GError *error = NULL;
g_assert (GSK_IS_RENDERER (renderer));
@ -174,15 +173,19 @@ test_renderer (GskRenderer *renderer)
surface = gdk_surface_new_toplevel (display ? display : gdk_display_get_default ());
res = gsk_renderer_realize (renderer, surface, &error);
if (!gsk_renderer_realize (renderer, surface, &error))
{
g_test_skip_printf ("%s not available: %s", G_OBJECT_TYPE_NAME (renderer), error->message);
}
else
{
g_assert_no_error (error);
g_assert_no_error (error);
g_assert_true (res);
g_assert_true (gsk_renderer_is_realized (renderer));
g_assert_true (gsk_renderer_get_surface (renderer) == surface);
g_assert_true (gsk_renderer_is_realized (renderer));
g_assert_true (gsk_renderer_get_surface (renderer) == surface);
gsk_renderer_unrealize (renderer);
gsk_renderer_unrealize (renderer);
}
g_assert_false (gsk_renderer_is_realized (renderer));
g_assert_null (gsk_renderer_get_surface (renderer));
@ -191,6 +194,7 @@ test_renderer (GskRenderer *renderer)
if (display)
gdk_display_close (display);
}
static void