diff options
author | Benjamin Otte <otte@redhat.com> | 2016-12-26 17:08:06 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-12-26 17:22:01 +0100 |
commit | 573ceb03407b3a4b067aff07fad6bdf196ca8624 (patch) | |
tree | fecd4f772e2322faa5aad981b61f826260f10bc8 /tests/rendernode-create-tests.c | |
parent | d7e867aa95583a107e5b8174caab6b9121acc16a (diff) | |
download | gtk+-573ceb03407b3a4b067aff07fad6bdf196ca8624.tar.gz |
tests: Add a patternspec argument for test creation
That way, I don't need to recreate all the tests I don't care about.
This is particularly useful when I want to change the size of the
testcase.
Diffstat (limited to 'tests/rendernode-create-tests.c')
-rw-r--r-- | tests/rendernode-create-tests.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/rendernode-create-tests.c b/tests/rendernode-create-tests.c index 06519ce382..b2d75f15c7 100644 --- a/tests/rendernode-create-tests.c +++ b/tests/rendernode-create-tests.c @@ -237,17 +237,29 @@ main (int argc, char **argv) }; GError *error = NULL; GskRenderNode *node; + GPatternSpec *matcher; + char *pattern; guint i, n; gtk_init (&argc, &argv); + n = 100000; + pattern = "*"; + if (argc > 1) - n = atoi (argv[1]); - else - n = 100000; + { + if (argc > 2) + pattern = argv[2]; + n = atoi (argv[1]); + } + + matcher = g_pattern_spec_new (pattern); for (i = 0; i < G_N_ELEMENTS (functions); i++) { + if (!g_pattern_match_string (matcher, functions[i].name)) + continue; + node = functions[i].func (n); if (!gsk_render_node_write_to_file (node, functions[i].name, &error)) { @@ -259,5 +271,7 @@ main (int argc, char **argv) g_print ("Created test file \"%s\".\n", functions[i].name); } + g_pattern_spec_free (matcher); + return 0; } |