/* A very basic feature test for TpChannelDispatcher
*
* Copyright (C) 2009 Collabora Ltd.
* Copyright (C) 2009 Nokia Corporation
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved.
*/
#include
#include
typedef struct {
GMainLoop *mainloop;
TpDBusDaemon *dbus;
TpChannelDispatcher *cd;
GError *error /* initialized where needed */;
} Test;
static void
setup (Test *test,
gconstpointer data)
{
g_type_init ();
tp_debug_set_flags ("all");
test->mainloop = g_main_loop_new (NULL, FALSE);
test->dbus = tp_dbus_daemon_dup (NULL);
g_assert (test->dbus != NULL);
test->cd = NULL;
}
static void
teardown (Test *test,
gconstpointer data)
{
if (test->cd != NULL)
{
g_object_unref (test->cd);
test->cd = NULL;
}
g_object_unref (test->dbus);
test->dbus = NULL;
g_main_loop_unref (test->mainloop);
test->mainloop = NULL;
}
static void
test_new (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
test->cd = tp_channel_dispatcher_new (test->dbus);
g_assert (test->cd != NULL);
}
int
main (int argc,
char **argv)
{
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugs.freedesktop.org/show_bug.cgi?id=");
g_test_add ("/cd/new", Test, NULL, setup, test_new, teardown);
return g_test_run ();
}