From 6c2b978f17d48fe212cccb15c23bb1e278ba600f Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 9 Mar 2010 13:43:16 +1100 Subject: flesh out test_pa_context_exit --- tests/test-pulse-manager.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tests/test-pulse-manager.c') diff --git a/tests/test-pulse-manager.c b/tests/test-pulse-manager.c index f5dfb80..f4f7ffc 100644 --- a/tests/test-pulse-manager.c +++ b/tests/test-pulse-manager.c @@ -20,21 +20,28 @@ with this program. If not, see . /* we test static functions */ #include "../src/pulse-manager.c" +#include "mockpulse.h" -pa_context* context; static void test_pa_context_exit() { + pa_context* context = pa_context_new(NULL, "foo"); pa_context_set_state_callback(context, context_state_callback, NULL); // => call context_state_callback(context, NULL); - // pa_context_get_state needs to be mocked to return the right FAIL flag. + // pa_context_get_state is mocked to return the right FAIL flag. + set_pa_context_get_state_result(context, PA_CONTEXT_FAILED); + context_state_callback(context, NULL); // 1. test to make sure relevant variables are tidied up - // 2. then using the same pa_context_get_state we could ensure the manager is attempting to reconnect tp PA. + // XXX: Conor to do. + // 2. then using the same pa_context_get_state we could ensure the manager + // is attempting to reconnect to PA. + pa_context_unref(context); } static void test_sink_insert() { sink_info *value; + pa_context* context = pa_context_new(NULL, "foo"); value = g_new0(sink_info, 1); value->index = 8; value->name = "mock_sink"; @@ -46,6 +53,7 @@ static void test_sink_insert() // update_sink_info is a static method in pulse-manager.c ? pa_context_get_sink_info_by_index(context, value->index, update_sink_info, NULL); // the mockinkg lib should then return this mocked up sink_info to the method update_sink_info which tests could be wrote against to make sure everthing is populated correctly. + pa_context_unref(context); } -- cgit v1.2.3