summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore_audio.c
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-26 18:48:00 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-26 18:49:25 +0100
commitfdb73b8a49f8f12285de9aac0777b6d7185ba4e7 (patch)
tree9a986b8e7e013ce88e2e6229085d10c84aeb54d6 /src/tests/ecore/ecore_test_ecore_audio.c
parent1a8fcf81a06ad569ebd83a16a8c7c21d32dff442 (diff)
ecore_audio: Test VIO input/output of base in/out class
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.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_audio.c b/src/tests/ecore/ecore_test_ecore_audio.c
index c1e3e26..301282b 100644
--- a/src/tests/ecore/ecore_test_ecore_audio.c
+++ b/src/tests/ecore/ecore_test_ecore_audio.c
@@ -486,6 +486,66 @@ START_TEST(ecore_test_ecore_audio_obj_in_out)
486} 486}
487END_TEST 487END_TEST
488 488
489static int read_cb(void *data EINA_UNUSED, Eo *eo_obj EINA_UNUSED, void *buffer, int len)
490{
491 static int i = 0;
492 int j;
493 uint8_t *buf = buffer;
494
495 for (j=0;j<len; j++) {
496 buf[j] = i++ %256;
497 }
498 return len;
499}
500
501static int write_cb(void *data EINA_UNUSED, Eo *eo_obj EINA_UNUSED, const void *buffer, int len)
502{
503 static int i = 0;
504 int j;
505 const uint8_t *buf = buffer;
506
507 for (j=0;j<len; j++) {
508 if (buf[j] != i%256)
509 fail_if(buf[j] != i%256);
510 i++;
511 }
512
513 if (i > 100000)
514 ecore_main_loop_quit();
515
516 return len;
517}
518
519Ecore_Audio_Vio in_vio = {
520 .read = read_cb,
521};
522
523Ecore_Audio_Vio out_vio = {
524 .write = write_cb,
525};
526
527START_TEST(ecore_test_ecore_audio_obj_vio)
528{
529 Eo *in, *out;
530
531 in = eo_add(ECORE_AUDIO_OBJ_IN_CLASS, NULL);
532 fail_if(!in);
533
534 out = eo_add(ECORE_AUDIO_OBJ_OUT_CLASS, NULL);
535 fail_if(!out);
536
537 eo_do(in, ecore_audio_obj_vio_set(&in_vio, NULL, NULL));
538 eo_do(out, ecore_audio_obj_vio_set(&out_vio, NULL, NULL));
539
540 eo_do(out, ecore_audio_obj_out_input_attach(in, NULL));
541
542 ecore_main_loop_begin();
543
544 eo_del(out);
545 eo_del(in);
546}
547END_TEST
548
489START_TEST(ecore_test_ecore_audio_obj_in) 549START_TEST(ecore_test_ecore_audio_obj_in)
490{ 550{
491 int i; 551 int i;
@@ -655,6 +715,7 @@ ecore_test_ecore_audio(TCase *tc)
655 715
656 tcase_add_test(tc, ecore_test_ecore_audio_obj); 716 tcase_add_test(tc, ecore_test_ecore_audio_obj);
657 tcase_add_test(tc, ecore_test_ecore_audio_obj_in); 717 tcase_add_test(tc, ecore_test_ecore_audio_obj_in);
718 tcase_add_test(tc, ecore_test_ecore_audio_obj_vio);
658 tcase_add_test(tc, ecore_test_ecore_audio_obj_in_out); 719 tcase_add_test(tc, ecore_test_ecore_audio_obj_in_out);
659 tcase_add_test(tc, ecore_test_ecore_audio_obj_tone); 720 tcase_add_test(tc, ecore_test_ecore_audio_obj_tone);
660 721