mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
reftest: On failure, save the node files, too
Doesn't hurt to have them available, so it's easy to figure out if a failure is due to the renderer or if we're generating wrong node files.
This commit is contained in:
parent
bd1649e5f4
commit
cad979b734
@ -292,6 +292,36 @@ save_image (GdkTexture *texture,
|
|||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
save_node (GskRenderNode *node,
|
||||||
|
const char *test_name,
|
||||||
|
const char *extension)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
char *filename;
|
||||||
|
gboolean ret;
|
||||||
|
GBytes *bytes;
|
||||||
|
|
||||||
|
filename = get_output_file (test_name, extension, &error);
|
||||||
|
if (filename == NULL)
|
||||||
|
{
|
||||||
|
g_test_message ("Not storing test result node: %s", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_test_message ("Storing test result node at %s", filename);
|
||||||
|
bytes = gsk_render_node_serialize (node);
|
||||||
|
ret = g_file_set_contents (filename,
|
||||||
|
g_bytes_get_data (bytes, NULL),
|
||||||
|
g_bytes_get_size (bytes),
|
||||||
|
NULL);
|
||||||
|
g_assert_true (ret);
|
||||||
|
|
||||||
|
g_bytes_unref (bytes);
|
||||||
|
g_free (filename);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_ui_file (GFile *file)
|
test_ui_file (GFile *file)
|
||||||
{
|
{
|
||||||
@ -335,6 +365,8 @@ test_ui_file (GFile *file)
|
|||||||
save_image (reference_image, ui_file, ".ref.png");
|
save_image (reference_image, ui_file, ".ref.png");
|
||||||
if (diff_image)
|
if (diff_image)
|
||||||
{
|
{
|
||||||
|
save_node (g_object_get_data (G_OBJECT (ui_image), "source-render-node"), ui_file, ".out.node");
|
||||||
|
save_node (g_object_get_data (G_OBJECT (reference_image), "source-render-node"), ui_file, ".ref.node");
|
||||||
save_image (diff_image, ui_file, ".diff.png");
|
save_image (diff_image, ui_file, ".diff.png");
|
||||||
g_object_unref (diff_image);
|
g_object_unref (diff_image);
|
||||||
g_test_fail ();
|
g_test_fail ();
|
||||||
|
@ -248,7 +248,10 @@ draw_paintable (GdkPaintable *paintable,
|
|||||||
gdk_paintable_get_intrinsic_width (paintable),
|
gdk_paintable_get_intrinsic_width (paintable),
|
||||||
gdk_paintable_get_intrinsic_height (paintable)
|
gdk_paintable_get_intrinsic_height (paintable)
|
||||||
));
|
));
|
||||||
gsk_render_node_unref (node);
|
g_object_set_data_full (G_OBJECT (texture),
|
||||||
|
"source-render-node",
|
||||||
|
node,
|
||||||
|
(GDestroyNotify) gsk_render_node_unref);
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (paintable, draw_paintable, out_texture);
|
g_signal_handlers_disconnect_by_func (paintable, draw_paintable, out_texture);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user