Sat, 09 Aug 2025 17:37:27 +0800
Fix the birb header path
The birb header referred would only work with birb provided by wrap casuing
build to fail because of system-installed birb dependency. The commit points
it to the correct path <birb.h>.
See: https://keep.imfreedom.org/birb/birb/file/5bf00c7d7f80/birb/meson.build#l77
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
42877
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
21 | #include <birb.h> |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
22 | |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <purple.h> |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #define TEST_PROTOCOL_DOMAIN (g_quark_from_static_string("test-protocol")) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | /****************************************************************************** |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | * TestPurpleProtocol |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | *****************************************************************************/ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | #define TEST_PURPLE_TYPE_PROTOCOL (test_purple_protocol_get_type()) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | G_DECLARE_FINAL_TYPE(TestPurpleProtocol, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | test_purple_protocol, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | TEST_PURPLE, PROTOCOL, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | PurpleProtocol) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | struct _TestPurpleProtocol { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | PurpleProtocol parent; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | gboolean result; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | GError *error; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
42 | guint can_connect_async; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
43 | guint can_connect_finish; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
44 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
45 | guint generate_account_name; |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | }; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
42576
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
48 | G_DEFINE_FINAL_TYPE(TestPurpleProtocol, test_purple_protocol, |
|
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
49 | PURPLE_TYPE_PROTOCOL) |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | test_purple_protocol_can_connect_async(PurpleProtocol *protocol, |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41884
diff
changeset
|
53 | G_GNUC_UNUSED PurpleAccount *account, |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | GCancellable *cancellable, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | GAsyncReadyCallback callback, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | gpointer data) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | TestPurpleProtocol *test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | GTask *task = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | task = g_task_new(protocol, cancellable, callback, data); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | if(test_protocol->error != NULL) { |
|
42182
3fc2d2b7b7a8
Fix leaked errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42089
diff
changeset
|
63 | g_task_return_error(task, g_error_copy(test_protocol->error)); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | } else { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | g_task_return_boolean(task, test_protocol->result); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | g_clear_object(&task); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
69 | test_protocol->can_connect_async += 1; |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | static gboolean |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | test_purple_protocol_can_connect_finish(PurpleProtocol *protocol, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | GAsyncResult *result, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | GError **error) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | TestPurpleProtocol *test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
79 | test_protocol->can_connect_finish += 1; |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | return g_task_propagate_boolean(G_TASK(result), error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
84 | static char * |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
85 | test_purple_protocol_generate_account_name(PurpleProtocol *protocol, |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
86 | PurpleAccount *account, |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
87 | guint n_accounts) |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
88 | { |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
89 | TestPurpleProtocol *test_protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
90 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
91 | birb_assert_type(protocol, TEST_PURPLE_TYPE_PROTOCOL); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
92 | birb_assert_type(account, PURPLE_TYPE_ACCOUNT); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
93 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
94 | test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
95 | test_protocol->generate_account_name += 1; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
96 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
97 | return g_strdup_printf("override %u", n_accounts + 1); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
98 | } |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
99 | |
|
42877
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
100 | static BirbActionMenu * |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
101 | test_purple_protocol_get_action_menu(PurpleProtocol *protocol, |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
102 | PurpleAccount *account) |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
103 | { |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
104 | g_assert_true(PURPLE_IS_PROTOCOL(protocol)); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
105 | g_assert_true(PURPLE_IS_ACCOUNT(account)); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
106 | |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
107 | return birb_action_menu_new(); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
108 | } |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
109 | |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | test_purple_protocol_finalize(GObject *obj) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | TestPurpleProtocol *protocol = TEST_PURPLE_PROTOCOL(obj); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | g_clear_error(&protocol->error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | G_OBJECT_CLASS(test_purple_protocol_parent_class)->finalize(obj); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | static void |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
120 | test_purple_protocol_init(G_GNUC_UNUSED TestPurpleProtocol *protocol) { |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | test_purple_protocol_class_init(TestPurpleProtocolClass *klass) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | obj_class->finalize = test_purple_protocol_finalize; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | protocol_class->can_connect_async = test_purple_protocol_can_connect_async; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | protocol_class->can_connect_finish = test_purple_protocol_can_connect_finish; |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
133 | protocol_class->generate_account_name = test_purple_protocol_generate_account_name; |
|
42877
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
134 | protocol_class->get_action_menu = test_purple_protocol_get_action_menu; |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
137 | static PurpleProtocol * |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
138 | test_purple_protocol_new(void) { |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
139 | return g_object_new( |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | TEST_PURPLE_TYPE_PROTOCOL, |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
141 | "id", "test-protocol", |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
142 | "name", "Test Protocol", |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | NULL); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | /****************************************************************************** |
|
43257
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
147 | * General Tests |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
148 | *****************************************************************************/ |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
149 | static void |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
150 | test_purple_protocol_properties(void) { |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
151 | PurpleProtocol *protocol = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
152 | PurpleProtocolOptions options = 0; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
153 | PurpleTags *tags = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
154 | char *description = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
155 | char *icon_name = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
156 | char *icon_resource_path = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
157 | char *icon_search_path = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
158 | char *id = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
159 | char *name = NULL; |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
160 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
161 | protocol = g_object_new( |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
162 | TEST_PURPLE_TYPE_PROTOCOL, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
163 | "description", "This is a description", |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
164 | "icon-name", "icon-name", |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
165 | "icon-resource-path", "resource-path", |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
166 | "icon-search-path", "search-path", |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
167 | "id", "test-protocol", |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
168 | "name", "Test Protocol", |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
169 | "options", OPT_PROTO_NO_PASSWORD, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
170 | NULL); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
171 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
172 | birb_assert_type(protocol, TEST_PURPLE_TYPE_PROTOCOL); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
173 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
174 | g_object_get( |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
175 | G_OBJECT(protocol), |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
176 | "description", &description, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
177 | "icon-name", &icon_name, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
178 | "icon-resource-path", &icon_resource_path, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
179 | "icon-search-path", &icon_search_path, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
180 | "id", &id, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
181 | "name", &name, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
182 | "options", &options, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
183 | "tags", &tags, |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
184 | NULL); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
185 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
186 | g_assert_cmpstr(description, ==, "This is a description"); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
187 | g_clear_pointer(&description, g_free); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
188 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
189 | g_assert_cmpstr(icon_name, ==, "icon-name"); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
190 | g_clear_pointer(&icon_name, g_free); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
191 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
192 | g_assert_cmpstr(icon_resource_path, ==, "resource-path"); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
193 | g_clear_pointer(&icon_resource_path, g_free); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
194 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
195 | g_assert_cmpstr(icon_search_path, ==, "search-path"); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
196 | g_clear_pointer(&icon_search_path, g_free); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
197 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
198 | g_assert_cmpstr(id, ==, "test-protocol"); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
199 | g_clear_pointer(&id, g_free); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
200 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
201 | g_assert_cmpstr(name, ==, "Test Protocol"); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
202 | g_clear_pointer(&name, g_free); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
203 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
204 | g_assert_cmphex(options, ==, OPT_PROTO_NO_PASSWORD); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
205 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
206 | birb_assert_type(tags, PURPLE_TYPE_TAGS); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
207 | g_clear_object(&tags); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
208 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
209 | g_assert_finalize_object(protocol); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
210 | } |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
211 | |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
212 | /****************************************************************************** |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | * TestPurpleProtocol->can_connect Tests |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | *****************************************************************************/ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | test_purple_protocol_can_connect_cb(GObject *obj, GAsyncResult *res, |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
217 | G_GNUC_UNUSED gpointer data) |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | PurpleProtocol *protocol = PURPLE_PROTOCOL(obj); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | TestPurpleProtocol *test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | GError *error = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | gboolean result = FALSE; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | result = purple_protocol_can_connect_finish(protocol, res, &error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | if(test_protocol->error != NULL) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | g_assert_error(error, TEST_PROTOCOL_DOMAIN, 0); |
|
42182
3fc2d2b7b7a8
Fix leaked errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42089
diff
changeset
|
228 | g_clear_error(&error); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | } else { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | g_assert_no_error(error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | g_assert_true(result == test_protocol->result); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | test_purple_protocol_can_connect_error(void) { |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
238 | TestPurpleProtocol *test_protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
239 | PurpleProtocol *protocol = NULL; |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
240 | PurpleAccount *account = NULL; |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | GError *error = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | error = g_error_new(TEST_PROTOCOL_DOMAIN, 0, "no network"); |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
244 | protocol = test_purple_protocol_new(); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
245 | test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
246 | test_protocol->error = error; |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
248 | account = purple_account_new("test", "test"); |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
249 | |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
250 | purple_protocol_can_connect_async(PURPLE_PROTOCOL(protocol), account, NULL, |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
251 | test_purple_protocol_can_connect_cb, |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
252 | NULL); |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
253 | |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
254 | g_main_context_iteration(NULL, FALSE); |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
255 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
256 | g_assert_cmpuint(test_protocol->can_connect_async, ==, 1); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
257 | g_assert_cmpuint(test_protocol->can_connect_finish, ==, 1); |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
258 | |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
259 | g_assert_finalize_object(protocol); |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
260 | g_clear_object(&account); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | test_purple_protocol_can_connect_false(void) { |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
265 | TestPurpleProtocol *test_protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
266 | PurpleProtocol *protocol = NULL; |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
267 | PurpleAccount *account = NULL; |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
268 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
269 | protocol = test_purple_protocol_new(); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
270 | test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
271 | account = purple_account_new("test", "test"); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
272 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
273 | purple_protocol_can_connect_async(PURPLE_PROTOCOL(protocol), account, NULL, |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
274 | test_purple_protocol_can_connect_cb, |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
275 | NULL); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
276 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
277 | g_main_context_iteration(NULL, FALSE); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
278 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
279 | g_assert_cmpuint(test_protocol->can_connect_async, ==, 1); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
280 | g_assert_cmpuint(test_protocol->can_connect_finish, ==, 1); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
281 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
282 | g_assert_finalize_object(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
283 | g_clear_object(&account); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
284 | } |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
285 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
286 | static void |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
287 | test_purple_protocol_can_connect_true(void) { |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
288 | TestPurpleProtocol *test_protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
289 | PurpleProtocol *protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
290 | PurpleAccount *account = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
291 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
292 | protocol = test_purple_protocol_new(); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
293 | test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
294 | test_protocol->result = TRUE; |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
295 | account = purple_account_new("test", "test"); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
297 | purple_protocol_can_connect_async(PURPLE_PROTOCOL(protocol), account, NULL, |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
298 | test_purple_protocol_can_connect_cb, |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
299 | NULL); |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
300 | |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
301 | g_main_context_iteration(NULL, FALSE); |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
302 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
303 | g_assert_cmpuint(test_protocol->can_connect_async, ==, 1); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
304 | g_assert_cmpuint(test_protocol->can_connect_finish, ==, 1); |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
305 | |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
306 | g_assert_finalize_object(protocol); |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
307 | g_clear_object(&account); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | static void |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
311 | test_purple_protocol_generate_account_name_default(void) { |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
312 | TestPurpleProtocol *test_protocol = NULL; |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
313 | PurpleAccount *account = NULL; |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
314 | PurpleProtocol *protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
315 | PurpleProtocolClass *klass = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
316 | char *name = NULL; |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
317 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
318 | protocol = test_purple_protocol_new(); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
319 | test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
320 | klass = PURPLE_PROTOCOL_GET_CLASS(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
321 | klass->generate_account_name = PURPLE_PROTOCOL_CLASS(test_purple_protocol_parent_class)->generate_account_name; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
322 | |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
323 | account = purple_account_new("test", "test"); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
325 | name = purple_protocol_generate_account_name(protocol, account, 0); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
326 | g_assert_cmpstr(name, ==, "Test Protocol 1"); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
327 | g_clear_pointer(&name, g_free); |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
328 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
329 | name = purple_protocol_generate_account_name(protocol, account, 9); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
330 | g_assert_cmpstr(name, ==, "Test Protocol 10"); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
331 | g_clear_pointer(&name, g_free); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
332 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
333 | g_assert_cmpuint(test_protocol->generate_account_name, ==, 0); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
334 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
335 | g_assert_finalize_object(account); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
336 | g_assert_finalize_object(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
337 | } |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
338 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
339 | static void |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
340 | test_purple_protocol_generate_account_name_override(void) { |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
341 | TestPurpleProtocol *test_protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
342 | PurpleAccount *account = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
343 | PurpleProtocol *protocol = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
344 | char *name = NULL; |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
345 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
346 | protocol = test_purple_protocol_new(); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
347 | test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
348 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
349 | account = purple_account_new("test", "test"); |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
350 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
351 | name = purple_protocol_generate_account_name(protocol, account, 0); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
352 | g_assert_cmpstr(name, ==, "override 1"); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
353 | g_clear_pointer(&name, g_free); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
354 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
355 | name = purple_protocol_generate_account_name(protocol, account, 9); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
356 | g_assert_cmpstr(name, ==, "override 10"); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
357 | g_clear_pointer(&name, g_free); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
358 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
359 | g_assert_cmpuint(test_protocol->generate_account_name, ==, 2); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
360 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
361 | g_assert_finalize_object(account); |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
362 | g_assert_finalize_object(protocol); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | |
|
42877
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
365 | static void |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
366 | test_purple_protocol_get_action_menu_valid(void) { |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
367 | PurpleProtocol *protocol = NULL; |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
368 | PurpleAccount *account = NULL; |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
369 | BirbActionMenu *action_menu = NULL; |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
370 | |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
371 | protocol = test_purple_protocol_new(); |
|
42877
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
372 | account = purple_account_new("test", "test"); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
373 | |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
374 | action_menu = purple_protocol_get_action_menu(protocol, account); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
375 | g_assert_true(BIRB_IS_ACTION_MENU(action_menu)); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
376 | g_clear_object(&action_menu); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
377 | |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
378 | g_clear_object(&account); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
379 | g_assert_finalize_object(protocol); |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
380 | } |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
381 | |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | /****************************************************************************** |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | * Main |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | *****************************************************************************/ |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
385 | int |
|
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
386 | main(int argc, char *argv[]) { |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | g_test_init(&argc, &argv, NULL); |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
388 | g_test_set_nonfatal_assertions(); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | |
|
43257
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
390 | g_test_add_func("/protocol/properties", test_purple_protocol_properties); |
|
934732945514
Add Purple.Protocol:tags and add unit tests for protocol properties
Gary Kramlich <grim@reaperworld.com>
parents:
43161
diff
changeset
|
391 | |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | g_test_add_func("/protocol/can-connect/error", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | test_purple_protocol_can_connect_error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
394 | g_test_add_func("/protocol/can-connect/false", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | test_purple_protocol_can_connect_false); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | g_test_add_func("/protocol/can-connect/true", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | test_purple_protocol_can_connect_true); |
|
43161
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
398 | |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
399 | g_test_add_func("/protocol/generate-account-name/override", |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
400 | test_purple_protocol_generate_account_name_override); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
401 | g_test_add_func("/protocol/generate-account-name/default", |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
402 | test_purple_protocol_generate_account_name_default); |
|
920605926071
Add Purple.Protocol.generate_account_name
Gary Kramlich <grim@reaperworld.com>
parents:
42877
diff
changeset
|
403 | |
|
42877
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
404 | g_test_add_func("/protocol/get-action-menu/valid", |
|
566102577b66
Add Purple.Protocol.get_action_menu
Gary Kramlich <grim@reaperworld.com>
parents:
42862
diff
changeset
|
405 | test_purple_protocol_get_action_menu_valid); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | |
|
42862
ffd03c26426a
Modernize the protocol tests
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
407 | return g_test_run(); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | } |