diff --git a/plugins/sip/calls-sip-provider.c b/plugins/sip/calls-sip-provider.c index 2c95820..316e3ca 100644 --- a/plugins/sip/calls-sip-provider.c +++ b/plugins/sip/calls-sip-provider.c @@ -83,6 +83,16 @@ struct _CallsSipProvider static void calls_sip_provider_message_source_interface_init (CallsMessageSourceInterface *iface); static void calls_sip_provider_account_provider_interface_init (CallsAccountProviderInterface *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) + G_IMPLEMENT_INTERFACE (CALLS_TYPE_ACCOUNT_PROVIDER, + calls_sip_provider_account_provider_interface_init)) + +#else G_DEFINE_DYNAMIC_TYPE_EXTENDED (CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, 0, @@ -91,6 +101,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_ACCOUNT_PROVIDER, calls_sip_provider_account_provider_interface_init)) +#endif /* FOR_TESTING */ + typedef struct { CallsSipProvider *provider; GKeyFile *key_file; @@ -502,11 +514,14 @@ calls_sip_provider_dispose (GObject *object) } +#ifndef FOR_TESTING + static void calls_sip_provider_class_finalize (CallsSipProviderClass *klass) { } +#endif /* FOR_TESTING */ static void calls_sip_provider_class_init (CallsSipProviderClass *klass) @@ -813,6 +828,7 @@ calls_sip_provider_save_accounts_to_disk (CallsSipProvider *self) } +#ifndef FOR_TESTING G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module) @@ -823,3 +839,5 @@ 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 95c73e0..a2335e5 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -94,11 +94,12 @@ t = executable('plugins', test_sources, test('plugins', t, env: test_env) test_sources = [ 'test-media.c' ] +test_sources += sip_sources t = executable('media', test_sources, c_args : test_cflags, link_args: test_link_args, pie: true, - link_with : [calls_vala, calls_sip, libcalls], + link_with : [calls_vala, libcalls], dependencies: [calls_deps, sip_deps], include_directories : [ calls_includes, @@ -108,11 +109,12 @@ t = executable('media', test_sources, test('media', t, env: test_env) test_sources = [ 'test-sip.c' ] +test_sources += sip_sources t = executable('sip', test_sources, c_args : test_cflags, link_args: test_link_args, pie: true, - link_with : [calls_vala, calls_sip, libcalls], + link_with : [calls_vala, libcalls], dependencies: [calls_deps, sip_deps], include_directories : [ calls_includes, diff --git a/tests/test-sip.c b/tests/test-sip.c index 0805f80..257eaad 100644 --- a/tests/test-sip.c +++ b/tests/test-sip.c @@ -64,7 +64,7 @@ static void setup_sip_provider (SipFixture *fixture, gconstpointer user_data) { - CallsProvider *provider = calls_provider_load_plugin ("sip"); + CallsProvider *provider = g_object_new (CALLS_TYPE_SIP_PROVIDER, NULL); fixture->provider = CALLS_SIP_PROVIDER (provider); is_call_test_done = FALSE; @@ -76,7 +76,6 @@ tear_down_sip_provider (SipFixture *fixture, gconstpointer user_data) { g_clear_object (&fixture->provider); - calls_provider_unload_plugin ("sip"); }