libpurple/tests/test_protocol_action.c

changeset 39484
0ece2412a0b0
child 39485
092ef2b35330
equal deleted inserted replaced
39483:ab4728087d87 39484:0ece2412a0b0
1 /*
2 * Purple
3 *
4 * Purple is the legal property of its developers, whose names are too
5 * numerous to list here. Please refer to the COPYRIGHT file distributed
6 * with this source distribution
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at
11 * your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 */
22
23 #include <glib.h>
24 #include <string.h>
25
26 #include <purple.h>
27
28 #include "dbus-server.h"
29
30 /******************************************************************************
31 * Helpers
32 *****************************************************************************/
33 static void
34 _test_purple_protocol_action_callback(PurpleProtocolAction *action) {
35
36 }
37
38 /******************************************************************************
39 * Tests
40 *****************************************************************************/
41 static void
42 test_purple_protocol_action_new(void) {
43 PurpleProtocolAction *action = NULL;
44
45 action = purple_protocol_action_new(
46 "label",
47 _test_purple_protocol_action_callback
48 );
49 g_assert_nonnull(action);
50
51 g_assert_cmpstr(action->label, ==, "label");
52 g_assert(action->callback == _test_purple_protocol_action_callback);
53
54 purple_protocol_action_free(action);
55 }
56
57 static void
58 test_purple_protocol_action_copy(void) {
59 PurpleProtocolAction *orig = NULL, *copy = NULL;
60
61 orig = purple_protocol_action_new(
62 "label",
63 _test_purple_protocol_action_callback
64 );
65 g_assert_nonnull(orig);
66
67 copy = purple_protocol_action_copy(orig);
68 purple_protocol_action_free(orig);
69
70 g_assert_cmpstr(copy->label, ==, "label");
71 g_assert(copy->callback == _test_purple_protocol_action_callback);
72
73 purple_protocol_action_free(copy);
74 }
75
76 /******************************************************************************
77 * Main
78 *****************************************************************************/
79 gint
80 main(gint argc, gchar **argv) {
81 gint res = 0;
82
83 g_test_init(&argc, &argv, NULL);
84
85 g_test_set_nonfatal_assertions();
86
87 g_test_add_func(
88 "/protocol-action/new",
89 test_purple_protocol_action_new
90 );
91
92 g_test_add_func(
93 "/protocol-action/copy",
94 test_purple_protocol_action_copy
95 );
96
97 res = g_test_run();
98
99 return res;
100 }

mercurial