libpurple/tests/test_ui.c

Tue, 23 Jan 2024 00:04:57 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 23 Jan 2024 00:04:57 -0600
changeset 42571
722be3b1a8aa
parent 42435
ecf0fdfc8363
child 42576
ab1ca778ddb2
permissions
-rw-r--r--

Redesign the presence manager a bit

The presence manager now stores everything in a directory rather than a single
ini file. This avoids relocating schemas which seems to have a number of
issues.

Also bind the "active" setting to the "active-presence" property so that you
can change the active presence via the `manager.ini` gsettings keyfile.

So other various tweaks as well.

Testing Done:
Opened `manager.ini` and toggled the active status between a few I created.

Consulted with the turtles and ran the `presence_manager` and `saved_presence` unit tests under valgrind.

Reviewed at https://reviews.imfreedom.org/r/2912/

38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * pidgin
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 *
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 */
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include "purple.h"
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include <glib.h>
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include <glib/gprintf.h>
41868
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
28 #include <glib/gi18n-lib.h>
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
41806
b7a1aab4b3be Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
30 #define G_SETTINGS_ENABLE_BACKEND
b7a1aab4b3be Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
31 #include <gio/gsettingsbackend.h>
b7a1aab4b3be Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
32
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 #include <signal.h>
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 #include <string.h>
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 #ifdef _WIN32
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 # include <conio.h>
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 #else
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 # include <unistd.h>
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 #endif
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40
38832
7ad7854d8e60 Create a very basic ui for testing
Gary Kramlich <grim@reaperworld.com>
parents: 38831
diff changeset
41 #include "test_ui.h"
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 /*** Conversation uiops ***/
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 static void
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 test_write_conv(PurpleConversation *conv, PurpleMessage *msg)
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 {
40541
9ceb8d25d4d9 PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents: 38834
diff changeset
47 gchar *timestamp = purple_message_format_timestamp(msg, "(%H:%M:%S)");
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 printf("(%s) %s %s: %s\n",
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 purple_conversation_get_name(conv),
40541
9ceb8d25d4d9 PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents: 38834
diff changeset
51 timestamp,
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 purple_message_get_author_alias(msg),
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 purple_message_get_contents(msg));
40541
9ceb8d25d4d9 PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents: 38834
diff changeset
54
9ceb8d25d4d9 PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents: 38834
diff changeset
55 g_free(timestamp);
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 }
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 static PurpleConversationUiOps test_conv_uiops = {
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 .write_conv = test_write_conv
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 };
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
62 /******************************************************************************
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
63 * PurpleUi Implementation
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
64 *****************************************************************************/
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
65 struct _TestPurpleUi {
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
66 PurpleUi parent;
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
67 };
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
68
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
69 G_DECLARE_FINAL_TYPE(TestPurpleUi, test_purple_ui, TEST_PURPLE, UI, PurpleUi)
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
70
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
71 G_DEFINE_TYPE(TestPurpleUi, test_purple_ui, PURPLE_TYPE_UI)
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
72
41873
98c20aec9aba Make PurpleUi.start return a gboolean and GError
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
73 static gboolean
98c20aec9aba Make PurpleUi.start return a gboolean and GError
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
74 test_purple_ui_start(G_GNUC_UNUSED PurpleUi *ui, G_GNUC_UNUSED GError **error) {
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 purple_conversations_set_ui_ops(&test_conv_uiops);
41873
98c20aec9aba Make PurpleUi.start return a gboolean and GError
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
76
98c20aec9aba Make PurpleUi.start return a gboolean and GError
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
77 return TRUE;
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 }
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
41806
b7a1aab4b3be Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
80 static gpointer
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
81 test_purple_ui_get_settings_backend(G_GNUC_UNUSED PurpleUi *ui) {
41806
b7a1aab4b3be Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
82 return g_memory_settings_backend_new();
b7a1aab4b3be Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
83 }
b7a1aab4b3be Add a get_settings_backend vfunc to CoreUiOps
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
84
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
85 static void
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
86 test_purple_ui_init(G_GNUC_UNUSED TestPurpleUi *ui) {
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
87 }
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
88
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
89 static void
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
90 test_purple_ui_class_init(TestPurpleUiClass *klass) {
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
91 PurpleUiClass *ui_class = PURPLE_UI_CLASS(klass);
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
92
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
93 ui_class->start = test_purple_ui_start;
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
94 ui_class->get_settings_backend = test_purple_ui_get_settings_backend;
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
95 }
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
96
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
97 static PurpleUi *
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
98 test_purple_ui_new(void) {
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
99 return g_object_new(
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
100 test_purple_ui_get_type(),
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
101 "id", "test",
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
102 "name", "Test-UI",
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
103 "version", VERSION,
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
104 "website", PURPLE_WEBSITE,
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
105 "support-website", PURPLE_WEBSITE,
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
106 "client-type", "test",
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
107 NULL);
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
108 }
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
38832
7ad7854d8e60 Create a very basic ui for testing
Gary Kramlich <grim@reaperworld.com>
parents: 38831
diff changeset
110 void
7ad7854d8e60 Create a very basic ui for testing
Gary Kramlich <grim@reaperworld.com>
parents: 38831
diff changeset
111 test_ui_purple_init(void) {
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
112 PurpleUi *ui = NULL;
41109
755e1554051c Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents: 40669
diff changeset
113 GError *error = NULL;
755e1554051c Make user interfaces setup the default history adapter.
Gary Kramlich <grim@reaperworld.com>
parents: 40669
diff changeset
114
38834
e4144efa975e Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents: 38832
diff changeset
115 /* set the magic PURPLE_PLUGINS_SKIP environment variable */
e4144efa975e Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents: 38832
diff changeset
116 g_setenv("PURPLE_PLUGINS_SKIP", "1", TRUE);
e4144efa975e Clean up a bunch of the cruft I accidentally created
Gary Kramlich <grim@reaperworld.com>
parents: 38832
diff changeset
117
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41806
diff changeset
118 ui = test_purple_ui_new();
41396
2ef3d6eeffb3 Update purple_core_init to take a PurpleUiInfo instance
Gary Kramlich <grim@reaperworld.com>
parents: 41129
diff changeset
119
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 /* Now that all the essential stuff has been set, let's try to init the core. It's
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 * necessary to provide a non-NULL name for the current ui to the core. This name
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 * is used by stuff that depends on this ui, for example the ui-specific plugins. */
41868
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
123 if (!purple_core_init(ui, &error)) {
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 /* Initializing the core failed. Terminate. */
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 fprintf(stderr,
41868
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
126 _("Initialization of the libpurple core failed. %s\n"
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
127 "Aborting!\nPlease report this!\n"),
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
128 (error != NULL) ? error->message : "unknown error");
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
129 g_clear_error(&error);
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 abort();
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 }
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132
42374
3bcea128d38f Remove a workaround that was needed for glib < 2.73.3
Gary Kramlich <grim@reaperworld.com>
parents: 42279
diff changeset
133 /* Make sure our configuration directory exists. */
3bcea128d38f Remove a workaround that was needed for glib < 2.73.3
Gary Kramlich <grim@reaperworld.com>
parents: 42279
diff changeset
134 g_mkdir_with_parents(purple_config_dir(), 0755);
3bcea128d38f Remove a workaround that was needed for glib < 2.73.3
Gary Kramlich <grim@reaperworld.com>
parents: 42279
diff changeset
135
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 /* Load the preferences. */
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 purple_prefs_load();
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138
41129
4be9a7876d35 Fix the unit tests that were broke by the g_log transition
Gary Kramlich <grim@reaperworld.com>
parents: 41127
diff changeset
139 purple_prefs_add_none("/purple");
4be9a7876d35 Fix the unit tests that were broke by the g_log transition
Gary Kramlich <grim@reaperworld.com>
parents: 41127
diff changeset
140 purple_prefs_add_none("/purple/test_ui");
4be9a7876d35 Fix the unit tests that were broke by the g_log transition
Gary Kramlich <grim@reaperworld.com>
parents: 41127
diff changeset
141 purple_prefs_add_none("/purple/test_ui/plugins");
4be9a7876d35 Fix the unit tests that were broke by the g_log transition
Gary Kramlich <grim@reaperworld.com>
parents: 41127
diff changeset
142 purple_prefs_add_path_list("/purple/test_ui/plugins/saved", NULL);
4be9a7876d35 Fix the unit tests that were broke by the g_log transition
Gary Kramlich <grim@reaperworld.com>
parents: 41127
diff changeset
143
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 /* Load the desired plugins. The client should save the list of loaded plugins in
40669
48dfed6f4f1f Fix Windows builds and tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40541
diff changeset
145 * the preferences using purple_plugins_save_loaded() */
48dfed6f4f1f Fix Windows builds and tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40541
diff changeset
146 purple_plugins_load_saved("/purple/test_ui/plugins/saved");
38831
d260f3b61831 The start of a ui for unit testing
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 }
42184
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41873
diff changeset
148
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41873
diff changeset
149 void
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41873
diff changeset
150 test_ui_purple_uninit(void) {
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41873
diff changeset
151 purple_core_quit();
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41873
diff changeset
152 }

mercurial