diff options
author | xclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4> | 2008-10-13 07:54:35 +0000 |
---|---|---|
committer | xclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4> | 2008-10-13 07:54:35 +0000 |
commit | 2371653b163170bbe1904dc5a37330fb50348fdd (patch) | |
tree | 299ae0eaefb0dd120fa4f293aef0288627e88a33 /tests | |
parent | f11e25f829505ffe7e1eabb0209547b79a1ceca0 (diff) | |
download | empathy-2371653b163170bbe1904dc5a37330fb50348fdd.tar.gz |
test chatroom xml parsing
git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@1557 4ee84921-47dd-4033-b63a-18d7a039a3e4
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); |