diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-10-13 15:54:35 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-10-13 15:54:35 +0800 |
commit | 98936f8fac2745671d5623d443b95bc338d68908 (patch) | |
tree | 299ae0eaefb0dd120fa4f293aef0288627e88a33 /tests | |
parent | f56f6a487e381b351a98ce188c8b418b3b5b0c87 (diff) | |
download | gsoc2013-empathy-98936f8fac2745671d5623d443b95bc338d68908.tar gsoc2013-empathy-98936f8fac2745671d5623d443b95bc338d68908.tar.gz gsoc2013-empathy-98936f8fac2745671d5623d443b95bc338d68908.tar.bz2 gsoc2013-empathy-98936f8fac2745671d5623d443b95bc338d68908.tar.lz gsoc2013-empathy-98936f8fac2745671d5623d443b95bc338d68908.tar.xz gsoc2013-empathy-98936f8fac2745671d5623d443b95bc338d68908.tar.zst gsoc2013-empathy-98936f8fac2745671d5623d443b95bc338d68908.zip |
test chatroom xml parsing
svn path=/trunk/; revision=1557
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check-empathy-chatroom-manager.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/check-empathy-chatroom-manager.c b/tests/check-empathy-chatroom-manager.c index 4c7c882c6..5ea7fe8a7 100644 --- a/tests/check-empathy-chatroom-manager.c +++ b/tests/check-empathy-chatroom-manager.c @@ -5,7 +5,9 @@ #include <gconf/gconf.h> #include <gconf/gconf-client.h> +#include <telepathy-glib/util.h> #include <check.h> + #include "check-helpers.h" #include "check-libempathy.h" #include "check-empathy-helpers.h" @@ -21,6 +23,8 @@ START_TEST (test_empathy_chatroom_manager_new) gchar *cmd; gchar *file; McAccount *account; + GList *chatrooms, *l; + gboolean room1_found, room2_found; account = create_test_account (); @@ -37,6 +41,39 @@ START_TEST (test_empathy_chatroom_manager_new) fail_if (empathy_chatroom_manager_get_count (mgr, account) != 2); + chatrooms = empathy_chatroom_manager_get_chatrooms (mgr, account); + fail_if (g_list_length (chatrooms) != 2); + + room1_found = room2_found = FALSE; + for (l = chatrooms; l != NULL; l = g_list_next (l)) + { + EmpathyChatroom *chatroom = l->data; + gboolean favorite; + + if (!tp_strdiff (empathy_chatroom_get_room (chatroom), "room1")) + { + room1_found = TRUE; + fail_if (tp_strdiff (empathy_chatroom_get_name (chatroom), "name1")); + fail_if (!empathy_chatroom_get_auto_connect (chatroom)); + g_object_get (chatroom, "favorite", &favorite, NULL); + fail_if (!favorite); + } + else if (!tp_strdiff (empathy_chatroom_get_room (chatroom), "room2")) + { + room2_found = TRUE; + fail_if (tp_strdiff (empathy_chatroom_get_name (chatroom), "name2")); + fail_if (empathy_chatroom_get_auto_connect (chatroom)); + g_object_get (chatroom, "favorite", &favorite, NULL); + fail_if (!favorite); + } + else + { + g_assert_not_reached (); + } + } + + fail_if (!room1_found || !room2_found); + g_free (file); g_object_unref (mgr); destroy_test_account (account); |