testsuite: Add tests for the new node parser

These are just a few crashes I encountered while developing it.
This commit is contained in:
Benjamin Otte
2019-03-19 05:29:20 +01:00
parent 0fa5efa628
commit dae0dabb51
5 changed files with 81 additions and 0 deletions

View File

@@ -18,6 +18,14 @@ compare_render = executable(
install_dir: testexecdir
)
node_parser = executable(
'node-parser',
['node-parser.c'],
dependencies: libgtk_dep,
install: get_option('install-tests'),
install_dir: testexecdir
)
test('nodes (cairo)', test_render_nodes,
args: [ '--tap', '-k' ],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
@@ -64,6 +72,26 @@ foreach gl_test : gl_tests
suite: 'gsk')
endforeach
node_parser_tests = [
'crash1',
'crash2',
'crash3',
]
foreach test : node_parser_tests
test('parser ' + test, node_parser,
args: [join_paths(meson.current_source_dir(), 'nodeparser', test + '.node')],
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
'GSETTINGS_BACKEND=memory',
'GTK_CSD=1',
'G_ENABLE_DIAGNOSTIC=0',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'GSK_RENDERER=opengl'
],
suite: 'gsk')
endforeach
if have_vulkan
test('nodes (vulkan)', test_render_nodes,
args: [ '--tap', '-k' ],

View File

@@ -0,0 +1,30 @@
#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;
}

View File

@@ -0,0 +1,2 @@
opacity {
child = color {

View File

@@ -0,0 +1,3 @@
cross-fade {
from: color {
co

View File

@@ -0,0 +1,18 @@
cross-fade {
start: container {
color {
color: red;
bounds: 0 0 10 10;
}
color {
color: green;
bounds: 10 10 10 10;
}
}
end: color {
color: blue;
bounds: 5 5 10 10;
}
progress: 0.2;
}