aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:48 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:48 +0800
commit986d96b556e52913228c3b51b6e10edfd94a5641 (patch)
tree82bdeeec32ada589785e2dd24b8b1d94b76b1fbd
parentcd2c292aefc1ce60bf51a7e9aaa070dd59ef7c44 (diff)
downloadgsoc2013-empathy-986d96b556e52913228c3b51b6e10edfd94a5641.tar
gsoc2013-empathy-986d96b556e52913228c3b51b6e10edfd94a5641.tar.gz
gsoc2013-empathy-986d96b556e52913228c3b51b6e10edfd94a5641.tar.bz2
gsoc2013-empathy-986d96b556e52913228c3b51b6e10edfd94a5641.tar.lz
gsoc2013-empathy-986d96b556e52913228c3b51b6e10edfd94a5641.tar.xz
gsoc2013-empathy-986d96b556e52913228c3b51b6e10edfd94a5641.tar.zst
gsoc2013-empathy-986d96b556e52913228c3b51b6e10edfd94a5641.zip
check_chatrooms_list: don't depend on the order of the chatrooms in the list
svn path=/trunk/; revision=1560
-rw-r--r--tests/check-empathy-chatroom-manager.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/tests/check-empathy-chatroom-manager.c b/tests/check-empathy-chatroom-manager.c
index 97feb7bfd..bd056cd38 100644
--- a/tests/check-empathy-chatroom-manager.c
+++ b/tests/check-empathy-chatroom-manager.c
@@ -49,19 +49,36 @@ check_chatrooms_list (EmpathyChatroomManager *mgr,
{
GList *chatrooms, *l;
guint i;
+ GHashTable *found;
fail_if (empathy_chatroom_manager_get_count (mgr, account) != nb_chatrooms);
+ found = g_hash_table_new (g_str_hash, g_str_equal);
+ for (i = 0; i < nb_chatrooms; i++)
+ {
+ g_hash_table_insert (found, _chatrooms[i].room, &_chatrooms[i]);
+ }
+
chatrooms = empathy_chatroom_manager_get_chatrooms (mgr, account);
fail_if (g_list_length (chatrooms) != nb_chatrooms);
- for (l = chatrooms, i = 0; l != NULL; l = g_list_next (l), i++)
+ for (l = chatrooms; l != NULL; l = g_list_next (l))
{
EmpathyChatroom *chatroom = l->data;
+ struct chatroom_t *tmp;
+
+ tmp = g_hash_table_lookup (found, empathy_chatroom_get_room (chatroom));
+ fail_if (tmp == NULL);
- check_chatroom (chatroom, _chatrooms[i].name, _chatrooms[i].room,
- _chatrooms[i].auto_connect, _chatrooms[i].favorite);
+ check_chatroom (chatroom, tmp->name, tmp->room, tmp->auto_connect,
+ tmp->favorite);
+
+ g_hash_table_remove (found, empathy_chatroom_get_room (chatroom));
}
+
+ fail_if (g_hash_table_size (found) != 0);
+
+ g_hash_table_destroy (found);
}
START_TEST (test_empathy_chatroom_manager_new)
@@ -71,8 +88,8 @@ START_TEST (test_empathy_chatroom_manager_new)
gchar *file;
McAccount *account;
struct chatroom_t chatrooms[] = {
- { "name2", "room2", FALSE, TRUE },
- { "name1", "room1", TRUE, TRUE }};
+ { "name1", "room1", TRUE, TRUE },
+ { "name2", "room2", FALSE, TRUE }};
account = create_test_account ();