]> git.0d.be Git - empathy.git/commitdiff
test chatroom xml parsing
authorXavier Claessens <xclaesse@src.gnome.org>
Mon, 13 Oct 2008 07:54:35 +0000 (07:54 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Mon, 13 Oct 2008 07:54:35 +0000 (07:54 +0000)
svn path=/trunk/; revision=1557

tests/check-empathy-chatroom-manager.c

index 4c7c882c6cf4c620493a164ff1fc0b42b81008db..5ea7fe8a78688d5fc0f9bbaef6e2de5e512d46bd 100644 (file)
@@ -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);