diff options
Diffstat (limited to 'tests/test-pulse-manager.c')
-rw-r--r-- | tests/test-pulse-manager.c | 14 |
1 files changed, 11 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>. /* 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); } |