#include "tct_common.h"
extern void utc_sound_pool_startup(void);
+extern void utc_sound_pool_stream_play_p4_startup(void);
extern void utc_sound_pool_cleanup(void);
extern int utc_sound_pool_create_p(void);
extern int utc_sound_pool_stream_play_p(void);
extern int utc_sound_pool_stream_play_p2(void);
extern int utc_sound_pool_stream_play_p3(void);
+extern int utc_sound_pool_stream_play_p4(void);
extern int utc_sound_pool_stream_play_n(void);
extern int utc_sound_pool_stream_pause_p(void);
extern int utc_sound_pool_stream_pause_p2(void);
extern int utc_sound_pool_unset_state_changed_cb_p(void);
extern int utc_sound_pool_unset_state_changed_cb_n(void);
testcase tc_array[] = {
- {"utc_sound_pool_create_p", utc_sound_pool_create_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_create_n", utc_sound_pool_create_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_create_n2", utc_sound_pool_create_n2, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_destroy_p", utc_sound_pool_destroy_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_destroy_n", utc_sound_pool_destroy_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_create_p", utc_sound_pool_create_p, NULL, NULL},
+ {"utc_sound_pool_create_n", utc_sound_pool_create_n, NULL, NULL},
+ {"utc_sound_pool_create_n2", utc_sound_pool_create_n2, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_destroy_p", utc_sound_pool_destroy_p, NULL, NULL},
+ {"utc_sound_pool_destroy_n", utc_sound_pool_destroy_n, NULL, utc_sound_pool_cleanup},
{"utc_sound_pool_load_source_from_file_p", utc_sound_pool_load_source_from_file_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_load_source_from_file_n", utc_sound_pool_load_source_from_file_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_unload_source_p", utc_sound_pool_unload_source_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_p", utc_sound_pool_stream_play_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_p2", utc_sound_pool_stream_play_p2, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_p3", utc_sound_pool_stream_play_p3, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_stream_play_p4", utc_sound_pool_stream_play_p, utc_sound_pool_stream_play_p4_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_n", utc_sound_pool_stream_play_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_pause_p", utc_sound_pool_stream_pause_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_pause_p2", utc_sound_pool_stream_pause_p2, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_stop_p", utc_sound_pool_stream_stop_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_stop_n", utc_sound_pool_stream_stop_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_stop_n2", utc_sound_pool_stream_stop_n2, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_state_p", utc_sound_pool_get_state_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_state_n", utc_sound_pool_get_state_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_activate_p", utc_sound_pool_activate_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_activate_n", utc_sound_pool_activate_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_deactivate_p", utc_sound_pool_deactivate_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_deactivate_n", utc_sound_pool_deactivate_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_volume_p", utc_sound_pool_set_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_volume_n", utc_sound_pool_set_volume_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_volume_p", utc_sound_pool_get_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_volume_n", utc_sound_pool_get_volume_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_state_p", utc_sound_pool_get_state_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_state_n", utc_sound_pool_get_state_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_activate_p", utc_sound_pool_activate_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_activate_n", utc_sound_pool_activate_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_deactivate_p", utc_sound_pool_deactivate_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_deactivate_n", utc_sound_pool_deactivate_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_volume_p", utc_sound_pool_set_volume_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_volume_n", utc_sound_pool_set_volume_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_volume_p", utc_sound_pool_get_volume_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_volume_n", utc_sound_pool_get_volume_n, NULL, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_set_volume_p", utc_sound_pool_set_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_set_volume_n", utc_sound_pool_set_volume_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_volume_p", utc_sound_pool_get_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_priority_n", utc_sound_pool_stream_get_priority_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_state_p", utc_sound_pool_stream_get_state_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_state_n", utc_sound_pool_stream_get_state_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_state_changed_cb_p", utc_sound_pool_set_state_changed_cb_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_state_changed_cb_n", utc_sound_pool_set_state_changed_cb_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_unset_state_changed_cb_p", utc_sound_pool_unset_state_changed_cb_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_unset_state_changed_cb_n", utc_sound_pool_unset_state_changed_cb_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_state_changed_cb_p", utc_sound_pool_set_state_changed_cb_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_state_changed_cb_n", utc_sound_pool_set_state_changed_cb_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_unset_state_changed_cb_p", utc_sound_pool_unset_state_changed_cb_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_unset_state_changed_cb_n", utc_sound_pool_unset_state_changed_cb_n, NULL, utc_sound_pool_cleanup},
{NULL, NULL}
};
#endif // __TCT_SOUND_POOL_NATIVE_H__
#include "tct_common.h"
extern void utc_sound_pool_startup(void);
+extern void utc_sound_pool_stream_play_p4_startup(void);
extern void utc_sound_pool_cleanup(void);
extern int utc_sound_pool_create_p(void);
extern int utc_sound_pool_stream_play_p(void);
extern int utc_sound_pool_stream_play_p2(void);
extern int utc_sound_pool_stream_play_p3(void);
+extern int utc_sound_pool_stream_play_p4(void);
extern int utc_sound_pool_stream_play_n(void);
extern int utc_sound_pool_stream_pause_p(void);
extern int utc_sound_pool_stream_pause_p2(void);
extern int utc_sound_pool_unset_state_changed_cb_p(void);
extern int utc_sound_pool_unset_state_changed_cb_n(void);
testcase tc_array[] = {
- {"utc_sound_pool_create_p", utc_sound_pool_create_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_create_n", utc_sound_pool_create_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_create_n2", utc_sound_pool_create_n2, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_destroy_p", utc_sound_pool_destroy_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_destroy_n", utc_sound_pool_destroy_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_create_p", utc_sound_pool_create_p, NULL, NULL},
+ {"utc_sound_pool_create_n", utc_sound_pool_create_n, NULL, NULL},
+ {"utc_sound_pool_create_n2", utc_sound_pool_create_n2, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_destroy_p", utc_sound_pool_destroy_p, NULL, NULL},
+ {"utc_sound_pool_destroy_n", utc_sound_pool_destroy_n, NULL, utc_sound_pool_cleanup},
{"utc_sound_pool_load_source_from_file_p", utc_sound_pool_load_source_from_file_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_load_source_from_file_n", utc_sound_pool_load_source_from_file_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_unload_source_p", utc_sound_pool_unload_source_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_p", utc_sound_pool_stream_play_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_p2", utc_sound_pool_stream_play_p2, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_p3", utc_sound_pool_stream_play_p3, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_stream_play_p4", utc_sound_pool_stream_play_p, utc_sound_pool_stream_play_p4_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_play_n", utc_sound_pool_stream_play_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_pause_p", utc_sound_pool_stream_pause_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_pause_p2", utc_sound_pool_stream_pause_p2, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_stop_p", utc_sound_pool_stream_stop_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_stop_n", utc_sound_pool_stream_stop_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_stop_n2", utc_sound_pool_stream_stop_n2, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_state_p", utc_sound_pool_get_state_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_state_n", utc_sound_pool_get_state_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_activate_p", utc_sound_pool_activate_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_activate_n", utc_sound_pool_activate_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_deactivate_p", utc_sound_pool_deactivate_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_deactivate_n", utc_sound_pool_deactivate_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_volume_p", utc_sound_pool_set_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_volume_n", utc_sound_pool_set_volume_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_volume_p", utc_sound_pool_get_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_get_volume_n", utc_sound_pool_get_volume_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_state_p", utc_sound_pool_get_state_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_state_n", utc_sound_pool_get_state_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_activate_p", utc_sound_pool_activate_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_activate_n", utc_sound_pool_activate_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_deactivate_p", utc_sound_pool_deactivate_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_deactivate_n", utc_sound_pool_deactivate_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_volume_p", utc_sound_pool_set_volume_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_volume_n", utc_sound_pool_set_volume_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_volume_p", utc_sound_pool_get_volume_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_get_volume_n", utc_sound_pool_get_volume_n, NULL, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_set_volume_p", utc_sound_pool_set_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_set_volume_n", utc_sound_pool_set_volume_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_volume_p", utc_sound_pool_get_volume_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_priority_n", utc_sound_pool_stream_get_priority_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_state_p", utc_sound_pool_stream_get_state_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
{"utc_sound_pool_stream_get_state_n", utc_sound_pool_stream_get_state_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_state_changed_cb_p", utc_sound_pool_set_state_changed_cb_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_set_state_changed_cb_n", utc_sound_pool_set_state_changed_cb_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_unset_state_changed_cb_p", utc_sound_pool_unset_state_changed_cb_p, utc_sound_pool_startup, utc_sound_pool_cleanup},
- {"utc_sound_pool_unset_state_changed_cb_n", utc_sound_pool_unset_state_changed_cb_n, utc_sound_pool_startup, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_state_changed_cb_p", utc_sound_pool_set_state_changed_cb_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_set_state_changed_cb_n", utc_sound_pool_set_state_changed_cb_n, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_unset_state_changed_cb_p", utc_sound_pool_unset_state_changed_cb_p, NULL, utc_sound_pool_cleanup},
+ {"utc_sound_pool_unset_state_changed_cb_n", utc_sound_pool_unset_state_changed_cb_n, NULL, utc_sound_pool_cleanup},
{NULL, NULL}
};
#endif // __TCT_SOUND_POOL_NATIVE_H__
#include <limits.h>
#include <media/sound_pool.h>
-//& set: SoundPool
#define API_NAMESPACE "[SOUND_POOL]"
#define MAX_PATH 1024
#define MAX_POOLS 8
#define DEFAULT_PRIORITY 255
#define DEFAULT_SAMPLE_TAG "sound_pool_test_file"
+#define DEFAULT_WRONG_SAMPLE_TAG "wrong_sample_tag"
+#define DEFAULT_WRONG_FILE_PATH "wrong_file_name"
sound_pool_h g_test_pool = NULL;
static char *file_path = NULL;
-static const char *test_file = "a.wav";
+static const char *testfile_name1 = "sound_1.wav";
+static const char *testfile_name2 = "sound_2.ogg";
+void utc_sound_pool_prepare_filepath(const char *testfile_name)
+{
+ char pzs_value[MAX_PATH] = {0,};
+ unsigned int size_of_path;
+
+ if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pzs_value, API_NAMESPACE )) {
+ PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pzs_value);
+ size_of_path = strlen(pzs_value) + strlen(testfile_name) + 10;
+ file_path = (char*)malloc(size_of_path);
+ snprintf(file_path, size_of_path, "%s/res/res/%s", pzs_value, testfile_name);
+ } else {
+ PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+ }
+}
/**
* @function utc_sound_pool_startup
* @description Called before each test.
*/
void utc_sound_pool_startup(void)
{
- char pszValue[MAX_PATH] = {0,};
- if (true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
- {
- PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_SUITE_TARGET_30' Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
- unsigned int size_of_path = strlen(pszValue) + strlen(test_file) + 10;
- file_path = (char*)malloc(size_of_path);
- snprintf(file_path, size_of_path, "%s/res/res/%s", pszValue, test_file);
- }
- else
- {
- PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
- }
+ utc_sound_pool_prepare_filepath(testfile_name1);
+}
- sound_pool_create(&g_test_pool);
- sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
- sound_pool_activate(g_test_pool);
+/**
+ * @function utc_sound_pool_stream_play_p4_startup
+ * @description Called before testcase utc_sound_pool_stream_play_p4.
+ * Added this new start up function to test the .ogg file format.
+ * @parameter NA
+ * @return NA
+ */
+void utc_sound_pool_stream_play_p4_startup(void)
+{
+ utc_sound_pool_prepare_filepath(testfile_name2);
}
/**
*/
void utc_sound_pool_cleanup(void)
{
+
if (g_test_pool) {
sound_pool_deactivate(g_test_pool);
sound_pool_unload_source(g_test_pool, DEFAULT_SAMPLE_TAG);
sound_pool_destroy(g_test_pool);
g_test_pool = NULL;
}
+
+ if (file_path != NULL) {
+ free(file_path);
+ file_path = NULL;
+ }
}
+/**
+ * @function sound_pool_stream_prepare_to_play
+ * @description sound pool creation, load the source and activate pool.
+ * @parameter NA
+ * @return NA
+ */
+int sound_pool_stream_prepare_to_play(void)
+{
+
+ int ret = SOUND_POOL_ERROR_NONE;
+
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ ret = sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ ret = sound_pool_activate(g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ return 0;
+}
+
+
+/**
+ * @function sound_pool_create_and_activate
+ * @description sound pool createion and activation.
+ * @parameter NA
+ * @return NA
+ */
+int sound_pool_create_and_activate(void)
+{
+
+ int ret = SOUND_POOL_ERROR_NONE;
+
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ ret = sound_pool_activate(g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ return 0;
+}
+
+
/**
* @brief Positive test case of sound_pool_create()
* @testcase utc_sound_pool_create_p
* @since_tizen 4.0
* @description Creates instances of sound pool up to its max number.
- * MAX_POOLS-1 value is used due to one instance is created by
- * utc_sound_pool_startup()
+ *
*/
int utc_sound_pool_create_p(void)
{
int ret = SOUND_POOL_ERROR_NONE;
- sound_pool_h test_pool [MAX_POOLS-1] = {NULL};
+ sound_pool_h test_pool [MAX_POOLS] = {NULL};
int i;
- for (i = 0; i < MAX_POOLS-1; ++i) {
+ for (i = 0; i < MAX_POOLS; ++i) {
ret = sound_pool_create(&test_pool[i]);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
assert_neq(test_pool[i], NULL);
}
// TC clean-up
- for (i = 0; i < MAX_POOLS-1; ++i) {
- sound_pool_destroy(test_pool[i]);
+ for (i = 0; i < MAX_POOLS; ++i) {
+ ret = sound_pool_destroy(test_pool[i]);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
test_pool[i] = NULL;
}
sound_pool_h test_pool [MAX_POOLS] = {NULL};
int i;
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
for (i = 0; i < MAX_POOLS-1; ++i) {
ret = sound_pool_create(&test_pool[i]);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
*/
int utc_sound_pool_destroy_p(void)
{
+ int ret = SOUND_POOL_ERROR_NONE;
+
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
assert_neq(g_test_pool, NULL);
- const int ret = sound_pool_destroy(g_test_pool);
+
+ ret = sound_pool_destroy(g_test_pool);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
g_test_pool = NULL;
*/
int utc_sound_pool_destroy_n(void)
{
- const int ret = sound_pool_destroy(NULL);
+ int ret = SOUND_POOL_ERROR_NONE;
+
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ ret = sound_pool_destroy(NULL);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
return 0;
*/
int utc_sound_pool_load_source_from_file_p(void)
{
- const int ret = sound_pool_load_source_from_file(g_test_pool, file_path, "test_source_tag");
+ int ret;
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ ret = sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
return 0;
int utc_sound_pool_load_source_from_file_n(void)
{
int ret = SOUND_POOL_ERROR_NONE;
+
+ sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+
ret = sound_pool_load_source_from_file(NULL, file_path, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
- ret = sound_pool_load_source_from_file(g_test_pool, "wrong_file_name", "test_source_tag");
+ ret = sound_pool_load_source_from_file(g_test_pool, DEFAULT_WRONG_FILE_PATH, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_NO_SUCH_FILE);
ret = sound_pool_load_source_from_file(g_test_pool, NULL, DEFAULT_SAMPLE_TAG);
ret = sound_pool_load_source_from_file(g_test_pool, file_path, NULL);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
+ ret = sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+
+ /* Load source with same sample tag again */
ret = sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
*/
int utc_sound_pool_unload_source_p(void)
{
- const int ret = sound_pool_unload_source(g_test_pool, DEFAULT_SAMPLE_TAG);
+ int ret;
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
+ ret = sound_pool_unload_source(g_test_pool, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
return 0;
int utc_sound_pool_unload_source_n(void)
{
int ret = SOUND_POOL_ERROR_NONE;
+ sound_pool_create(&g_test_pool);
+ sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
ret = sound_pool_unload_source(NULL, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
- ret = sound_pool_unload_source(g_test_pool, "wrong_source_tag");
+ ret = sound_pool_unload_source(g_test_pool, DEFAULT_WRONG_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_KEY_NOT_AVAILABLE);
return 0;
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
+
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
ret = sound_pool_stream_get_state(g_test_pool, id, &state);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
assert_eq(state, SOUND_POOL_STREAM_STATE_PLAYING);
+
return 0;
}
int ret = SOUND_POOL_ERROR_NONE;
unsigned int id = 100;
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
- sound_pool_h test_pool = NULL;
- ret = sound_pool_create(&test_pool);
+ ret = sound_pool_create(&g_test_pool);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
- ret = sound_pool_load_source_from_file(test_pool, file_path, DEFAULT_SAMPLE_TAG);
+ ret = sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
- ret = sound_pool_stream_play(test_pool, DEFAULT_SAMPLE_TAG,
+ ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED,
NULL, NULL, &id);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
assert_neq(id, 100);
- ret = sound_pool_stream_get_state(test_pool, id, &state);
+ ret = sound_pool_stream_get_state(g_test_pool, id, &state);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
assert_eq(state, SOUND_POOL_STREAM_STATE_SUSPENDED);
- sound_pool_destroy(test_pool);
- test_pool = NULL;
-
return 0;
}
unsigned int id1, id2, id3;
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, 1, SOUND_POOL_STREAM_PRIORITY_POLICY_MUTE,
NULL, NULL, &id1);
unsigned int id = 100;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(NULL, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
assert_eq(id, 100);
- ret = sound_pool_stream_play(g_test_pool, "wrong_tag",
+ ret = sound_pool_stream_play(g_test_pool, DEFAULT_WRONG_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
assert_eq(ret, SOUND_POOL_ERROR_KEY_NOT_AVAILABLE);
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
unsigned int id = 100;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
{
int ret = SOUND_POOL_ERROR_NONE;
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
-
unsigned int id = 100;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
unsigned int id = 100;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
unsigned int id = 100;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
{
int ret = SOUND_POOL_ERROR_NONE;
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
-
unsigned int id = 100;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
unsigned int id = 100;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
unsigned int id = 100;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
unsigned int id = 100;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
unsigned int id = 0;
sound_pool_stream_priority_policy_e priority_policy = SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
loop, volume, priority, priority_policy, callback,
data, &id);
*/
int utc_sound_pool_get_state_p(void)
{
- assert_neq(g_test_pool, NULL);
+ int ret = SOUND_POOL_ERROR_NONE;
sound_pool_state_e state = SOUND_POOL_STATE_INACTIVE;
- const int ret = sound_pool_get_state(g_test_pool, &state);
+ sound_pool_create_and_activate();
+ ret = sound_pool_get_state(g_test_pool, &state);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
assert_eq(state, SOUND_POOL_STATE_ACTIVE);
*/
int utc_sound_pool_get_state_n(void)
{
- assert_neq(g_test_pool, NULL);
int ret = SOUND_POOL_ERROR_NONE;
sound_pool_state_e state = SOUND_POOL_STATE_INACTIVE;
+ sound_pool_create_and_activate();
ret = sound_pool_get_state(NULL, &state);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
ret = sound_pool_activate(test_pool[i]);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
}
-// TC clean-up
+
+ // TC clean-up
for (i = 0; i < MAX_POOLS-1; ++i) {
sound_pool_destroy(test_pool[i]);
test_pool[i] = NULL;
}
-
return 0;
}
{
int ret = SOUND_POOL_ERROR_NONE;
+ sound_pool_create_and_activate();
ret = sound_pool_activate(NULL);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
*/
int utc_sound_pool_deactivate_p(void)
{
- assert_neq(g_test_pool, NULL);
int ret = SOUND_POOL_ERROR_NONE;
+ int i;
+ sound_pool_create_and_activate();
ret = sound_pool_deactivate(g_test_pool);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
sound_pool_h test_pool [MAX_POOLS-1] = {NULL};
- int i;
for (i = 0; i < MAX_POOLS-1; ++i) {
ret = sound_pool_create(&test_pool[i]);
ret = sound_pool_activate(test_pool[i]);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
}
-// TC clean-up
+ // TC clean-up
for (i = 0; i < MAX_POOLS-1; ++i) {
ret = sound_pool_deactivate(test_pool[i]);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
{
int ret = SOUND_POOL_ERROR_NONE;
+ sound_pool_create_and_activate();
ret = sound_pool_deactivate(NULL);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
*/
int utc_sound_pool_set_volume_p(void)
{
- const int ret = sound_pool_set_volume(g_test_pool, 0.5f);
+ int ret = SOUND_POOL_ERROR_NONE;
+
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ ret = sound_pool_set_volume(g_test_pool, 0.5f);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
return 0;
{
int ret = SOUND_POOL_ERROR_NONE;
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
ret = sound_pool_set_volume(NULL, 0.5f);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
int utc_sound_pool_get_volume_p(void)
{
float volume = 0.0;
+ int ret = SOUND_POOL_ERROR_NONE;
+
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
- const int ret = sound_pool_get_volume(g_test_pool, &volume);
+ sound_pool_get_volume(g_test_pool, &volume);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
return 0;
int ret = SOUND_POOL_ERROR_NONE;
float volume = 0.0;
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
ret = sound_pool_get_volume(NULL, &volume);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
int ret = SOUND_POOL_ERROR_NONE;
unsigned int id = 100;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
int ret = SOUND_POOL_ERROR_NONE;
unsigned int id = 100;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
unsigned int id = 100;
float volume = -1.0;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
{
int ret = SOUND_POOL_ERROR_NONE;
unsigned int id = 100;
+ float volume = 0.0;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
assert_neq(id, 100);
- float volume = 0.0;
ret = sound_pool_stream_get_volume(NULL, id, &volume);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
int ret = SOUND_POOL_ERROR_NONE;
unsigned int id = 100;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
int ret = SOUND_POOL_ERROR_NONE;
unsigned int id = 100;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
unsigned int id = 100;
unsigned int priority = 0;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
unsigned int id = 100;
unsigned int priority = 0;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
unsigned int id = 100;
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
- ret = sound_pool_deactivate(g_test_pool);
+ ret = sound_pool_create(&g_test_pool);
+ assert_eq(ret, SOUND_POOL_ERROR_NONE);
+ ret = sound_pool_load_source_from_file(g_test_pool, file_path, DEFAULT_SAMPLE_TAG);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
unsigned int id = 100;
sound_pool_stream_state_e state = SOUND_POOL_STREAM_STATE_NONE;
+ sound_pool_stream_prepare_to_play();
ret = sound_pool_stream_play(g_test_pool, DEFAULT_SAMPLE_TAG,
1, 0.5, DEFAULT_PRIORITY, SOUND_POOL_STREAM_PRIORITY_POLICY_SUSPENDED, NULL,
NULL, &id);
*/
int utc_sound_pool_set_state_changed_cb_p(void)
{
- assert_neq(g_test_pool, NULL);
-
int ret = SOUND_POOL_ERROR_NONE;
-
sound_pool_state_e data = SOUND_POOL_STATE_INACTIVE;
+
+ sound_pool_create_and_activate();
ret = sound_pool_set_state_changed_cb(g_test_pool, sp_cb, &data);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
*/
int utc_sound_pool_set_state_changed_cb_n(void)
{
- assert_neq(g_test_pool, NULL);
-
int ret = SOUND_POOL_ERROR_NONE;
sound_pool_state_e data = SOUND_POOL_STATE_INACTIVE;
+ sound_pool_create_and_activate();
+
ret = sound_pool_set_state_changed_cb(NULL, sp_cb, &data);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
*/
int utc_sound_pool_unset_state_changed_cb_p(void)
{
- assert_neq(g_test_pool, NULL);
-
sound_pool_state_e data = SOUND_POOL_STATE_INACTIVE;
int ret = SOUND_POOL_ERROR_NONE;
+
+ sound_pool_create_and_activate();
ret = sound_pool_set_state_changed_cb(g_test_pool, sp_cb, &data);
assert_eq(ret, SOUND_POOL_ERROR_NONE);
*/
int utc_sound_pool_unset_state_changed_cb_n(void)
{
- const int ret = sound_pool_unset_state_changed_cb(NULL);
+ int ret = SOUND_POOL_ERROR_NONE;
+
+ sound_pool_create_and_activate();
+ ret = sound_pool_unset_state_changed_cb(NULL);
assert_eq(ret, SOUND_POOL_ERROR_INVALID_PARAMETER);
return 0;