API int access(const char *pathname, int mode)
{
- if (0 == strcmp(pathname, "/opt/usr/data/settings/Ringtones/ringtone_sdk.mp3"))
+ if (0 == strcmp(pathname, SYS_SETTINGS_TEST_DIR"/ringtone_sdk.mp3"))
return 0;
- if (0 == strcmp(pathname, "/opt/usr/data/settings/Alerts/Over the horizon.mp3"))
+ if (0 == strcmp(pathname, SYS_SETTINGS_TEST_DIR"/Over the horizon.mp3"))
return 0;
- if (0 == strcmp(pathname, "/usr/bin/sys-settings/ringtone_sdk.mp3"))
+ if (0 == strcmp(pathname, SYS_SETTINGS_TEST_DIR"/big_buck_bunny.mp3"))
return 0;
- if (0 == strcmp(pathname, "/opt/usr/test/big_buck_bunny.mp4"))
+ if (0 == strcmp(pathname, SYS_SETTINGS_TEST_DIR"/daliTestVideo.mp3"))
return 0;
- if (0 == strcmp(pathname, "/opt/usr/test/daliTestVideo.mp4"))
+ if (0 == strcmp(pathname, SYS_SETTINGS_TEST_DIR"/sound_5.mp3"))
return 0;
- if (0 == strcmp(pathname, "/opt/usr/test/sound_5.wav"))
- return 0;
- if (0 == strcmp(pathname, "/opt/usr/test/tct-content-tizen-tests_video.mp4"))
+ if (0 == strcmp(pathname, SYS_SETTINGS_TEST_DIR"/tct-content-tizen-tests_video.mp3"))
return 0;
int (*org_fn)(const char *, int);
} while (0)
#endif
+static char *sst_ringtone_test_files[] = {
+ SYS_SETTINGS_TEST_DIR"/Over the horizon.mp3",
+ SYS_SETTINGS_TEST_DIR"/big_buck_bunny.mp3",
+ SYS_SETTINGS_TEST_DIR"/daliTestVideo.mp3",
+ SYS_SETTINGS_TEST_DIR"/sound_5.mp3",
+ SYS_SETTINGS_TEST_DIR"/tct-content-tizen-tests_video.mp3"
+};
system_settings_changed_cb get_system_settings_test_callback()
{
RETURN(0);
}
-static int cb_count;
static bool system_setting_get_ringtone_list_cb(int index, const char* data, void *user_data)
{
- cb_count += 1;
- //printf("%s\n", (char*)data);
+ int *ringtone_num = user_data;
+ *ringtone_num += 1;
return true;
}
RETTYPE utc_system_settings_add_ringtone_list_p1(void)
{
int retcode = -1;
- cb_count = 0;
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/big_buck_bunny.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/daliTestVideo.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/sound_5.wav");
- my_assert_ret(retcode);
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/tct-content-tizen-tests_video.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_foreach_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, system_setting_get_ringtone_list_cb, NULL);
- my_assert_ret(retcode);
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/tct-content-tizen-tests_video.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/sound_5.wav");
- my_assert_ret(retcode);
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/daliTestVideo.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/big_buck_bunny.mp4");
-
+ int files_cnt = sizeof(sst_ringtone_test_files)/sizeof(char*);
+ int ringtone_num = 0;
+ for (int i = 0; i < files_cnt; i++) {
+ retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, sst_ringtone_test_files[i]);
+ my_assert_ret(retcode);
+ }
+ retcode = system_settings_foreach_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, system_setting_get_ringtone_list_cb, &ringtone_num);
my_assert_ret(retcode);
- assert_eq(cb_count, 5);
-
+ for (int i = files_cnt - 1; i >= 0; i--) {
+ retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, sst_ringtone_test_files[i]);
+ my_assert_ret(retcode);
+ }
+ assert_eq(ringtone_num, files_cnt + 1);
RETURN(0);
}
-/**
- * @function utc_system_settings_delete_ringtone_list_p1_startup
- * @description Called before each test
- * @parameter NA
- * @return NA
- */
-
-/* system_settings - del ringtone list */
RETTYPE utc_system_settings_delete_ringtone_list_p1(void)
{
int retcode = -1;
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/big_buck_bunny.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/daliTestVideo.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/sound_5.wav");
- my_assert_ret(retcode);
- retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/tct-content-tizen-tests_video.mp4");
- my_assert_ret(retcode);
-
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/tct-content-tizen-tests_video.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/sound_5.wav");
- my_assert_ret(retcode);
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/daliTestVideo.mp4");
- my_assert_ret(retcode);
- retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, "/opt/usr/test/big_buck_bunny.mp4");
- my_assert_ret(retcode);
-
+ int files_cnt = sizeof(sst_ringtone_test_files)/sizeof(char*);
+ for (int i = 0; i < files_cnt; i++) {
+ retcode = system_settings_add_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, sst_ringtone_test_files[i]);
+ my_assert_ret(retcode);
+ }
+ for (int i = files_cnt - 1; i >= 0; i--) {
+ retcode = system_settings_delete_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, sst_ringtone_test_files[i]);
+ my_assert_ret(retcode);
+ }
RETURN(0);
}