2018-06-11 11:46:08 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Purism SPC
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0+
|
|
|
|
*/
|
|
|
|
|
2018-06-13 13:38:51 +00:00
|
|
|
#include "setup-provider.h"
|
2018-06-11 11:46:08 +00:00
|
|
|
#include "calls-provider.h"
|
|
|
|
#include "calls-origin.h"
|
|
|
|
#include "calls-message-source.h"
|
2018-06-13 13:38:51 +00:00
|
|
|
#include "common.h"
|
2018-06-11 11:46:08 +00:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
static void
|
2018-06-13 13:38:51 +00:00
|
|
|
test_dummy_provider_object (ProviderFixture *fixture,
|
2018-06-11 11:46:08 +00:00
|
|
|
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
|
2018-06-13 13:38:51 +00:00
|
|
|
test_dummy_provider_get_name (ProviderFixture *fixture,
|
2018-06-11 11:46:08 +00:00
|
|
|
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
|
2018-06-13 13:38:51 +00:00
|
|
|
test_dummy_provider_origins (ProviderFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2018-06-11 11:46:08 +00:00
|
|
|
{
|
2021-02-15 05:34:34 +00:00
|
|
|
GListModel *origins;
|
2018-06-13 13:38:51 +00:00
|
|
|
|
2018-06-11 11:46:08 +00:00
|
|
|
origins = calls_provider_get_origins
|
|
|
|
(CALLS_PROVIDER (fixture->dummy_provider));
|
2021-02-15 05:34:34 +00:00
|
|
|
g_assert_cmpuint (g_list_model_get_n_items (origins), ==, 1);
|
2018-06-11 11:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gint
|
|
|
|
main (gint argc,
|
|
|
|
gchar *argv[])
|
|
|
|
{
|
|
|
|
gtk_test_init (&argc, &argv, NULL);
|
|
|
|
|
|
|
|
|
2018-06-13 13:38:51 +00:00
|
|
|
#define add_test(name) add_calls_test(Provider, provider, name)
|
2018-06-11 11:46:08 +00:00
|
|
|
|
|
|
|
add_test(object);
|
|
|
|
add_test(get_name);
|
2018-06-13 13:38:51 +00:00
|
|
|
add_test(origins);
|
2018-06-11 11:46:08 +00:00
|
|
|
|
|
|
|
#undef add_test
|
|
|
|
|
2018-06-13 13:38:51 +00:00
|
|
|
|
2018-06-11 11:46:08 +00:00
|
|
|
return g_test_run();
|
|
|
|
}
|