* Purple is the legal property of its developers, whose names are too * numerous to list here. Please refer to the COPYRIGHT file distributed * with this source distribution * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA /****************************************************************************** * PurpleProtcolAttention Implementations *****************************************************************************/ static GType test_purple_protocol_attention_get_type(void); } TestPurpleProtocolAttention; PurpleProtocolClass parent; } TestPurpleProtocolAttentionClass; test_purple_protocol_attention_send(PurpleProtocolAttention *attn, PurpleConnection *c, const gchar *username, guint type) { TestPurpleProtocolAttention *test_attn = (TestPurpleProtocolAttention *)attn; test_attn->send_called = TRUE; test_purple_protocol_attention_get_types(PurpleProtocolAttention *attn, PurpleAccount *acct) { types = g_list_append(types, purple_attention_type_new("id", "name", "incoming", "outgoing")); test_purple_protocol_attention_iface_init(PurpleProtocolAttentionInterface *iface) { iface->send = test_purple_protocol_attention_send; iface->get_types = test_purple_protocol_attention_get_types; TestPurpleProtocolAttention, test_purple_protocol_attention, PURPLE_TYPE_PROTOCOL_ATTENTION, test_purple_protocol_attention_iface_init test_purple_protocol_attention_init(TestPurpleProtocolAttention *prplattn) { PurpleProtocol *prpl = PURPLE_PROTOCOL(prplattn); prpl->id = "prpl-attention"; test_purple_protocol_attention_class_init(TestPurpleProtocolAttentionClass *klass) { /****************************************************************************** *****************************************************************************/ test_purple_protocol_attention_can_send(void) { TestPurpleProtocolAttention *attn = g_object_new(test_purple_protocol_attention_get_type(), NULL); PurpleAccount *a = purple_account_new("prpl-attn-can-send", "prpl-attn"); PurpleConnection *c = g_object_new(PURPLE_TYPE_CONNECTION, "account", a, NULL); attn->send_called = FALSE; actual = purple_protocol_attention_send(PURPLE_PROTOCOL_ATTENTION(attn), c, "someguy", 0); g_assert_true(attn->send_called); test_purple_protocol_attention_can_get_types(void) { TestPurpleProtocolAttention *attn = g_object_new(test_purple_protocol_attention_get_type(), NULL); PurpleAccount *a = purple_account_new("prpl-attn-can-get-types", "prpl-attn"); PurpleAttentionType *type = NULL; types = purple_protocol_attention_get_types(PURPLE_PROTOCOL_ATTENTION(attn), a); g_assert_true(g_list_length(types) == 1); /* take the first item and cast it into type */ type = (PurpleAttentionType *)(types->data); g_assert_cmpstr(purple_attention_type_get_unlocalized_name(type), ==, "id"); g_assert_cmpstr(purple_attention_type_get_name(type), ==, "name"); g_assert_cmpstr(purple_attention_type_get_incoming_desc(type), ==, "incoming"); g_assert_cmpstr(purple_attention_type_get_outgoing_desc(type), ==, "outgoing"); /****************************************************************************** *****************************************************************************/ main(gint argc, gchar **argv) { g_test_init(&argc, &argv, NULL); g_test_set_nonfatal_assertions(); "/protocol-attention/send", test_purple_protocol_attention_can_send "/protocol-attention/get-types", test_purple_protocol_attention_can_get_types