GApplication: fix bogus testcase
[platform/upstream/glib.git] / gio / tests / gapplication.c
index 81d5892..b6f911e 100644 (file)
@@ -6,9 +6,6 @@
 #include "gdbus-tests.h"
 #include "gdbus-sessionbus.h"
 
-static const gchar *datapath;
-static const gchar *binpath;
-
 static gint outstanding_watches;
 static GMainLoop *main_loop;
 
@@ -68,7 +65,7 @@ spawn (const gchar *expected_stdout,
 
   va_start (ap, first_arg);
   array = g_ptr_array_new ();
-  g_ptr_array_add (array, g_build_filename (binpath, "basic-application", NULL));
+  g_ptr_array_add (array, g_test_build_filename (G_TEST_BUILT, "basic-application", NULL));
   for (arg = first_arg; arg; arg = va_arg (ap, const gchar *))
     g_ptr_array_add (array, g_strdup (arg));
   g_ptr_array_add (array, NULL);
@@ -110,7 +107,6 @@ basic (void)
   /* spawn the master */
   spawn ("activated\n"
          "open file:///a file:///b\n"
-         "cmdline '40 +' '2'\n"
          "exit status: 0\n",
          "./app", NULL);
 
@@ -118,10 +114,6 @@ basic (void)
   spawn ("exit status: 0\n",
          "./app", "/a", "/b", NULL);
 
-  spawn ("40 + 2 = 42\n"
-         "exit status: 42\n",
-         "./cmd", "40 +", "2", NULL);
-
   g_main_loop_run (main_loop);
 
   g_object_unref (c);
@@ -323,7 +315,7 @@ nodbus_activate (GApplication *app)
 static void
 test_nodbus (void)
 {
-  char *binpath = g_build_filename (datapath, "unimportant", NULL);
+  char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
   gchar *argv[] = { binpath, NULL };
   GApplication *app;
 
@@ -353,7 +345,7 @@ noappid_activate (GApplication *app)
 static void
 test_noappid (void)
 {
-  char *binpath = g_build_filename (datapath, "unimportant", NULL);
+  char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
   gchar *argv[] = { binpath, NULL };
   GApplication *app;
 
@@ -392,7 +384,7 @@ static void
 test_quit (void)
 {
   GDBusConnection *c;
-  char *binpath = g_build_filename (datapath, "unimportant", NULL);
+  char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
   gchar *argv[] = { binpath, NULL };
   GApplication *app;
 
@@ -448,12 +440,10 @@ on_activate (GApplication *app)
 static void
 test_actions (void)
 {
-  char *binpath = g_build_filename (datapath, "unimportant", NULL);
+  char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
   gchar *argv[] = { binpath, NULL };
   GApplication *app;
 
-  g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
-
   app = g_application_new ("org.gtk.Unimportant",
                            G_APPLICATION_FLAGS_NONE);
   g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL);
@@ -504,12 +494,10 @@ test_loc_cmd_app_class_init (TestLocCmdAppClass *klass)
 static void
 test_local_command_line (void)
 {
-  char *binpath = g_build_filename (datapath, "unimportant", NULL);
+  char *binpath = g_test_build_filename (G_TEST_BUILT, "unimportant", NULL);
   gchar *argv[] = { binpath, "-invalid", NULL };
   GApplication *app;
 
-  g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
-
   app = g_object_new (test_loc_cmd_app_get_type (),
                       "application-id", "org.gtk.Unimportant",
                       "flags", G_APPLICATION_FLAGS_NONE,
@@ -522,14 +510,6 @@ test_local_command_line (void)
 int
 main (int argc, char **argv)
 {
-  if (g_getenv ("G_TEST_DATA"))
-    datapath = binpath = g_getenv ("G_TEST_DATA");
-  else
-    {
-      datapath = SRCDIR;
-      binpath = BUILDDIR;
-    }
-
   g_test_init (&argc, &argv, NULL);
 
   g_test_dbus_unset ();