mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-31 16:26:19 +01:00
Fix GApplication tests to run without a session bus
We reuse code from the GDBus tests here to launch a session bus.
This commit is contained in:
parent
db0c55608f
commit
6720596544
@ -253,7 +253,7 @@ gdbus_example_proxy_subclass_LDADD = $(progs_ldadd)
|
||||
gdbus_example_export_SOURCES = gdbus-example-export.c
|
||||
gdbus_example_export_LDADD = $(progs_ldadd)
|
||||
|
||||
application_SOURCES = application.c
|
||||
application_SOURCES = application.c gdbus-sessionbus.c gdbus-sessionbus.h
|
||||
application_LDADD = $(progs_ldadd)
|
||||
|
||||
appinfo_SOURCES = appinfo.c
|
||||
@ -265,7 +265,7 @@ appinfo_test_LDADD = $(progs_ldadd)
|
||||
testapp_SOURCES = testapp.c
|
||||
testapp_LDADD = $(progs_ldadd)
|
||||
|
||||
testapps_SOURCES = testapps.c
|
||||
testapps_SOURCES = testapps.c gdbus-sessionbus.c gdbus-sessionbus.h
|
||||
testapps_LDADD = $(progs_ldadd)
|
||||
|
||||
EXTRA_DIST += \
|
||||
|
@ -2,6 +2,8 @@
|
||||
#include <gio.h>
|
||||
#include <gstdio.h>
|
||||
|
||||
#include "gdbus-sessionbus.h"
|
||||
|
||||
enum
|
||||
{
|
||||
INVOKE_ACTION,
|
||||
@ -125,10 +127,21 @@ test_basic (void)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gint ret;
|
||||
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_unsetenv ("DISPLAY");
|
||||
g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_bus_get_temporary_address (), TRUE);
|
||||
|
||||
session_bus_up ();
|
||||
|
||||
g_test_add_func ("/application/basic", test_basic);
|
||||
|
||||
return g_test_run ();
|
||||
ret = g_test_run ();
|
||||
|
||||
session_bus_down ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "gdbus-sessionbus.h"
|
||||
|
||||
static gint appeared;
|
||||
static gint disappeared;
|
||||
static gint changed;
|
||||
@ -518,9 +520,16 @@ test_change_action (void)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gint ret;
|
||||
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_unsetenv ("DISPLAY");
|
||||
g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_bus_get_temporary_address (), TRUE);
|
||||
|
||||
session_bus_up ();
|
||||
|
||||
g_test_add_func ("/application/unique", test_unique);
|
||||
g_test_add_func ("/application/quit", test_quit);
|
||||
g_test_add_func ("/application/list-actions", test_list_actions);
|
||||
@ -528,6 +537,10 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/application/remote", test_remote);
|
||||
g_test_add_func ("/application/change-action", test_change_action);
|
||||
|
||||
return g_test_run ();
|
||||
ret = g_test_run ();
|
||||
|
||||
session_bus_down ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user