From c8a392612b23fdfc4a47032251b7aa276a7e1e65 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 29 May 2013 21:37:05 -0400 Subject: [PATCH] Use g_test_get_dir in test to locate files This makes the tests work both installed and for make check. --- testsuite/a11y/accessibility-dump.c | 6 +----- testsuite/css/parser/test-css-parser.c | 7 +------ testsuite/reftests/gtk-reftest.c | 4 +--- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/testsuite/a11y/accessibility-dump.c b/testsuite/a11y/accessibility-dump.c index 62541a14fa..59fd79a521 100644 --- a/testsuite/a11y/accessibility-dump.c +++ b/testsuite/a11y/accessibility-dump.c @@ -861,13 +861,9 @@ main (int argc, char **argv) if (arg_base_dir) basedir = arg_base_dir; - else if (g_getenv ("srcdir")) - basedir = g_getenv ("srcdir"); else - basedir = "."; - + basedir = g_test_get_dir (G_TEST_DIST); dir = g_file_new_for_path (basedir); - add_tests_for_files_in_directory (dir); g_object_unref (dir); diff --git a/testsuite/css/parser/test-css-parser.c b/testsuite/css/parser/test-css-parser.c index 1cf20379fc..34ee3ae7dd 100644 --- a/testsuite/css/parser/test-css-parser.c +++ b/testsuite/css/parser/test-css-parser.c @@ -393,13 +393,8 @@ main (int argc, char **argv) const char *basedir; GFile *dir; - if (g_getenv ("srcdir")) - basedir = g_getenv ("srcdir"); - else - basedir = "."; - + basedir = g_test_get_dir (G_TEST_DIST); dir = g_file_new_for_path (basedir); - add_tests_for_files_in_directory (dir); g_object_unref (dir); diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c index 4036072cf0..89a2f5bdb4 100644 --- a/testsuite/reftests/gtk-reftest.c +++ b/testsuite/reftests/gtk-reftest.c @@ -584,10 +584,8 @@ main (int argc, char **argv) if (arg_base_dir) basedir = arg_base_dir; - else if (g_getenv ("srcdir")) - basedir = g_getenv ("srcdir"); else - basedir = "."; + basedir = g_test_get_dir (G_TEST_DIST); if (argc < 2) {