empathy r1557 - trunk/tests



Author: xclaesse
Date: Mon Oct 13 07:54:35 2008
New Revision: 1557
URL: http://svn.gnome.org/viewvc/empathy?rev=1557&view=rev

Log:
test chatroom xml parsing

Modified:
   trunk/tests/check-empathy-chatroom-manager.c

Modified: trunk/tests/check-empathy-chatroom-manager.c
==============================================================================
--- trunk/tests/check-empathy-chatroom-manager.c	(original)
+++ trunk/tests/check-empathy-chatroom-manager.c	Mon Oct 13 07:54:35 2008
@@ -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 @@
   gchar *cmd;
   gchar *file;
   McAccount *account;
+  GList *chatrooms, *l;
+  gboolean room1_found, room2_found;
 
   account = create_test_account ();
 
@@ -37,6 +41,39 @@
 
   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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]