libpurple/tests/test_conversation.c

changeset 42302
54e2bf5af34a
parent 42299
2dce52f93848
child 42316
3985c3404f20
equal deleted inserted replaced
42301:d3930fe5505c 42302:54e2bf5af34a
159 g_clear_object(&creator); 159 g_clear_object(&creator);
160 g_clear_object(&account); 160 g_clear_object(&account);
161 g_clear_object(&conversation); 161 g_clear_object(&conversation);
162 } 162 }
163 163
164 static void
165 test_purple_conversation_set_topic_full(void) {
166 PurpleAccount *account = NULL;
167 PurpleConversation *conversation = NULL;
168 PurpleContactInfo *author = NULL;
169 GDateTime *updated = NULL;
170 GDateTime *updated1 = NULL;
171 const char *topic = "this is the topic";
172
173 account = purple_account_new("test", "test");
174 conversation = g_object_new(
175 PURPLE_TYPE_CONVERSATION,
176 "account", account,
177 "name", "this is required for some reason",
178 NULL);
179
180 g_assert_true(PURPLE_IS_CONVERSATION(conversation));
181
182 author = purple_contact_info_new(NULL);
183 updated = g_date_time_new_now_utc();
184
185 purple_conversation_set_topic_full(conversation, topic, author, updated);
186
187 g_assert_cmpstr(purple_conversation_get_topic(conversation), ==, topic);
188 g_assert_true(purple_conversation_get_topic_author(conversation) ==
189 author);
190
191 updated1 = purple_conversation_get_topic_updated(conversation);
192 g_assert_nonnull(updated1);
193 g_assert_true(g_date_time_equal(updated1, updated));
194
195 g_clear_pointer(&updated, g_date_time_unref);
196 g_clear_object(&author);
197 g_clear_object(&account);
198 g_clear_object(&conversation);
199 }
200
164 /****************************************************************************** 201 /******************************************************************************
165 * Membership tests and helpers 202 * Membership tests and helpers
166 *****************************************************************************/ 203 *****************************************************************************/
167 static void 204 static void
168 test_purple_conversation_membership_signal_cb(PurpleConversation *conversation, 205 test_purple_conversation_membership_signal_cb(PurpleConversation *conversation,
303 340
304 test_ui_purple_init(); 341 test_ui_purple_init();
305 342
306 g_test_add_func("/conversation/properties", 343 g_test_add_func("/conversation/properties",
307 test_purple_conversation_properties); 344 test_purple_conversation_properties);
345 g_test_add_func("/conversation/set-topic-full",
346 test_purple_conversation_set_topic_full);
308 347
309 g_test_add_func("/conversation/members/add-remove", 348 g_test_add_func("/conversation/members/add-remove",
310 test_purple_conversation_members_add_remove); 349 test_purple_conversation_members_add_remove);
311 350
312 g_test_add_func("/conversation/message/write-one", 351 g_test_add_func("/conversation/message/write-one",

mercurial