empathy r1562 - trunk/tests
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r1562 - trunk/tests
- Date: Mon, 13 Oct 2008 07:54:53 +0000 (UTC)
Author: xclaesse
Date: Mon Oct 13 07:54:53 2008
New Revision: 1562
URL: http://svn.gnome.org/viewvc/empathy?rev=1562&view=rev
Log:
test empathy_chatroom_manager_remove
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:53 2008
@@ -174,6 +174,61 @@
}
END_TEST
+START_TEST (test_empathy_chatroom_manager_remove)
+{
+ EmpathyChatroomManager *mgr;
+ gchar *cmd;
+ gchar *file;
+ McAccount *account;
+ struct chatroom_t chatrooms[] = {
+ { "name2", "room2", FALSE, TRUE }};
+ EmpathyChatroom *chatroom;
+
+ account = create_test_account ();
+
+ copy_xml_file (CHATROOM_SAMPLE, CHATROOM_FILE);
+
+ file = get_user_xml_file (CHATROOM_FILE);
+ /* change the chatrooms XML file to use the account we just created */
+ cmd = g_strdup_printf ("sed -i 's/CHANGE_ME/%s/' %s",
+ mc_account_get_unique_name (account), file);
+ system (cmd);
+ g_free (cmd);
+
+ mgr = empathy_chatroom_manager_new (file);
+
+ /* remove room1 */
+ chatroom = empathy_chatroom_manager_find (mgr, account, "room1");
+ fail_if (chatroom == NULL);
+ empathy_chatroom_manager_remove (mgr, chatroom);
+
+ check_chatrooms_list (mgr, account, chatrooms, 1);
+
+ /* reload chatrooms file */
+ g_object_unref (mgr);
+ mgr = empathy_chatroom_manager_new (file);
+
+ check_chatrooms_list (mgr, account, chatrooms, 1);
+
+ /* remove room1 */
+ chatroom = empathy_chatroom_manager_find (mgr, account, "room2");
+ fail_if (chatroom == NULL);
+
+ empathy_chatroom_manager_remove (mgr, chatroom);
+
+ check_chatrooms_list (mgr, account, chatrooms, 0);
+
+ /* reload chatrooms file */
+ g_object_unref (mgr);
+ mgr = empathy_chatroom_manager_new (file);
+
+ check_chatrooms_list (mgr, account, chatrooms, 0);
+
+ g_object_unref (mgr);
+ g_free (file);
+ destroy_test_account (account);
+}
+END_TEST
TCase *
make_empathy_chatroom_manager_tcase (void)
@@ -181,5 +236,6 @@
TCase *tc = tcase_create ("empathy-chatroom-manager");
tcase_add_test (tc, test_empathy_chatroom_manager_new);
tcase_add_test (tc, test_empathy_chatroom_manager_add);
+ tcase_add_test (tc, test_empathy_chatroom_manager_remove);
return tc;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]