tests: Use g_test_init instead of gtk_test_init

gtk_test_init() ends up calling gtk_init() which tries opening
the default display. CI jobs sometimes seem to trip over this
even when run through xvfb-run. Therefore we use g_test_init()
instead.
This commit is contained in:
Evangelos Ribeiro Tzaras
2023-05-01 11:44:29 +02:00
parent b550617de2
commit e80abf713a
13 changed files with 33 additions and 40 deletions

View File

@@ -9,7 +9,7 @@
#include "calls-application.h"
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <glib.h>
static gboolean
on_idle_quit (gpointer user_data)
@@ -131,7 +131,7 @@ main (int argc,
g_print ("Setting 'CALLS_RECORD_DIR' to '%s'\n", rec_dir);
g_setenv ("CALLS_RECORD_DIR", rec_dir, TRUE);
gtk_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Calls/application/shutdown_daemon", (GTestFunc) test_application_shutdown_daemon);
g_test_add_func ("/Calls/application/shutdown_no_daemon", (GTestFunc) test_application_shutdown_no_daemon);

View File

@@ -7,7 +7,7 @@
#include "calls-manager.h"
#include <cui-call.h>
#include <gtk/gtk.h>
#include <glib.h>
struct TestData {
GMainLoop *loop;
@@ -250,12 +250,12 @@ gint
main (gint argc,
gchar *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, NULL);
g_test_add_func("/Calls/Manager/without_provider", test_calls_manager_without_provider);
g_test_add_func("/Calls/Manager/dummy_provider", test_calls_manager_dummy_provider);
g_test_add_func("/Calls/Manager/mm_provider", test_calls_manager_mm_provider);
g_test_add_func("/Calls/Manager/multiple_provider_mm_sip", test_calls_manager_multiple_providers_mm_sip);
g_test_add_func ("/Calls/Manager/without_provider", test_calls_manager_without_provider);
g_test_add_func ("/Calls/Manager/dummy_provider", test_calls_manager_dummy_provider);
g_test_add_func ("/Calls/Manager/mm_provider", test_calls_manager_mm_provider);
g_test_add_func ("/Calls/Manager/multiple_provider_mm_sip", test_calls_manager_multiple_providers_mm_sip);
return g_test_run();
return g_test_run ();
}

View File

@@ -10,7 +10,7 @@
#include "calls-provider.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <libpeas/peas.h>
static void
@@ -52,7 +52,7 @@ main (gint argc,
const gchar *dir;
g_autofree char *default_plugin_dir_provider = NULL;
gtk_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, NULL);
peas = peas_engine_get_default ();

View File

@@ -9,7 +9,8 @@
#define G_SETTINGS_ENABLE_BACKEND
#include <gio/gsettingsbackend.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gio/gio.h>
static void
test_default (void)
@@ -32,7 +33,7 @@ int
main (gint argc,
gchar *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Calls/Settings/default", test_default);

View File

@@ -10,7 +10,7 @@
#include "calls-ui-call-data.h"
#include "mock-call.h"
#include <gtk/gtk.h>
#include <glib.h>
static void
test_cui_call_state_mapping (void)
@@ -80,7 +80,7 @@ int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Calls/UI/state_mapping", (GTestFunc) test_cui_call_state_mapping);
g_test_add_func ("/Calls/UI/call_properties", (GTestFunc) test_cui_call_properties);

View File

@@ -8,7 +8,7 @@
#include "calls-util.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <sys/socket.h>
@@ -97,7 +97,7 @@ int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Calls/util/protocol_prefix", (GTestFunc) test_protocol_prefix);
g_test_add_func ("/Calls/util/dtmf_tones", (GTestFunc) test_dtmf_tone_validity);