From a44c26590372a398d092cec870409fefb184a3ba Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Tue, 6 Apr 2021 10:56:38 +0200 Subject: [PATCH] sip: remove FOR_TESTING ifdef --- plugins/sip/calls-sip-provider.c | 14 -------------- tests/meson.build | 7 +++---- tests/test-sip.c | 9 ++++++++- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/plugins/sip/calls-sip-provider.c b/plugins/sip/calls-sip-provider.c index ad24a24..fb4ada4 100644 --- a/plugins/sip/calls-sip-provider.c +++ b/plugins/sip/calls-sip-provider.c @@ -63,22 +63,12 @@ static GParamSpec *props[PROP_LAST_PROP]; static void calls_sip_provider_message_source_interface_init (CallsMessageSourceInterface *iface); -#ifdef FOR_TESTING - -G_DEFINE_TYPE_WITH_CODE -(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, - G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE, - calls_sip_provider_message_source_interface_init)) - - -#else G_DEFINE_DYNAMIC_TYPE_EXTENDED (CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, 0, G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE, calls_sip_provider_message_source_interface_init)); -#endif /* FOR_TESTING */ static gboolean check_required_keys (GKeyFile *key_file, @@ -442,8 +432,6 @@ calls_sip_provider_new () } -#ifndef FOR_TESTING - static void calls_sip_provider_class_finalize (CallsSipProviderClass *klass) { @@ -459,5 +447,3 @@ peas_register_types (PeasObjectModule *module) CALLS_TYPE_PROVIDER, CALLS_TYPE_SIP_PROVIDER); } - -#endif /* FOR_TESTING */ diff --git a/tests/meson.build b/tests/meson.build index c471ec8..009a1ee 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -89,14 +89,13 @@ test('plugins', t, env: test_env) test_sources = [ 'test-sip.c' ] t = executable('sip', test_sources, - calls_sources, sip_sources, - c_args : test_cflags_with_test_define, + calls_sources, + c_args : test_cflags, link_args: test_link_args, - link_with : calls_vala, + link_with : [calls_vala, calls_sip], dependencies: [calls_deps, sip_deps], include_directories : [ calls_includes, - dummy_include, sip_include, ] ) diff --git a/tests/test-sip.c b/tests/test-sip.c index 358303a..4a141a2 100644 --- a/tests/test-sip.c +++ b/tests/test-sip.c @@ -6,12 +6,14 @@ * Author: Evangelos Ribeiro Tzaras */ +#include "calls-provider.h" #include "calls-sip-provider.h" #include "calls-sip-origin.h" #include "calls-sip-util.h" #include #include +#include typedef struct { CallsSipProvider *provider; @@ -52,7 +54,8 @@ static void setup_sip_provider (SipFixture *fixture, gconstpointer user_data) { - fixture->provider = calls_sip_provider_new (); + CallsProvider *provider = calls_provider_load_plugin ("sip"); + fixture->provider = CALLS_SIP_PROVIDER (provider); } static void @@ -60,6 +63,7 @@ tear_down_sip_provider (SipFixture *fixture, gconstpointer user_data) { g_clear_object (&fixture->provider); + calls_provider_unload_plugin ("sip"); } @@ -170,6 +174,9 @@ main (gint argc, { gtk_test_init (&argc, &argv, NULL); +#ifdef PLUGIN_BUILDDIR + peas_engine_add_search_path (peas_engine_get_default (), PLUGIN_BUILDDIR, NULL); +#endif /* this is a workaround for an issue with sofia: https://github.com/freeswitch/sofia-sip/issues/58 */ su_random64 ();