summaryrefslogtreecommitdiff
path: root/tests/test-common.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-10-06 04:16:12 +0200
committerBenjamin Otte <otte@redhat.com>2015-10-13 02:56:48 +0200
commit11b59a0db87f666a82b04a4cd455e6d935ece0a4 (patch)
treebcda102e0450af41b9aa71d767984f9b376b2fa6 /tests/test-common.c
parentcc31abae997a120d45622d292e35a9881d0c4c74 (diff)
downloadgdk-pixbuf-11b59a0db87f666a82b04a4cd455e6d935ece0a4.tar.gz
tests: Allow passing a filter function when adding all files
... and use it to not add reference images.
Diffstat (limited to 'tests/test-common.c')
-rw-r--r--tests/test-common.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/test-common.c b/tests/test-common.c
index 94983013b..fef9d947c 100644
--- a/tests/test-common.c
+++ b/tests/test-common.c
@@ -175,7 +175,8 @@ pixdata_equal (GdkPixbuf *test,
void
add_test_for_all_images (const gchar *prefix,
const gchar *path,
- GTestDataFunc test_func)
+ GTestDataFunc test_func,
+ AddTestFunc add_test_func)
{
GDir *dir;
const gchar *name;
@@ -188,10 +189,13 @@ add_test_for_all_images (const gchar *prefix,
test_path = g_strconcat (prefix, "/", name, NULL);
dir_path = g_strconcat (path, "/", name, NULL);
- if (g_file_test (dir_path, G_FILE_TEST_IS_DIR))
- add_test_for_all_images (test_path, dir_path, test_func);
- else
- g_test_add_data_func_full (test_path, g_strdup (dir_path), test_func, g_free);
+ if (add_test_func == NULL || add_test_func (dir_path))
+ {
+ if (g_file_test (dir_path, G_FILE_TEST_IS_DIR))
+ add_test_for_all_images (test_path, dir_path, test_func, add_test_func);
+ else
+ g_test_add_data_func_full (test_path, g_strdup (dir_path), test_func, g_free);
+ }
g_free (test_path);
g_free (dir_path);
}