#include "gdbus-tests.h"
#include "gdbus-sessionbus.h"
+static const gchar *datapath;
+
static gint outstanding_watches;
static GMainLoop *main_loop;
va_start (ap, first_arg);
array = g_ptr_array_new ();
- g_ptr_array_add (array, g_strdup ("./basic-application"));
+ g_ptr_array_add (array, g_build_filename (datapath, "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);
static void
test_nodbus (void)
{
- gchar *argv[] = { "./unimportant", NULL };
+ char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ gchar *argv[] = { binpath, NULL };
GApplication *app;
app = g_application_new ("org.gtk.Unimportant", G_APPLICATION_FLAGS_NONE);
g_object_unref (app);
g_assert (nodbus_activated);
+ g_free (binpath);
}
static gboolean noappid_activated;
static void
test_noappid (void)
{
- gchar *argv[] = { "./unimportant", NULL };
+ char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ gchar *argv[] = { binpath, NULL };
GApplication *app;
app = g_application_new (NULL, G_APPLICATION_FLAGS_NONE);
g_object_unref (app);
g_assert (noappid_activated);
+ g_free (binpath);
}
test_quit (void)
{
GDBusConnection *c;
- gchar *argv[] = { "./unimportant", NULL };
+ char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ gchar *argv[] = { binpath, NULL };
GApplication *app;
session_bus_up ();
g_assert (quit_activated);
session_bus_down ();
+ g_free (binpath);
}
static void
static void
test_actions (void)
{
- gchar *argv[] = { "./unimportant", NULL };
+ char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ gchar *argv[] = { binpath, NULL };
GApplication *app;
g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL);
g_application_run (app, 1, argv);
g_object_unref (app);
+ g_free (binpath);
}
typedef GApplication TestLocCmdApp;
static void
test_local_command_line (void)
{
- gchar *argv[] = { "./unimportant", "-invalid", NULL };
+ char *binpath = g_build_filename (datapath, "unimportant", NULL);
+ gchar *argv[] = { binpath, "-invalid", NULL };
GApplication *app;
g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
NULL);
g_application_run (app, 1, argv);
g_object_unref (app);
+ g_free (binpath);
}
int
main (int argc, char **argv)
{
+ if (g_getenv ("G_TEST_DATA"))
+ datapath = g_getenv ("G_TEST_DATA");
+ else
+ datapath = SRCDIR;
g_test_init (&argc, &argv, NULL);
g_test_dbus_unset ();