qulogic/pidgin

Create a very basic ui for testing

2017-10-05, Gary Kramlich
7ad7854d8e60
Parents d260f3b61831
Children 47a8f1e4c414
Create a very basic ui for testing
--- a/libpurple/tests/meson.build Mon Sep 18 22:29:40 2017 -0500
+++ b/libpurple/tests/meson.build Thu Oct 05 21:24:11 2017 -0500
@@ -8,20 +8,23 @@
'xmlnode'
]
+test_ui = static_library(
+ 'test-ui',
+ 'test_ui.c',
+ 'test_ui.h',
+ c_args: [
+ '-DTEST_DATA_DIR="@0@/data"'.format(meson.current_source_dir())
+ ],
+ dependencies: [libpurple_dep, glib, dbus, dbus_glib]
+)
+
foreach prog : PROGS
e = executable('test_' + prog, 'test_@0@.c'.format(prog),
c_args : [
'-DTEST_DATA_DIR="@0@/data"'.format(meson.current_source_dir())
],
- dependencies : [libpurple_dep, glib, dbus, dbus_glib])
+ dependencies : [libpurple_dep, glib, dbus, dbus_glib],
+ link_with: test_ui,
+ )
test(prog, e)
endforeach
-
-test_ui = static_library(
- 'test-ui',
- 'test_ui.c',
- c_args: [
- '-DTEST_DATA_DIR="@0@/data"'.format(meson.current_source_dir())
- ],
- dependencies: [libpurple_dep, glib, dbus, dbus_glib]
-)
--- a/libpurple/tests/test_protocol_xfer.c Mon Sep 18 22:29:40 2017 -0500
+++ b/libpurple/tests/test_protocol_xfer.c Thu Oct 05 21:24:11 2017 -0500
@@ -27,6 +27,8 @@
#include "dbus-server.h"
+#include "test_ui.h"
+
/******************************************************************************
* Junk
*****************************************************************************/
@@ -87,17 +89,7 @@
*****************************************************************************/
static void
test_purple_protocol_xfer_setup(TestPurpleProtocolXferFixture *fixture, gconstpointer data) {
- /* we need to find a way to make this crap not required */
- // purple_core_init("testing");
- purple_signals_init();
- purple_prefs_init();
- purple_dbus_init_ids();
- purple_cmds_init();
- purple_protocols_init();
- purple_plugins_init();
- purple_keyring_init();
- purple_connections_init();
- purple_accounts_init();
+ test_ui_purple_init();
}
/******************************************************************************
--- a/libpurple/tests/test_ui.c Mon Sep 18 22:29:40 2017 -0500
+++ b/libpurple/tests/test_ui.c Thu Oct 05 21:24:11 2017 -0500
@@ -34,7 +34,7 @@
# include <unistd.h>
#endif
-#include "defines.h"
+#include "test_ui.h"
/*** Conversation uiops ***/
static void
@@ -63,8 +63,17 @@
.ui_init = test_ui_init
};
-static void
-init_libpurple(void) {
+void
+test_ui_purple_init(void) {
+#ifndef _WIN32
+ /* libpurple's built-in DNS resolution forks processes to perform
+ * blocking lookups without blocking the main process. It does not
+ * handle SIGCHLD itself, so if the UI does not you quickly get an army
+ * of zombie subprocesses marching around.
+ */
+ signal(SIGCHLD, SIG_IGN);
+#endif
+
/* Set a custom user directory (optional) */
purple_util_set_user_dir(TEST_DATA_DIR);
@@ -103,35 +112,3 @@
* the preferences using purple_plugins_save_loaded(PLUGIN_SAVE_PREF) */
purple_plugins_load_saved(TEST_DATA_DIR);
}
-
-gint
-main(int argc, char *argv[]) {
- GList *list, *iter;
- int i, num;
- GList *names = NULL;
- const char *protocol = NULL;
- char name[128];
- char *password;
- GMainLoop *loop = g_main_loop_new(NULL, FALSE);
- PurpleAccount *account;
- PurpleSavedStatus *status;
- char *res;
-
-
-#ifndef _WIN32
- /* libpurple's built-in DNS resolution forks processes to perform
- * blocking lookups without blocking the main process. It does not
- * handle SIGCHLD itself, so if the UI does not you quickly get an army
- * of zombie subprocesses marching around.
- */
- signal(SIGCHLD, SIG_IGN);
-#endif
-
- init_libpurple();
-
- printf("libpurple initialized.\n");
-
- g_main_loop_run(loop);
-
- return 0;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/tests/test_ui.h Thu Oct 05 21:24:11 2017 -0500
@@ -0,0 +1,33 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#ifndef PURPLE_TEST_UI_H
+#define PURPLE_TEST_UI_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+void test_ui_purple_init(void);
+
+G_END_DECLS
+
+#endif /* PURPLE_TEST_UI_H */