From ed5f035855a52fb63fff7c0b1cebf2e33ff55752 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 18 Dec 2015 07:52:48 -0500 Subject: [PATCH] core/audio: Rename audio_get_player() to test_audio_player() Also, let's only have this function when CONFIG_TESTING is enabled. Signed-off-by: Anna Schumaker --- core/audio.c | 4 +++- include/core/audio.h | 4 +++- tests/core/audio.c | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/audio.c b/core/audio.c index a5a5899e..d9633ab3 100644 --- a/core/audio.c +++ b/core/audio.c @@ -248,7 +248,9 @@ void audio_pause_after(int n) } } -GstElement *audio_get_player() +#ifdef CONFIG_TESTING +GstElement *test_audio_player() { return audio_player; } +#endif /* CONFIG_TESTING */ diff --git a/include/core/audio.h b/include/core/audio.h index 90ad988e..1911a942 100644 --- a/include/core/audio.h +++ b/include/core/audio.h @@ -67,5 +67,7 @@ void audio_error(GstMessage *); /* Called to configure automatic pausing. */ void audio_pause_after(int); -GstElement *audio_get_player(); +#ifdef CONFIG_TESTING +GstElement *test_audio_player(); +#endif /* CONFIG_TESTING */ #endif /* OCARINA_CORE_AUDIO_H */ diff --git a/tests/core/audio.c b/tests/core/audio.c index 8c6e08fb..da6a381b 100644 --- a/tests/core/audio.c +++ b/tests/core/audio.c @@ -29,7 +29,7 @@ static void test_send_error() GError *error; error = g_error_new(1, G_FILE_ERROR_BADF, "Simulated Error"); - message = gst_message_new_error(GST_OBJECT(audio_get_player()), + message = gst_message_new_error(GST_OBJECT(test_audio_player()), error, "Error generated for testing"); audio_error(message); @@ -61,7 +61,7 @@ static struct core_init_data test_init_data = { static void test_init() { - test_equal((void *)audio_get_player(), NULL); + test_equal((void *)test_audio_player(), NULL); test_equal((void *)audio_cur_track(), NULL); test_equal(audio_cur_state(), GST_STATE_NULL); test_equal((void *)audio_next(), NULL); @@ -86,7 +86,7 @@ static void test_init() while (idle_run_task()) {}; test_equal((void *)audio_cur_track(), NULL); - test_not_equal((void *)audio_get_player(), NULL); + test_not_equal((void *)test_audio_player(), NULL); } static void test_playback() @@ -239,7 +239,7 @@ static void test_deinit() { core_deinit(); test_equal((void *)audio_cur_track(), NULL); - test_equal((void *)audio_get_player(), NULL); + test_equal((void *)test_audio_player(), NULL); }