diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-10-13 15:55:02 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-10-13 15:55:02 +0800 |
commit | 8486629b36efe0ab5a75678be0e346a51063ae4a (patch) | |
tree | 6647c9894b8b234a540dd90785c14392d4892a09 /tests | |
parent | d9c01063fec33821f1aff0b37afa4ace240498c7 (diff) | |
download | gsoc2013-empathy-8486629b36efe0ab5a75678be0e346a51063ae4a.tar gsoc2013-empathy-8486629b36efe0ab5a75678be0e346a51063ae4a.tar.gz gsoc2013-empathy-8486629b36efe0ab5a75678be0e346a51063ae4a.tar.bz2 gsoc2013-empathy-8486629b36efe0ab5a75678be0e346a51063ae4a.tar.lz gsoc2013-empathy-8486629b36efe0ab5a75678be0e346a51063ae4a.tar.xz gsoc2013-empathy-8486629b36efe0ab5a75678be0e346a51063ae4a.tar.zst gsoc2013-empathy-8486629b36efe0ab5a75678be0e346a51063ae4a.zip |
test empathy chatroom manager change favorite
svn path=/trunk/; revision=1565
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check-empathy-chatroom-manager.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/check-empathy-chatroom-manager.c b/tests/check-empathy-chatroom-manager.c index 22be67360..fa0be544d 100644 --- a/tests/check-empathy-chatroom-manager.c +++ b/tests/check-empathy-chatroom-manager.c @@ -230,6 +230,70 @@ START_TEST (test_empathy_chatroom_manager_remove) } END_TEST +START_TEST (test_empathy_chatroom_manager_change_favorite) +{ + EmpathyChatroomManager *mgr; + gchar *cmd; + gchar *file; + McAccount *account; + struct chatroom_t chatrooms[] = { + { "name1", "room1", TRUE, TRUE }, + { "name2", "room2", FALSE, FALSE }}; + 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); + + /* room2 is not favorite anymore */ + chatroom = empathy_chatroom_manager_find (mgr, account, "room2"); + fail_if (chatroom == NULL); + g_object_set (chatroom, "favorite", FALSE, NULL); + + check_chatrooms_list (mgr, account, chatrooms, 2); + + /* reload chatrooms file */ + g_object_unref (mgr); + mgr = empathy_chatroom_manager_new (file); + + /* room2 is not present in the XML file anymore as it's not a favorite */ + check_chatrooms_list (mgr, account, chatrooms, 1); + + /* re-add room2 */ + chatroom = empathy_chatroom_new_full (account, "room2", "name2", FALSE); + empathy_chatroom_manager_add (mgr, chatroom); + + check_chatrooms_list (mgr, account, chatrooms, 2); + + /* set room2 as favorite */ + g_object_set (chatroom, "favorite", TRUE, NULL); + + chatrooms[1].favorite = TRUE; + check_chatrooms_list (mgr, account, chatrooms, 2); + + /* reload chatrooms file */ + g_object_unref (mgr); + mgr = empathy_chatroom_manager_new (file); + + /* room2 is back in the XML file now */ + check_chatrooms_list (mgr, account, chatrooms, 2); + + g_object_unref (mgr); + g_object_unref (chatroom); + g_free (file); + destroy_test_account (account); +} +END_TEST + TCase * make_empathy_chatroom_manager_tcase (void) { @@ -237,5 +301,6 @@ make_empathy_chatroom_manager_tcase (void) 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); + tcase_add_test (tc, test_empathy_chatroom_manager_change_favorite); return tc; } |