[gtk+] tests: Add a patternspec argument for test creation
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tests: Add a patternspec argument for test creation
- Date: Mon, 26 Dec 2016 16:23:07 +0000 (UTC)
commit 573ceb03407b3a4b067aff07fad6bdf196ca8624
Author: Benjamin Otte <otte redhat com>
Date: Mon Dec 26 17:08:06 2016 +0100
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.
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 06519ce..b2d75f1 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]