asdfuser pushed a commit to branch master.

commit fdb73b8a49f8f12285de9aac0777b6d7185ba4e7
Author: Daniel Willmann <[email protected]>
Date:   Fri Apr 26 18:48:00 2013 +0100

    ecore_audio: Test VIO input/output of base in/out class
    
    Signed-off-by: Daniel Willmann <[email protected]>
---
 src/tests/ecore/ecore_test_ecore_audio.c | 61 ++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

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)
 }
 END_TEST
 
+static int read_cb(void *data EINA_UNUSED, Eo *eo_obj EINA_UNUSED, void 
*buffer, int len)
+{
+  static int i = 0;
+  int j;
+  uint8_t *buf = buffer;
+
+  for (j=0;j<len; j++) {
+      buf[j] = i++ %256;
+  }
+  return len;
+}
+
+static int write_cb(void *data EINA_UNUSED, Eo *eo_obj EINA_UNUSED, const void 
*buffer, int len)
+{
+  static int i = 0;
+  int j;
+  const uint8_t *buf = buffer;
+
+  for (j=0;j<len; j++) {
+      if (buf[j] != i%256)
+        fail_if(buf[j] != i%256);
+      i++;
+  }
+
+  if (i > 100000)
+    ecore_main_loop_quit();
+
+  return len;
+}
+
+Ecore_Audio_Vio in_vio = {
+    .read = read_cb,
+};
+
+Ecore_Audio_Vio out_vio = {
+    .write = write_cb,
+};
+
+START_TEST(ecore_test_ecore_audio_obj_vio)
+{
+  Eo *in, *out;
+
+  in = eo_add(ECORE_AUDIO_OBJ_IN_CLASS, NULL);
+  fail_if(!in);
+
+  out = eo_add(ECORE_AUDIO_OBJ_OUT_CLASS, NULL);
+  fail_if(!out);
+
+  eo_do(in, ecore_audio_obj_vio_set(&in_vio, NULL, NULL));
+  eo_do(out, ecore_audio_obj_vio_set(&out_vio, NULL, NULL));
+
+  eo_do(out, ecore_audio_obj_out_input_attach(in, NULL));
+
+  ecore_main_loop_begin();
+
+  eo_del(out);
+  eo_del(in);
+}
+END_TEST
+
 START_TEST(ecore_test_ecore_audio_obj_in)
 {
   int i;
@@ -655,6 +715,7 @@ ecore_test_ecore_audio(TCase *tc)
 
    tcase_add_test(tc, ecore_test_ecore_audio_obj);
    tcase_add_test(tc, ecore_test_ecore_audio_obj_in);
+   tcase_add_test(tc, ecore_test_ecore_audio_obj_vio);
    tcase_add_test(tc, ecore_test_ecore_audio_obj_in_out);
    tcase_add_test(tc, ecore_test_ecore_audio_obj_tone);
 

-- 

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr

Reply via email to