forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
d7e867aa95
commit
573ceb0340
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user