From ed011b10cc9ff87b19a7c17c43f4ce22c57c135a Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Mon, 29 Apr 2013 19:38:40 +0100 Subject: [PATCH] ecore_audio: Test pulseaudio output if it is enabled Signed-off-by: Daniel Willmann --- src/tests/ecore/ecore_test_ecore_audio.c | 48 +++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/tests/ecore/ecore_test_ecore_audio.c b/src/tests/ecore/ecore_test_ecore_audio.c index ec52973339..75c5bb0ccc 100644 --- a/src/tests/ecore/ecore_test_ecore_audio.c +++ b/src/tests/ecore/ecore_test_ecore_audio.c @@ -2,6 +2,8 @@ #include #endif +#include + #include #include @@ -317,6 +319,50 @@ static Eina_Bool _looped_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Desc return EINA_TRUE; } +#ifdef HAVE_PULSE +static Eina_Bool +_seek_vol(void *data) +{ + double len; + Eo *in = data; + + eo_do(in, ecore_audio_obj_volume_set(0.4)); + eo_do(in, ecore_audio_obj_in_seek(-0.3, SEEK_END, &len)); + fail_if(len < 0); + + return EINA_FALSE; +} + +START_TEST(ecore_test_ecore_audio_obj_pulse) +{ + Eo *in, *out; + Eina_Bool ret; + + in = eo_add(ECORE_AUDIO_OBJ_IN_SNDFILE_CLASS, NULL); + fail_if(!in); + + eo_do(in, ecore_audio_obj_name_set("modem.wav")); + eo_do(in, ecore_audio_obj_source_set(TESTS_SRC_DIR"/modem.wav", &ret)); + fail_if(!ret); + + out = eo_add(ECORE_AUDIO_OBJ_OUT_PULSE_CLASS, NULL); + fail_if(!out); + + ecore_timer_add(0.3, _seek_vol, in); + + eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _finished_cb, NULL)); + + eo_do(out, ecore_audio_obj_out_input_attach(in, &ret)); + fail_if(!ret); + + ecore_main_loop_begin(); + + eo_del(out); + eo_del(in); +} +END_TEST +#endif + START_TEST(ecore_test_ecore_audio_obj_tone) { Eo *in, *out; @@ -747,7 +793,7 @@ ecore_test_ecore_audio(TCase *tc) #ifdef HAVE_SNDFILE tcase_add_test(tc, ecore_test_ecore_audio_obj_sndfile); #endif -#ifdef HAVE_PUSE +#ifdef HAVE_PULSE tcase_add_test(tc, ecore_test_ecore_audio_obj_pulse); #endif