forked from enlightenment/efl
ecore_audio test: Better test coverage for inputs
Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
This commit is contained in:
parent
3b5f002f17
commit
af8fed32c6
|
@ -332,6 +332,9 @@ START_TEST(ecore_test_ecore_audio_obj_tone)
|
|||
eo_do(in, ecore_audio_obj_in_length_get(&len));
|
||||
fail_if(len != 2.5);
|
||||
|
||||
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
|
||||
fail_if(len != 2.5);
|
||||
|
||||
eo_do(in, eo_base_data_get(ECORE_AUDIO_ATTR_TONE_FREQ, (void **)&freq));
|
||||
fail_if(freq != 1000);
|
||||
|
||||
|
@ -341,6 +344,24 @@ START_TEST(ecore_test_ecore_audio_obj_tone)
|
|||
eo_do(in, eo_base_data_get(ECORE_AUDIO_ATTR_TONE_FREQ, (void **)&freq));
|
||||
fail_if(freq != 2000);
|
||||
|
||||
eo_do(in, ecore_audio_obj_in_seek(1.0, SEEK_SET, &len));
|
||||
fail_if(len != 1.0);
|
||||
|
||||
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
|
||||
fail_if(len != 1.5);
|
||||
|
||||
eo_do(in, ecore_audio_obj_in_seek(1.0, SEEK_CUR, &len));
|
||||
fail_if(len != 2.0);
|
||||
|
||||
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
|
||||
fail_if(len != 0.5);
|
||||
|
||||
eo_do(in, ecore_audio_obj_in_seek(-1.0, SEEK_END, &len));
|
||||
fail_if(len != 1.5);
|
||||
|
||||
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
|
||||
fail_if(len != 1.0);
|
||||
|
||||
out = eo_add(ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS, NULL);
|
||||
fail_if(!out);
|
||||
|
||||
|
@ -443,42 +464,129 @@ START_TEST(ecore_test_ecore_audio_obj_in_out)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(ecore_test_ecore_audio_obj)
|
||||
START_TEST(ecore_test_ecore_audio_obj_in)
|
||||
{
|
||||
const char *name;
|
||||
Eina_Bool paused;
|
||||
double volume;
|
||||
int i;
|
||||
double speed, length;
|
||||
int samplerate, channels;
|
||||
Eina_Bool looped;
|
||||
|
||||
ssize_t read;
|
||||
uint8_t buf[10];
|
||||
|
||||
Eo *in = eo_add(ECORE_AUDIO_OBJ_IN_CLASS, NULL);
|
||||
|
||||
fail_if(!in);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_name_get(&name)));
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
|
||||
fail_if(speed != 1.0);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_speed_set(2.5)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
|
||||
fail_if(speed != 2.5);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_speed_set(0)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
|
||||
fail_if(speed != 0.2);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_speed_set(10)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
|
||||
fail_if(speed != 5.0);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_samplerate_get(&samplerate)));
|
||||
fail_if(samplerate != 0);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_samplerate_set(1234)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_samplerate_get(&samplerate)));
|
||||
fail_if(samplerate != 1234);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_channels_get(&channels)));
|
||||
fail_if(channels != 0);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_channels_set(2)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_channels_get(&channels)));
|
||||
fail_if(channels != 2);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_looped_get(&looped)));
|
||||
fail_if(looped);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_looped_set(EINA_TRUE)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_looped_get(&looped)));
|
||||
fail_if(!looped);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_length_get(&length)));
|
||||
fail_if(length != 0);
|
||||
|
||||
fail_if(eo_do(in, ecore_audio_obj_in_length_set(10.0)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_remaining_get(&length)));
|
||||
fail_if(length != -1);
|
||||
|
||||
memset(buf, 0xaa, 10);
|
||||
fail_if(!eo_do(in, ecore_audio_obj_in_read(buf, 10, &read)));
|
||||
fail_if(read != 0);
|
||||
|
||||
for (i=0; i<10; i++) {
|
||||
fail_if(buf[i] != 0xaa);
|
||||
}
|
||||
|
||||
eo_del(in);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(ecore_test_ecore_audio_obj)
|
||||
{
|
||||
int i;
|
||||
const char *name;
|
||||
Eina_Bool paused;
|
||||
double volume;
|
||||
Eo *objs[2], *obj;
|
||||
|
||||
objs[0] = eo_add(ECORE_AUDIO_OBJ_IN_CLASS, NULL);
|
||||
fail_if(!objs[0]);
|
||||
|
||||
objs[1] = eo_add(ECORE_AUDIO_OBJ_OUT_CLASS, NULL);
|
||||
fail_if(!objs[1]);
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
obj = objs[i];
|
||||
|
||||
fail_if(!obj);
|
||||
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_name_get(&name)));
|
||||
|
||||
fail_if(name);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_name_set("In1")));
|
||||
fail_if(!eo_do(in, ecore_audio_obj_name_get(&name)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_name_set("In1")));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_name_get(&name)));
|
||||
|
||||
ck_assert_str_eq(name, "In1");
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_name_get(NULL)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_name_get(NULL)));
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_paused_get(&paused)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_paused_get(&paused)));
|
||||
fail_if(paused);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_paused_set(EINA_TRUE)));
|
||||
fail_if(!eo_do(in, ecore_audio_obj_paused_get(&paused)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_paused_set(EINA_TRUE)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_paused_get(&paused)));
|
||||
fail_if(!paused);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_volume_get(&volume)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_volume_get(&volume)));
|
||||
fail_if(volume != 1.0);
|
||||
|
||||
fail_if(!eo_do(in, ecore_audio_obj_volume_set(0.5)));
|
||||
fail_if(!eo_do(in, ecore_audio_obj_volume_get(&volume)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_volume_set(0.5)));
|
||||
fail_if(!eo_do(obj, ecore_audio_obj_volume_get(&volume)));
|
||||
fail_if(volume != 0.5);
|
||||
|
||||
eo_del(in);
|
||||
eo_del(obj);
|
||||
}
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -524,6 +632,7 @@ ecore_test_ecore_audio(TCase *tc)
|
|||
tcase_add_test(tc, ecore_test_ecore_audio_init);
|
||||
|
||||
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_in_out);
|
||||
tcase_add_test(tc, ecore_test_ecore_audio_obj_sndfile);
|
||||
tcase_add_test(tc, ecore_test_ecore_audio_obj_tone);
|
||||
|
|
Loading…
Reference in New Issue