diff options
Diffstat (limited to 'tests/check-empathy-chatroom-manager.c')
-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); |