Thu, 07 Aug 2025 21:40:13 -0500
Add an avatar-for-display property to Purple.ContactInfo
Testing Done:
Ran the tests under valgrind and called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/4086/
|
43051
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include <purple.h> |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | /****************************************************************************** |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | * Tests |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | *****************************************************************************/ |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | static void |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | test_purple_protocol_manager_new(void) { |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | PurpleProtocolManager *manager = NULL; |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | manager = g_object_new(PURPLE_TYPE_PROTOCOL_MANAGER, NULL); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | g_assert_true(PURPLE_IS_PROTOCOL_MANAGER(manager)); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | g_assert_true(G_IS_LIST_MODEL(manager)); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | g_assert_finalize_object(manager); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | } |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | static void |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | test_purple_protocol_manager_properties(void) { |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | PurpleProtocolManager *manager = NULL; |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | GType item_type = G_TYPE_INVALID; |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | guint n_items = 0; |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | manager = g_object_new(PURPLE_TYPE_PROTOCOL_MANAGER, NULL); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | g_object_get( |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | G_OBJECT(manager), |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | "item-type", &item_type, |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | "n-items", &n_items, |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | NULL); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | g_assert_true(item_type == PURPLE_TYPE_PROTOCOL); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | /* While there aren't any items here, this just helps us verify that the |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | * property exists. |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | */ |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | g_assert_cmpuint(n_items, ==, 0); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | g_assert_finalize_object(manager); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | } |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | /****************************************************************************** |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | * Main |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | *****************************************************************************/ |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | int |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | main(int argc, char *argv[]) { |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | g_test_init(&argc, &argv, NULL); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | g_test_set_nonfatal_assertions(); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | g_test_add_func("/protocol-manager/new", test_purple_protocol_manager_new); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | g_test_add_func("/protocol-manager/properties", |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | test_purple_protocol_manager_properties); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | return g_test_run(); |
|
44174781eb68
Clean up Purple.ProtocolManager and add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | } |