| 110 static void |
110 static void |
| 111 test_purple_person_contacts_single(void) { |
111 test_purple_person_contacts_single(void) { |
| 112 PurpleAccount *account = NULL; |
112 PurpleAccount *account = NULL; |
| 113 PurpleContact *contact = NULL; |
113 PurpleContact *contact = NULL; |
| 114 PurplePerson *person = NULL; |
114 PurplePerson *person = NULL; |
| |
115 PurplePerson *person1 = NULL; |
| 115 guint n_items = 0; |
116 guint n_items = 0; |
| 116 gboolean removed = FALSE; |
117 gboolean removed = FALSE; |
| 117 gboolean changed = FALSE; |
118 gboolean changed = FALSE; |
| 118 |
119 |
| 119 account = purple_account_new("test", "test"); |
120 account = purple_account_new("test", "test"); |
| 127 purple_person_add_contact(person, contact); |
128 purple_person_add_contact(person, contact); |
| 128 n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); |
129 n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); |
| 129 g_assert_cmpuint(n_items, ==, 1); |
130 g_assert_cmpuint(n_items, ==, 1); |
| 130 g_assert_true(changed); |
131 g_assert_true(changed); |
| 131 |
132 |
| |
133 person1 = purple_contact_get_person(contact); |
| |
134 g_assert_true(person1 == person); |
| |
135 |
| 132 changed = FALSE; |
136 changed = FALSE; |
| 133 |
137 |
| 134 removed = purple_person_remove_contact(person, contact); |
138 removed = purple_person_remove_contact(person, contact); |
| 135 g_assert_true(removed); |
139 g_assert_true(removed); |
| 136 n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); |
140 n_items = g_list_model_get_n_items(G_LIST_MODEL(person)); |
| 137 g_assert_cmpuint(n_items, ==, 0); |
141 g_assert_cmpuint(n_items, ==, 0); |
| 138 g_assert_true(changed); |
142 g_assert_true(changed); |
| 139 |
143 |
| |
144 person1 = purple_contact_get_person(contact); |
| |
145 g_assert_null(person1); |
| |
146 |
| 140 g_clear_object(&person); |
147 g_clear_object(&person); |
| 141 g_clear_object(&account); |
148 g_clear_object(&account); |
| |
149 g_clear_object(&contact); |
| 142 } |
150 } |
| 143 |
151 |
| 144 static void |
152 static void |
| 145 test_purple_person_contacts_multiple(void) { |
153 test_purple_person_contacts_multiple(void) { |
| 146 PurpleAccount *account = NULL; |
154 PurpleAccount *account = NULL; |