]> git.0d.be Git - empathy.git/blobdiff - tests/check-empathy-chatroom.c
Updated Basque translation.
[empathy.git] / tests / check-empathy-chatroom.c
index fca2f128670f28da70908278caed7b9ad191827b..a4adf6ce1be62aa7f93c936bf89bce147df7e49f 100644 (file)
@@ -5,29 +5,20 @@
 #include <check.h>
 #include "check-helpers.h"
 #include "check-libempathy.h"
+#include "check-empathy-helpers.h"
 
 #include <libempathy/empathy-chatroom.h>
 
 static EmpathyChatroom *
 create_chatroom (void)
 {
-  McProfile *profile;
   McAccount *account;
   EmpathyChatroom *chatroom;
 
-  /* FIXME: we should fake the profile */
-  profile = mc_profile_lookup ("jabber");
-  account = mc_account_create (profile);
+  account = get_test_account ();
   chatroom = empathy_chatroom_new (account);
   fail_if (chatroom == NULL);
 
-  /* destroy the account as we don't have to add it to the accounts
-   * configuration */
-  /* FIXME: the account is not really removed */
-  mc_account_delete (account);
-  g_object_unref (profile);
-  g_object_unref (account);
-
   return chatroom;
 }
 
@@ -45,6 +36,7 @@ START_TEST (test_empathy_chatroom_new)
   fail_if (auto_connect);
   fail_if (favorite);
 
+  g_object_unref (empathy_chatroom_get_account (chatroom));
   g_object_unref (chatroom);
 }
 END_TEST
@@ -117,15 +109,47 @@ START_TEST (test_favorite_and_auto_connect)
   fail_if (auto_connect);
   fail_if (favorite);
 
+  g_object_unref (empathy_chatroom_get_account (chatroom));
   g_object_unref (chatroom);
 }
 END_TEST
 
+static void
+favorite_changed (EmpathyChatroom *chatroom,
+                  GParamSpec *spec,
+                  gboolean *changed)
+{
+  *changed = TRUE;
+}
+
+START_TEST (test_change_favorite)
+{
+  EmpathyChatroom *chatroom;
+  gboolean changed = FALSE;
+
+  chatroom = create_chatroom ();
+
+  g_signal_connect (chatroom, "notify::favorite", G_CALLBACK (favorite_changed),
+      &changed);
+
+  /* change favorite to TRUE */
+  g_object_set (chatroom, "favorite", TRUE, NULL);
+  fail_if (!changed);
+
+  changed = FALSE;
+
+  /* change favorite to FALSE */
+  g_object_set (chatroom, "favorite", FALSE, NULL);
+  fail_if (!changed);
+}
+END_TEST
+
 TCase *
 make_empathy_chatroom_tcase (void)
 {
     TCase *tc = tcase_create ("empathy-chatroom");
     tcase_add_test (tc, test_empathy_chatroom_new);
     tcase_add_test (tc, test_favorite_and_auto_connect);
+    tcase_add_test (tc, test_change_favorite);
     return tc;
 }