1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-04 20:07:36 +00:00

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

@ -10,7 +10,7 @@
#include "calls-origin.h" #include "calls-origin.h"
#include "common.h" #include "common.h"
#include <gtk/gtk.h> #include <glib.h>
#include <string.h> #include <string.h>
static void static void
@ -65,8 +65,7 @@ gint
main (gint argc, main (gint argc,
gchar *argv[]) gchar *argv[])
{ {
gtk_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
#define add_test(name) add_calls_test(Call, call, name) #define add_test(name) add_calls_test(Call, call, name)
@ -77,6 +76,5 @@ main (gint argc,
#undef add_test #undef add_test
return g_test_run(); return g_test_run();
} }

View file

@ -11,7 +11,7 @@
#include "calls-srtp-utils.h" #include "calls-srtp-utils.h"
#include "gst-rfc3551.h" #include "gst-rfc3551.h"
#include <gtk/gtk.h> #include <glib.h>
#include <gst/gst.h> #include <gst/gst.h>
@ -274,7 +274,7 @@ main (int argc,
CallsSipMediaManager *manager = calls_sip_media_manager_default (); CallsSipMediaManager *manager = calls_sip_media_manager_default ();
int ret; int ret;
gtk_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
gst_init (NULL, NULL); gst_init (NULL, NULL);

View file

@ -9,7 +9,7 @@
#include "calls-origin.h" #include "calls-origin.h"
#include "common.h" #include "common.h"
#include <gtk/gtk.h> #include <glib.h>
#include <string.h> #include <string.h>
static void static void
@ -79,8 +79,7 @@ gint
main (gint argc, main (gint argc,
gchar *argv[]) gchar *argv[])
{ {
gtk_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
#define add_test(name) add_calls_test(Origin, origin, name) #define add_test(name) add_calls_test(Origin, origin, name)
@ -90,6 +89,5 @@ main (gint argc,
#undef add_test #undef add_test
return g_test_run(); return g_test_run();
} }

View file

@ -10,7 +10,7 @@
#include "calls-message-source.h" #include "calls-message-source.h"
#include "common.h" #include "common.h"
#include <gtk/gtk.h> #include <glib.h>
#include <string.h> #include <string.h>
static void static void
@ -53,8 +53,7 @@ gint
main (gint argc, main (gint argc,
gchar *argv[]) gchar *argv[])
{ {
gtk_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
#define add_test(name) add_calls_test(Provider, provider, name) #define add_test(name) add_calls_test(Provider, provider, name)
@ -64,6 +63,5 @@ main (gint argc,
#undef add_test #undef add_test
return g_test_run(); return g_test_run();
} }

View file

@ -8,7 +8,7 @@
#include "calls-sdp-crypto-context.h" #include "calls-sdp-crypto-context.h"
#include <gtk/gtk.h> #include <glib.h>
static void static void
@ -173,7 +173,7 @@ int
main (int argc, main (int argc,
char *argv[]) char *argv[])
{ {
gtk_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Calls/SDP_crypto/manual", test_crypto_manual); g_test_add_func ("/Calls/SDP_crypto/manual", test_crypto_manual);
g_test_add_func ("/Calls/SDP_crypto/offer_answer", test_crypto_offer_answer); g_test_add_func ("/Calls/SDP_crypto/offer_answer", test_crypto_offer_answer);

View file

@ -14,10 +14,8 @@
#include "calls-account.h" #include "calls-account.h"
#include "gst-rfc3551.h" #include "gst-rfc3551.h"
#include <gtk/gtk.h> #include <glib.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <sofia-sip/su_uniqueid.h> #include <sofia-sip/su_uniqueid.h>
#include <libpeas/peas.h> #include <libpeas/peas.h>
@ -426,7 +424,7 @@ main (int argc,
{ {
int ret; int ret;
gtk_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
gst_init (NULL, NULL); gst_init (NULL, NULL);
/* this is a workaround for an issue with sofia: https://github.com/freeswitch/sofia-sip/issues/58 */ /* this is a workaround for an issue with sofia: https://github.com/freeswitch/sofia-sip/issues/58 */
@ -447,7 +445,7 @@ main (int argc,
g_test_add ("/Calls/SIP/calls_direct_call", SipFixture, NULL, g_test_add ("/Calls/SIP/calls_direct_call", SipFixture, NULL,
setup_sip_origins, test_sip_call_direct_calls, tear_down_sip_origins); setup_sip_origins, test_sip_call_direct_calls, tear_down_sip_origins);
ret = g_test_run(); ret = g_test_run ();
gst_deinit (); gst_deinit ();

View file

@ -8,7 +8,7 @@
#include "calls-srtp-utils.h" #include "calls-srtp-utils.h"
#include <gtk/gtk.h> #include <glib.h>
static void static void
@ -473,7 +473,7 @@ int
main (int argc, main (int argc,
char *argv[]) char *argv[])
{ {
gtk_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Calls/SRTP-SDP/crypto_attribute_validity", test_crypto_attribute_validity); g_test_add_func ("/Calls/SRTP-SDP/crypto_attribute_validity", test_crypto_attribute_validity);
g_test_add_func ("/Calls/SRTP-SDP/parse", test_parse); g_test_add_func ("/Calls/SRTP-SDP/parse", test_parse);

View file

@ -9,7 +9,7 @@
#include "calls-application.h" #include "calls-application.h"
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <gtk/gtk.h> #include <glib.h>
static gboolean static gboolean
on_idle_quit (gpointer user_data) 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_print ("Setting 'CALLS_RECORD_DIR' to '%s'\n", rec_dir);
g_setenv ("CALLS_RECORD_DIR", rec_dir, TRUE); 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_daemon", (GTestFunc) test_application_shutdown_daemon);
g_test_add_func ("/Calls/application/shutdown_no_daemon", (GTestFunc) test_application_shutdown_no_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 "calls-manager.h"
#include <cui-call.h> #include <cui-call.h>
#include <gtk/gtk.h> #include <glib.h>
struct TestData { struct TestData {
GMainLoop *loop; GMainLoop *loop;
@ -250,12 +250,12 @@ gint
main (gint argc, main (gint argc,
gchar *argv[]) 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/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/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/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/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 "calls-provider.h"
#include <gtk/gtk.h> #include <glib.h>
#include <libpeas/peas.h> #include <libpeas/peas.h>
static void static void
@ -52,7 +52,7 @@ main (gint argc,
const gchar *dir; const gchar *dir;
g_autofree char *default_plugin_dir_provider = NULL; 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 (); peas = peas_engine_get_default ();

View file

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

View file

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

View file

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