1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-05-17 02:29:28 +00:00
Purism-Calls/tests/test-provider.c
Bob Ham 460c0c6c3d Turn providers into plugins courtesy of libpeas
This is an initial, static implementation of plugins.  The
CallsApplication has a plugin name which can be changed with a new
--provider command line option.  This plugin name is used to
instantiate the appropriate plugin when the application is activated.
From then on, the plugin cannot change.

In future, we can expand this support to include loading multiple
plugins at once, configurable through some UI.  This will have
far-reaching implications though, and complicate things like
enumerating the provider hierarchy.  There is also no practical
benefit right now; the mm and ofono plugins can't be used at the same
time because ModemManager and oFono don't play nice together, and the
whole raison d'être of the dummy plugin is undermined if you can make
use of one of the others.  So for now, we just implement one static
plugin.
2018-11-23 15:51:46 +00:00

71 lines
1.5 KiB
C

/*
* Copyright (C) 2018 Purism SPC
*
* SPDX-License-Identifier: GPL-3.0+
*/
#include "setup-provider.h"
#include "calls-provider.h"
#include "calls-origin.h"
#include "calls-message-source.h"
#include "common.h"
#include <gtk/gtk.h>
#include <string.h>
static void
test_dummy_provider_object (ProviderFixture *fixture,
gconstpointer user_data)
{
g_assert_true (G_IS_OBJECT (fixture->dummy_provider));
g_assert_true (CALLS_IS_MESSAGE_SOURCE (fixture->dummy_provider));
g_assert_true (CALLS_IS_PROVIDER (fixture->dummy_provider));
}
static void
test_dummy_provider_get_name (ProviderFixture *fixture,
gconstpointer user_data)
{
CallsProvider *provider;
const gchar *name;
provider = CALLS_PROVIDER (fixture->dummy_provider);
name = calls_provider_get_name (provider);
g_assert_nonnull (name);
g_assert_cmpuint (strlen (name), >, 0U);
}
static void
test_dummy_provider_origins (ProviderFixture *fixture,
gconstpointer user_data)
{
GList *origins;
origins = calls_provider_get_origins
(CALLS_PROVIDER (fixture->dummy_provider));
g_assert_cmpuint (g_list_length (origins), ==, 1);
g_list_free (origins);
}
gint
main (gint argc,
gchar *argv[])
{
gtk_test_init (&argc, &argv, NULL);
#define add_test(name) add_calls_test(Provider, provider, name)
add_test(object);
add_test(get_name);
add_test(origins);
#undef add_test
return g_test_run();
}