summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore_audio.c
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-17 18:34:30 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-18 19:14:32 +0100
commit8b8dc1fd6da25360636d922b491eb5c247c7ecc6 (patch)
treed216b6662f9d624a889f0b1a48453711b2ce8067 /src/tests/ecore/ecore_test_ecore_audio.c
parent38b3738384b0c832f202dd545ca79fd9769f7c79 (diff)
ecore_audio: Enable tone test case
Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
Diffstat (limited to 'src/tests/ecore/ecore_test_ecore_audio.c')
-rw-r--r--src/tests/ecore/ecore_test_ecore_audio.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_audio.c b/src/tests/ecore/ecore_test_ecore_audio.c
index 2baed96..fe3641a 100644
--- a/src/tests/ecore/ecore_test_ecore_audio.c
+++ b/src/tests/ecore/ecore_test_ecore_audio.c
@@ -305,6 +305,62 @@ START_TEST(ecore_test_ecore_audio_custom)
305END_TEST 305END_TEST
306#endif 306#endif
307 307
308static Eina_Bool _finished_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
309{
310 ecore_main_loop_quit();
311
312 return EINA_FALSE;
313}
314
315START_TEST(ecore_test_ecore_audio_obj_tone)
316{
317 Eo *in, *out;
318 double len;
319 int channel, rate, freq;
320
321 in = eo_add(ECORE_AUDIO_OBJ_IN_TONE_CLASS, NULL);
322 fail_if(!in);
323
324 eo_do(in, ecore_audio_obj_name_set("tone"));
325
326 eo_do(in, ecore_audio_obj_in_channels_get(&channel));
327 fail_if(channel != 1);
328 eo_do(in, ecore_audio_obj_in_samplerate_get(&rate));
329 fail_if(rate != 44100);
330 eo_do(in, ecore_audio_obj_in_length_get(&len));
331 fail_if(len != 1);
332
333 eo_do(in, ecore_audio_obj_in_length_set(2.5));
334 eo_do(in, ecore_audio_obj_in_length_get(&len));
335 fail_if(len != 2.5);
336
337 eo_do(in, eo_base_data_get(ECORE_AUDIO_ATTR_TONE_FREQ, (void **)&freq));
338 fail_if(freq != 1000);
339
340 freq = 2000;
341 eo_do(in, eo_base_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
342
343 eo_do(in, eo_base_data_get(ECORE_AUDIO_ATTR_TONE_FREQ, (void **)&freq));
344 fail_if(freq != 2000);
345
346 out = eo_add(ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS, NULL);
347 fail_if(!out);
348
349 eo_do(out, ecore_audio_obj_name_set("tmp.wav"));
350 eo_do(out, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_WAV));
351 eo_do(out, ecore_audio_obj_source_set(SOUNDS_DIR"/tmp.wav"));
352
353 eo_do(out, ecore_audio_obj_out_input_attach(in));
354
355 eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _finished_cb, NULL));
356
357 ecore_main_loop_begin();
358
359 eo_del(in);
360 eo_del(out);
361}
362END_TEST
363
308START_TEST(ecore_test_ecore_audio_obj_sndfile) 364START_TEST(ecore_test_ecore_audio_obj_sndfile)
309{ 365{
310 Eo *in; 366 Eo *in;
@@ -469,6 +525,7 @@ ecore_test_ecore_audio(TCase *tc)
469 tcase_add_test(tc, ecore_test_ecore_audio_obj); 525 tcase_add_test(tc, ecore_test_ecore_audio_obj);
470 tcase_add_test(tc, ecore_test_ecore_audio_obj_in_out); 526 tcase_add_test(tc, ecore_test_ecore_audio_obj_in_out);
471 tcase_add_test(tc, ecore_test_ecore_audio_obj_sndfile); 527 tcase_add_test(tc, ecore_test_ecore_audio_obj_sndfile);
528 tcase_add_test(tc, ecore_test_ecore_audio_obj_tone);
472 529
473/* 530/*
474 tcase_add_test(tc, ecore_test_ecore_audio_default); 531 tcase_add_test(tc, ecore_test_ecore_audio_default);