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 <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-12-18 07:52:48 -05:00
parent 2586348921
commit ed5f035855
3 changed files with 10 additions and 6 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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);
}