summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2009-06-08 17:36:39 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2009-06-10 14:37:48 +0100
commita56972077bd9903c020e295a8b64a3776af52c65 (patch)
treebdfa8af029d806ceb044b030308fb35c2424a053 /tests
parent576d73425fcb49ab5f4533a3d49a45badd4cb7b7 (diff)
Add a trivial test for TpAccount, TpAccountManager
These just test that nothing actually crashes when we make a TpAccount and a TpAccountManager.
Diffstat (limited to 'tests')
-rw-r--r--tests/dbus/Makefile.am6
-rw-r--r--tests/dbus/account-manager.c69
-rw-r--r--tests/dbus/account.c79
3 files changed, 154 insertions, 0 deletions
diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am
index 049d550c7..41bcbb092 100644
--- a/tests/dbus/Makefile.am
+++ b/tests/dbus/Makefile.am
@@ -1,6 +1,8 @@
include $(top_srcdir)/tools/shave.mk
noinst_PROGRAMS = \
+ test-account \
+ test-account-manager \
test-call-cancellation \
test-callable-example \
test-channel-introspect \
@@ -39,6 +41,10 @@ LDADD = \
$(top_builddir)/telepathy-glib/libtelepathy-glib.la \
$(top_builddir)/tests/lib/libtp-glib-tests.la
+test_account_SOURCES = account.c
+
+test_account_manager_SOURCES = account-manager.c
+
test_call_cancellation_SOURCES = call-cancellation.c
test_channel_introspect_SOURCES = channel-introspect.c
diff --git a/tests/dbus/account-manager.c b/tests/dbus/account-manager.c
new file mode 100644
index 000000000..7aa373adf
--- /dev/null
+++ b/tests/dbus/account-manager.c
@@ -0,0 +1,69 @@
+/* A very basic feature test for TpAccountManager
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * 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 <telepathy-glib/account-manager.h>
+#include <telepathy-glib/debug.h>
+
+typedef struct {
+ GMainLoop *mainloop;
+ TpDBusDaemon *dbus;
+
+ TpAccountManager *am;
+ 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->am = NULL;
+}
+
+static void
+teardown (Test *test,
+ gconstpointer data)
+{
+ if (test->am != NULL)
+ {
+ g_object_unref (test->am);
+ test->am = 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->am = tp_account_manager_new (test->dbus);
+}
+
+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 ("/am/new", Test, NULL, setup, test_new, teardown);
+
+ return g_test_run ();
+}
diff --git a/tests/dbus/account.c b/tests/dbus/account.c
new file mode 100644
index 000000000..aeb876215
--- /dev/null
+++ b/tests/dbus/account.c
@@ -0,0 +1,79 @@
+/* A very basic feature test for TpAccount
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * 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 <telepathy-glib/account.h>
+#include <telepathy-glib/debug.h>
+
+typedef struct {
+ GMainLoop *mainloop;
+ TpDBusDaemon *dbus;
+
+ TpAccount *account;
+ 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->account = NULL;
+}
+
+static void
+teardown (Test *test,
+ gconstpointer data)
+{
+ if (test->account != NULL)
+ {
+ g_object_unref (test->account);
+ test->account = 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->account = tp_account_new (test->dbus,
+ "/secretly/not/an/object", NULL);
+ g_assert (test->account == NULL);
+
+ test->account = tp_account_new (test->dbus,
+ "not even syntactically valid", NULL);
+ g_assert (test->account == NULL);
+
+ test->account = tp_account_new (test->dbus,
+ "/org/freedesktop/Telepathy/Account/whatever", NULL);
+ g_assert (test->account != 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 ("/account/new", Test, NULL, setup, test_new, teardown);
+
+ return g_test_run ();
+}