#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;
}
fail_if (auto_connect);
fail_if (favorite);
+ g_object_unref (empathy_chatroom_get_account (chatroom));
g_object_unref (chatroom);
}
END_TEST
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;
}