diff -r 64287dd40326 -r c5877e2c93f2 libpurple/tests/test_person.c --- a/libpurple/tests/test_person.c Sat Oct 01 01:48:31 2022 -0500 +++ b/libpurple/tests/test_person.c Sat Oct 01 01:50:52 2022 -0500 @@ -236,19 +236,18 @@ priority = purple_person_get_priority_contact(person); g_assert_null(priority); - /* Build the presence and status for the contact. */ - presence = g_object_new(PURPLE_TYPE_PRESENCE, NULL); + /* Now create a real contact. */ + contact = purple_contact_new(account, "username"); + purple_person_add_contact(person, contact); + + /* Set the status of the contact. */ + presence = purple_contact_get_presence(contact); status_type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, "available", "Available", FALSE); status = purple_status_new(status_type, presence); g_object_set(G_OBJECT(presence), "active-status", status, NULL); g_clear_object(&status); - /* Now create a real contact. */ - contact = purple_contact_new(account, "username"); - purple_contact_set_presence(contact, presence); - purple_person_add_contact(person, contact); - g_assert_true(called); priority = purple_person_get_priority_contact(person); @@ -309,17 +308,16 @@ /* Set changed to false as it shouldn't be changed. */ changed = FALSE; - /* Build the presence and status for the contact. */ - presence = g_object_new(PURPLE_TYPE_PRESENCE, NULL); - status = purple_status_new(offline, presence); - g_object_set(G_OBJECT(presence), "active-status", status, NULL); - g_clear_object(&status); - /* Now create a real contact. */ username = g_strdup_printf("username%d", i + 1); contact = purple_contact_new(account, username); g_free(username); - purple_contact_set_presence(contact, presence); + + /* Set the status for the contact. */ + presence = purple_contact_get_presence(contact); + status = purple_status_new(offline, presence); + g_object_set(G_OBJECT(presence), "active-status", status, NULL); + g_clear_object(&status); purple_person_add_contact(person, contact); @@ -336,7 +334,6 @@ } g_clear_object(&contact); - g_clear_object(&presence); } n_items = g_list_model_get_n_items(G_LIST_MODEL(person));