gtk/testsuite/gsk/node-parser.c
Benjamin Otte b6838cb9f4 testsuite: Add tests for the new node parsing code
This adds a test tool gsk/node-parser that takes node files and parses
them.

A few of these node files have been added, for crashes I encountered while
developing the new parsing code.
2019-05-05 07:18:39 +02:00

31 lines
604 B
C

#include <gtk/gtk.h>
int
main (int argc, char **argv)
{
GError *error = NULL;
GskRenderNode *node;
GBytes *bytes;
GFile *file;
g_assert (argc == 2);
gtk_init ();
file = g_file_new_for_commandline_arg (argv[1]);
bytes = g_file_load_bytes (file, NULL, NULL, &error);
g_assert_no_error (error);
g_assert (bytes != NULL);
node = gsk_render_node_deserialize (bytes, &error);
if (error)
g_test_message ("Error: %s\n", error->message);
g_clear_error (&error);
g_clear_pointer (&node, gsk_render_node_unref);
g_bytes_unref (bytes);
g_object_unref (file);
return 0;
}