2021-10-22 05:23:29 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 Purism SPC
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
* Author: Evangelos Ribeiro Tzaras <devrtz@fortysixandtwo.eu>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "calls-manager.h"
|
|
|
|
#include "calls-ringer.h"
|
2022-01-31 16:18:35 +00:00
|
|
|
#include "calls-ui-call-data.h"
|
2021-10-22 05:23:29 +00:00
|
|
|
#include "mock-call.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* add or remove calls */
|
|
|
|
|
|
|
|
static void
|
2022-01-31 16:18:35 +00:00
|
|
|
add_call (CallsManager *manager,
|
|
|
|
CallsUiCallData *call)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
|
|
|
g_assert (CALLS_IS_MANAGER (manager));
|
2022-01-31 16:18:35 +00:00
|
|
|
g_assert (CALLS_IS_UI_CALL_DATA (call));
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-01-31 16:18:35 +00:00
|
|
|
g_signal_emit_by_name (manager, "ui-call-added", call, NULL);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2022-01-31 16:18:35 +00:00
|
|
|
remove_call (CallsManager *manager,
|
|
|
|
CallsUiCallData *call)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
|
|
|
g_assert (CALLS_IS_MANAGER (manager));
|
2022-01-31 16:18:35 +00:00
|
|
|
g_assert (CALLS_IS_UI_CALL_DATA (call));
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-01-31 16:18:35 +00:00
|
|
|
g_signal_emit_by_name (manager, "ui-call-removed", call, NULL);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
/* RingerFixture setup and tear down */
|
2021-10-22 05:23:29 +00:00
|
|
|
typedef struct {
|
2022-01-31 16:18:35 +00:00
|
|
|
CallsManager *manager;
|
|
|
|
CallsRinger *ringer;
|
|
|
|
CallsMockCall *call_one;
|
|
|
|
CallsUiCallData *ui_call_one;
|
|
|
|
CallsMockCall *call_two;
|
|
|
|
CallsUiCallData *ui_call_two;
|
|
|
|
GMainLoop *loop;
|
2022-09-19 17:39:00 +00:00
|
|
|
} RingerFixture;
|
2021-10-22 05:23:29 +00:00
|
|
|
|
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
static void
|
|
|
|
setup_ringer (RingerFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
fixture->manager = calls_manager_get_default ();
|
|
|
|
fixture->ringer = calls_ringer_new ();
|
|
|
|
fixture->call_one = calls_mock_call_new ();
|
|
|
|
fixture->ui_call_one = calls_ui_call_data_new (CALLS_CALL (fixture->call_one), NULL);
|
|
|
|
fixture->call_two = calls_mock_call_new ();
|
|
|
|
fixture->ui_call_two = calls_ui_call_data_new (CALLS_CALL (fixture->call_two), NULL);
|
|
|
|
fixture->loop = g_main_loop_new (NULL, FALSE);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
static void
|
|
|
|
tear_down_ringer (RingerFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
2022-09-14 09:46:15 +00:00
|
|
|
g_assert_finalize_object (fixture->ui_call_one);
|
|
|
|
g_assert_finalize_object (fixture->call_one);
|
|
|
|
g_assert_finalize_object (fixture->ui_call_two);
|
|
|
|
g_assert_finalize_object (fixture->call_two);
|
|
|
|
g_assert_finalize_object (fixture->ringer);
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_unref (fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* t1: test_ringing_incoming_call */
|
|
|
|
static void
|
|
|
|
t1_on_ringer_call_accepted (CallsRinger *ringer,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
static guint test_phase = 0;
|
2022-09-19 17:39:00 +00:00
|
|
|
RingerFixture *fixture = user_data;
|
2021-10-22 05:23:29 +00:00
|
|
|
|
|
|
|
switch (test_phase++) {
|
|
|
|
case 0: /* incoming call */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (ringer), ==, CALLS_RING_STATE_RINGING);
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_answer (CALLS_CALL (fixture->call_one));
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
case 1: /* incoming call accepted */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_quit ((GMainLoop *) fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached (); /* did not find equivalent cmocka assertion */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2022-09-19 17:39:00 +00:00
|
|
|
test_ringing_accept_call (RingerFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
g_signal_connect (fixture->ringer,
|
2022-09-13 10:25:15 +00:00
|
|
|
"notify::state",
|
2021-10-22 05:23:29 +00:00
|
|
|
G_CALLBACK (t1_on_ringer_call_accepted),
|
2022-09-19 17:39:00 +00:00
|
|
|
fixture);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_set_state (CALLS_CALL (fixture->call_one), CALLS_CALL_STATE_INCOMING);
|
|
|
|
add_call (fixture->manager, fixture->ui_call_one);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
/* main loop will quit in callback of notify::state */
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_run (fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
remove_call (fixture->manager, fixture->ui_call_one);
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* t2: test_ringing_hang_up_call */
|
|
|
|
static void
|
|
|
|
t2_on_ringer_call_hang_up (CallsRinger *ringer,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
static guint test_phase = 0;
|
2022-09-19 17:39:00 +00:00
|
|
|
RingerFixture *fixture = user_data;
|
2021-10-22 05:23:29 +00:00
|
|
|
|
|
|
|
switch (test_phase++) {
|
|
|
|
case 0: /* incoming call */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (ringer), ==, CALLS_RING_STATE_RINGING);
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_hang_up (CALLS_CALL (fixture->call_one));
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
case 1: /* incoming call hung up */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_quit ((GMainLoop *) fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached (); /* did not find equivalent cmocka assertion */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2022-09-19 17:39:00 +00:00
|
|
|
test_ringing_hang_up_call (RingerFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
g_signal_connect (fixture->ringer,
|
2022-09-13 10:25:15 +00:00
|
|
|
"notify::state",
|
2021-10-22 05:23:29 +00:00
|
|
|
G_CALLBACK (t2_on_ringer_call_hang_up),
|
2022-09-19 17:39:00 +00:00
|
|
|
fixture);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_set_state (CALLS_CALL (fixture->call_one), CALLS_CALL_STATE_INCOMING);
|
|
|
|
add_call (fixture->manager, fixture->ui_call_one);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
/* main loop will quit in callback of notify::state */
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_run (fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
remove_call (fixture->manager, fixture->ui_call_one);
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-19 17:19:28 +00:00
|
|
|
/* t3: test_ringing_silence_call */
|
2021-10-22 05:23:29 +00:00
|
|
|
static void
|
2022-09-19 17:19:28 +00:00
|
|
|
t3_on_ringer_call_silence (CallsRinger *ringer,
|
2021-10-22 05:23:29 +00:00
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
static guint test_phase = 0;
|
2022-09-19 17:39:00 +00:00
|
|
|
RingerFixture *fixture = user_data;
|
2021-10-22 05:23:29 +00:00
|
|
|
|
|
|
|
switch (test_phase++) {
|
|
|
|
case 0: /* incoming call */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_RINGING);
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_ui_call_data_silence_ring (fixture->ui_call_one);
|
|
|
|
g_assert_true (calls_ui_call_data_get_silenced (fixture->ui_call_one));
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
case 1: /* incoming call hung up */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_quit ((GMainLoop *) fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached (); /* did not find equivalent cmocka assertion */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2022-09-19 17:39:00 +00:00
|
|
|
test_ringing_silence_call (RingerFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
g_signal_connect (fixture->ringer,
|
2022-09-13 10:25:15 +00:00
|
|
|
"notify::state",
|
2022-09-19 17:19:28 +00:00
|
|
|
G_CALLBACK (t3_on_ringer_call_silence),
|
2022-09-19 17:39:00 +00:00
|
|
|
fixture);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_set_state (CALLS_CALL (fixture->call_one), CALLS_CALL_STATE_INCOMING);
|
|
|
|
add_call (fixture->manager, fixture->ui_call_one);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
/* main loop will quit in callback of notify::state */
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_run (fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
remove_call (fixture->manager, fixture->ui_call_one);
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-19 17:19:28 +00:00
|
|
|
/* t4: test_ringing_multiple_call */
|
2021-10-22 05:23:29 +00:00
|
|
|
static gboolean
|
2022-09-19 17:19:28 +00:00
|
|
|
t4_remove_calls (gpointer user_data)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
|
|
|
static guint test_phase = 0;
|
2022-09-19 17:39:00 +00:00
|
|
|
RingerFixture *fixture = user_data;
|
2021-10-22 05:23:29 +00:00
|
|
|
|
|
|
|
if (test_phase == 0) {
|
2022-09-19 17:39:00 +00:00
|
|
|
remove_call (fixture->manager, fixture->ui_call_one);
|
2021-10-22 05:23:29 +00:00
|
|
|
test_phase++;
|
|
|
|
return G_SOURCE_CONTINUE;
|
|
|
|
}
|
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_RINGING);
|
2022-09-19 17:39:00 +00:00
|
|
|
remove_call (fixture->manager, fixture->ui_call_two);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2022-09-19 17:19:28 +00:00
|
|
|
t4_on_ringer_multiple_calls (CallsRinger *ringer,
|
2021-10-22 05:23:29 +00:00
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
static guint test_phase = 0;
|
2022-09-19 17:39:00 +00:00
|
|
|
RingerFixture *fixture = user_data;
|
2021-10-22 05:23:29 +00:00
|
|
|
|
|
|
|
switch (test_phase++) {
|
|
|
|
case 0: /* add second call, and schedule call removal */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_RINGING);
|
2022-09-19 17:39:00 +00:00
|
|
|
add_call (fixture->manager, fixture->ui_call_two);
|
|
|
|
g_timeout_add (25, t4_remove_calls, fixture);
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
case 1: /* both calls should be removed now */
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_quit ((GMainLoop *) fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached (); /* did not find equivalent cmocka assertion */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2022-09-19 17:39:00 +00:00
|
|
|
test_ringing_multiple_calls (RingerFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2021-10-22 05:23:29 +00:00
|
|
|
{
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
g_signal_connect (fixture->ringer,
|
2022-09-13 10:25:15 +00:00
|
|
|
"notify::state",
|
2022-09-19 17:19:28 +00:00
|
|
|
G_CALLBACK (t4_on_ringer_multiple_calls),
|
2022-09-19 17:39:00 +00:00
|
|
|
fixture);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_set_state (CALLS_CALL (fixture->call_one), CALLS_CALL_STATE_INCOMING);
|
|
|
|
add_call (fixture->manager, fixture->ui_call_one);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
/* main loop will quit in callback of notify::state */
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_run (fixture->loop);
|
2021-10-22 05:23:29 +00:00
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-26 07:41:22 +00:00
|
|
|
static void
|
2022-09-19 17:19:28 +00:00
|
|
|
t5_on_ringer_multiple_calls_with_restart (CallsRinger *ringer,
|
2021-11-26 07:41:22 +00:00
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
static guint test_phase = 0;
|
2022-09-19 17:39:00 +00:00
|
|
|
RingerFixture *fixture = user_data;
|
2021-11-26 07:41:22 +00:00
|
|
|
|
|
|
|
switch (test_phase++) {
|
|
|
|
case 0:
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_RINGING);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_answer (CALLS_CALL (fixture->call_one));
|
2021-11-26 07:41:22 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_RINGING_SOFT);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_hang_up (CALLS_CALL (fixture->call_one));
|
2021-11-26 07:41:22 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_RINGING);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_hang_up (CALLS_CALL (fixture->call_two));
|
2021-11-26 07:41:22 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_quit (fixture->loop);
|
2021-11-26 07:41:22 +00:00
|
|
|
break;
|
|
|
|
default:
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_not_reached ();
|
2021-11-26 07:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-09-19 17:39:00 +00:00
|
|
|
test_ringing_multiple_calls_with_restart (RingerFixture *fixture,
|
|
|
|
gconstpointer user_data)
|
2021-11-26 07:41:22 +00:00
|
|
|
{
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
g_signal_connect (fixture->ringer,
|
2022-09-13 10:25:15 +00:00
|
|
|
"notify::state",
|
2022-09-19 17:19:28 +00:00
|
|
|
G_CALLBACK (t5_on_ringer_multiple_calls_with_restart),
|
2022-09-19 17:39:00 +00:00
|
|
|
fixture);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-19 17:39:00 +00:00
|
|
|
calls_call_set_state (CALLS_CALL (fixture->call_one), CALLS_CALL_STATE_INCOMING);
|
|
|
|
add_call (fixture->manager, fixture->ui_call_one);
|
|
|
|
calls_call_set_state (CALLS_CALL (fixture->call_two), CALLS_CALL_STATE_INCOMING);
|
|
|
|
add_call (fixture->manager, fixture->ui_call_two);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
/* main loop will quit in callback of notify::state */
|
2022-09-19 17:39:00 +00:00
|
|
|
g_main_loop_run (fixture->loop);
|
2021-11-26 07:41:22 +00:00
|
|
|
|
2022-09-13 10:25:15 +00:00
|
|
|
g_assert_cmpint (calls_ringer_get_state (fixture->ringer), ==, CALLS_RING_STATE_INACTIVE);
|
2021-11-26 07:41:22 +00:00
|
|
|
}
|
|
|
|
|
2021-10-22 05:23:29 +00:00
|
|
|
int
|
|
|
|
main (int argc,
|
|
|
|
char *argv[])
|
|
|
|
{
|
2022-09-19 17:39:00 +00:00
|
|
|
g_test_init (&argc, &argv, NULL);
|
|
|
|
|
|
|
|
g_test_add ("/Calls/Ringer/accept_call", RingerFixture, NULL,
|
|
|
|
setup_ringer, test_ringing_accept_call, tear_down_ringer);
|
|
|
|
g_test_add ("/Calls/Ringer/hang_up_call", RingerFixture, NULL,
|
|
|
|
setup_ringer, test_ringing_hang_up_call, tear_down_ringer);
|
|
|
|
g_test_add ("/Calls/Ringer/silence_call", RingerFixture, NULL,
|
|
|
|
setup_ringer, test_ringing_silence_call, tear_down_ringer);
|
|
|
|
g_test_add ("/Calls/Ringer/multiple_call", RingerFixture, NULL,
|
|
|
|
setup_ringer, test_ringing_multiple_calls, tear_down_ringer);
|
|
|
|
g_test_add ("/Calls/Ringer/multiple_call_restart", RingerFixture, NULL,
|
|
|
|
setup_ringer, test_ringing_multiple_calls_with_restart, tear_down_ringer);
|
|
|
|
|
|
|
|
return g_test_run ();
|
2021-10-22 05:23:29 +00:00
|
|
|
}
|