libpurple/tests/test_conversation_manager.c

changeset 43029
b95b2d2b8200
parent 42891
7f8daf96e7d3
child 43044
b6cb116ce063
--- a/libpurple/tests/test_conversation_manager.c	Thu Oct 31 23:53:14 2024 -0500
+++ b/libpurple/tests/test_conversation_manager.c	Thu Oct 31 23:55:00 2024 -0500
@@ -70,12 +70,13 @@
 }
 
 static void
-test_purple_conversation_manager_register_unregister(void) {
+test_purple_conversation_manager_add_remove(void) {
 	PurpleAccount *account = NULL;
 	PurpleConversationManager *manager = NULL;
 	PurpleConversation *conversation = NULL;
 	GList *conversations = NULL;
-	guint registered_counter = 0, unregistered_counter = 0;
+	guint added_counter = 0;
+	guint removed_counter = 0;
 	gboolean result = FALSE;
 
 	manager = g_object_new(PURPLE_TYPE_CONVERSATION_MANAGER, NULL);
@@ -83,12 +84,12 @@
 	g_assert_true(PURPLE_IS_CONVERSATION_MANAGER(manager));
 
 	/* Wire up our signals. */
-	g_signal_connect(manager, "registered",
+	g_signal_connect(manager, "added",
 	                 G_CALLBACK(test_purple_conversation_manager_counter_cb),
-	                 &registered_counter);
-	g_signal_connect(manager, "unregistered",
+	                 &added_counter);
+	g_signal_connect(manager, "removed",
 	                 G_CALLBACK(test_purple_conversation_manager_counter_cb),
-	                 &unregistered_counter);
+	                 &removed_counter);
 
 	/* Create our account. */
 	account = purple_account_new("test", "test");
@@ -100,7 +101,7 @@
 		NULL);
 
 	/* Add the conversation to the manager. */
-	result = purple_conversation_manager_register(manager, conversation);
+	result = purple_conversation_manager_add(manager, conversation);
 	g_assert_true(result);
 
 	/* Make sure the conversation is available. */
@@ -110,12 +111,12 @@
 	g_list_free(conversations);
 
 	/* Make sure the registered signal was called. */
-	g_assert_cmpuint(registered_counter, ==, 1);
+	g_assert_cmpuint(added_counter, ==, 1);
 
 	/* Remove the contact. */
-	result = purple_conversation_manager_unregister(manager, conversation);
+	result = purple_conversation_manager_remove(manager, conversation);
 	g_assert_true(result);
-	g_assert_cmpuint(unregistered_counter, ==, 1);
+	g_assert_cmpuint(removed_counter, ==, 1);
 
 	/* Clean up.*/
 	g_clear_object(&conversation);
@@ -164,7 +165,7 @@
 		PURPLE_TYPE_CONVERSATION,
 		"account", account,
 		NULL);
-	purple_conversation_manager_register(manager, conversation);
+	purple_conversation_manager_add(manager, conversation);
 
 	/* Set the features and title of the conversation, and verify our counters. */
 	purple_conversation_set_title(conversation, "A place for kool kats");
@@ -178,7 +179,7 @@
 	/* Unregister the conversation, to make sure signals are no longer
 	 * propagated.
 	 */
-	result = purple_conversation_manager_unregister(manager, conversation);
+	result = purple_conversation_manager_remove(manager, conversation);
 	g_assert_true(result);
 
 	counter = 0;
@@ -215,14 +216,14 @@
 		"type", PURPLE_CONVERSATION_TYPE_DM,
 		NULL);
 
-	ret = purple_conversation_manager_register(manager, conversation);
+	ret = purple_conversation_manager_add(manager, conversation);
 	g_assert_true(ret);
 
 	g_assert_cmpuint(counter, ==, 0);
 	purple_conversation_present(conversation);
 	g_assert_cmpuint(counter, ==, 1);
 
-	ret = purple_conversation_manager_unregister(manager, conversation);
+	ret = purple_conversation_manager_remove(manager, conversation);
 	g_assert_true(ret);
 
 	g_assert_finalize_object(manager);
@@ -274,7 +275,7 @@
 		"account", account,
 		"type", PURPLE_CONVERSATION_TYPE_DM,
 		NULL);
-	purple_conversation_manager_register(manager, conversation1);
+	purple_conversation_manager_add(manager, conversation1);
 	members = purple_conversation_get_members(conversation1);
 
 	purple_conversation_members_add_member(members,
@@ -285,7 +286,7 @@
 	g_assert_nonnull(conversation2);
 	g_assert_true(conversation1 == conversation2);
 
-	purple_conversation_manager_unregister(manager, conversation1);
+	purple_conversation_manager_remove(manager, conversation1);
 
 	g_assert_finalize_object(conversation1);
 	g_assert_finalize_object(contact);
@@ -328,7 +329,7 @@
 		"account", account1,
 		"type", PURPLE_CONVERSATION_TYPE_CHANNEL,
 		NULL);
-	purple_conversation_manager_register(manager, conversation1);
+	purple_conversation_manager_add(manager, conversation1);
 
 	/* Create a conversation with the contact's account that is a dm but not
 	 * with the contact.
@@ -338,7 +339,7 @@
 		"account", account1,
 		"type", PURPLE_CONVERSATION_TYPE_DM,
 		NULL);
-	purple_conversation_manager_register(manager, conversation2);
+	purple_conversation_manager_add(manager, conversation2);
 
 	/* Create a conversation with a different account. */
 	conversation3 = g_object_new(
@@ -346,14 +347,14 @@
 		"account", account2,
 		"type", PURPLE_CONVERSATION_TYPE_CHANNEL,
 		NULL);
-	purple_conversation_manager_register(manager, conversation3);
+	purple_conversation_manager_add(manager, conversation3);
 
 	conversation4 = purple_conversation_manager_find_dm(manager, contact);
 	g_assert_null(conversation4);
 
-	purple_conversation_manager_unregister(manager, conversation1);
-	purple_conversation_manager_unregister(manager, conversation2);
-	purple_conversation_manager_unregister(manager, conversation3);
+	purple_conversation_manager_remove(manager, conversation1);
+	purple_conversation_manager_remove(manager, conversation2);
+	purple_conversation_manager_remove(manager, conversation3);
 
 	g_assert_finalize_object(conversation1);
 	g_assert_finalize_object(conversation2);
@@ -378,8 +379,8 @@
 	g_test_add_func("/conversation-manager/new/filename",
 	                test_purple_conversation_manager_new_filename);
 
-	g_test_add_func("/conversation-manager/register-unregister",
-	                test_purple_conversation_manager_register_unregister);
+	g_test_add_func("/conversation-manager/add-remove",
+	                test_purple_conversation_manager_add_remove);
 
 	g_test_add_func("/conversation-manager/signals/conversation-changed",
 	                test_purple_conversation_manager_signal_conversation_changed);

mercurial