[gtk+] Use g_test_get_dir in test to locate files



commit c8a392612b23fdfc4a47032251b7aa276a7e1e65
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 29 21:37:05 2013 -0400

    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 62541a1..59fd79a 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 1cf2037..34ee3ae 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 4036072..89a2f5b 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)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]