diff options
author | Yunhee Seo <yuni.seo@samsung.com> | 2023-08-08 10:43:03 +0900 |
---|---|---|
committer | Yunhee Seo <yuni.seo@samsung.com> | 2023-08-08 15:22:27 +0900 |
commit | c4df1938229e90d794ea139c2369a717975ca7f1 (patch) | |
tree | fe6c6144c5a839fa92d3686c4361346061c9b89b | |
parent | 63298e548189446ee6e0d857d5d45cbd338ef4ad (diff) | |
download | libsvi-c4df1938229e90d794ea139c2369a717975ca7f1.tar.gz libsvi-c4df1938229e90d794ea139c2369a717975ca7f1.tar.bz2 libsvi-c4df1938229e90d794ea139c2369a717975ca7f1.zip |
tests: Add test of sound multi-theme internal APIaccepted/tizen/unified/20230810.070105
As support multi theme usage, new internal API test codes are added.
These are added to test-feedback-internal.h
- bool TEST_FEEDBACK_GET_COUNT_OF_SOUND_THEME_INTERNAL(void);
-> This function performs a test to get count of theme from the sound.conf.
- bool TEST_FEEDBACK_GET_SOUND_THEME_INDEX_INTERNAL(void);
-> This function performs a test to get index of sound theme selected.
- bool TEST_FEEDBACK_SET_SOUND_THEME_INDEX_INTERNAL(void);
-> This function performs a test to set index of sound theme, and then plays sound files from selected conf file.
It is possible to check sound file path from FEEDBACK_TEST dlog.
Change-Id: Ia2025141db8901676d5402f7ad0e836a9944fc3e
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
-rw-r--r-- | tests/main.c | 3 | ||||
-rw-r--r-- | tests/test-feedback-internal.c | 83 | ||||
-rw-r--r-- | tests/test-feedback-internal.h | 3 |
3 files changed, 89 insertions, 0 deletions
diff --git a/tests/main.c b/tests/main.c index b3313be..42ea7b6 100644 --- a/tests/main.c +++ b/tests/main.c @@ -27,6 +27,9 @@ void test_all() LOG_RESULT(TEST_FEEDBACK_PLAY_SOUNDPATH_INTERNAL(), "TEST_FEEDBACK_PLAY_SOUNDPATH_INTERNAL"); LOG_RESULT(TEST_FEEDBACK_PLAY_TYPE_INTERNAL(), "TEST_FEEDBACK_PLAY_TYPE_INTERNAL"); LOG_RESULT(TEST_FEEDBACK_PLAY_TYPE_SOUNDPATH_INTERNAL(), "TEST_FEEDBACK_PLAY_TYPE_SOUNDPATH_INTERNAL"); + LOG_RESULT(TEST_FEEDBACK_GET_COUNT_OF_SOUND_THEME_INTERNAL(), "TEST_FEEDBACK_GET_COUNT_OF_SOUND_THEME_INTERNAL"); + LOG_RESULT(TEST_FEEDBACK_GET_SOUND_THEME_INDEX_INTERNAL(), "TEST_FEEDBACK_GET_SOUND_THEME_INDEX_INTERNAL"); + LOG_RESULT(TEST_FEEDBACK_SET_SOUND_THEME_INDEX_INTERNAL(), "TEST_FEEDBACK_SET_SOUND_THEME_INDEX_INTERNAL"); } void show_usage() diff --git a/tests/test-feedback-internal.c b/tests/test-feedback-internal.c index 841a5ca..8968c14 100644 --- a/tests/test-feedback-internal.c +++ b/tests/test-feedback-internal.c @@ -340,6 +340,89 @@ static void init_supported_pattern_i(feedback_type_e type, int *pattern_i) feedback_deinitialize(); } +static void test_get_count_of_sound_theme_internal(void) +{ + unsigned int count_of_theme = 0; + + RESULT(feedback_get_count_of_theme_internal(FEEDBACK_TYPE_SOUND, &count_of_theme), + FEEDBACK_ERROR_NOT_INITIALIZED, "not initialized"); + + feedback_initialize(); + RESULT(feedback_get_count_of_theme_internal(FEEDBACK_TYPE_SOUND, NULL), + FEEDBACK_ERROR_INVALID_PARAMETER, "invalid parameter"); + RESULT(feedback_get_count_of_theme_internal(FEEDBACK_TYPE_VIBRATION, &count_of_theme), + FEEDBACK_ERROR_NOT_SUPPORTED, "not supported"); + RESULT(feedback_get_count_of_theme_internal(FEEDBACK_TYPE_SOUND, &count_of_theme), + FEEDBACK_ERROR_NONE, "error none"); + _D("Feedback type=%d count of theme=%d is get", FEEDBACK_TYPE_SOUND, count_of_theme); + feedback_deinitialize(); +} + +bool TEST_FEEDBACK_GET_COUNT_OF_SOUND_THEME_INTERNAL(void) +{ + INIT(); + test_get_count_of_sound_theme_internal(); + REPORT_AND_RETURN(); +} + +static void test_get_sound_theme_index_internal(void) +{ + unsigned int index_of_theme = 0; + + feedback_initialize(); + RESULT(feedback_get_theme_index_internal(FEEDBACK_TYPE_SOUND, NULL), + FEEDBACK_ERROR_INVALID_PARAMETER, "invalid parameter"); + RESULT(feedback_get_theme_index_internal(FEEDBACK_TYPE_VIBRATION, &index_of_theme), + FEEDBACK_ERROR_NOT_SUPPORTED, "not supported"); + RESULT(feedback_get_theme_index_internal(FEEDBACK_TYPE_SOUND, &index_of_theme), + FEEDBACK_ERROR_NONE, "error none"); + _D("Feedback type=%d sound theme index=%d is get", FEEDBACK_TYPE_SOUND, index_of_theme); + feedback_deinitialize(); +} + +bool TEST_FEEDBACK_GET_SOUND_THEME_INDEX_INTERNAL(void) +{ + INIT(); + test_get_sound_theme_index_internal(); + REPORT_AND_RETURN(); +} + +static void test_set_sound_theme_index_internal(void) +{ + unsigned int count_of_theme = 0; + unsigned int index = 0; + + feedback_initialize(); + feedback_get_count_of_theme_internal(FEEDBACK_TYPE_SOUND, &count_of_theme); + + RESULT(feedback_set_theme_index_internal(FEEDBACK_TYPE_SOUND, count_of_theme + 1), + FEEDBACK_ERROR_OPERATION_FAILED, "operation failed"); + + RESULT(feedback_set_theme_index_internal(FEEDBACK_TYPE_VIBRATION, index), + FEEDBACK_ERROR_NOT_SUPPORTED, "not supported"); + if (count_of_theme > index) { + for (int index = 1; index <= count_of_theme; index++) { + RESULT(feedback_set_theme_index_internal(FEEDBACK_TYPE_SOUND, index), + FEEDBACK_ERROR_NONE, "error none"); + test_play_type_by_name_p(); + _D("Feedback type=%d sound theme index=%d is set", FEEDBACK_TYPE_SOUND, index); + } + } else if (count_of_theme == 0) { + RESULT(feedback_set_theme_index_internal(FEEDBACK_TYPE_SOUND, index), + FEEDBACK_ERROR_NONE, "error none"); + test_play_type_by_name_p(); + _D("Feedback type=%d sound theme index=%d is set", FEEDBACK_TYPE_SOUND, index); + } + feedback_deinitialize(); +} + +bool TEST_FEEDBACK_SET_SOUND_THEME_INDEX_INTERNAL(void) +{ + INIT(); + test_set_sound_theme_index_internal(); + REPORT_AND_RETURN(); +} + void TEST_INTERNAL_INIT() { init_supported_pattern(FEEDBACK_TYPE_SOUND, pattern_s); diff --git a/tests/test-feedback-internal.h b/tests/test-feedback-internal.h index 1a47124..1946c9a 100644 --- a/tests/test-feedback-internal.h +++ b/tests/test-feedback-internal.h @@ -120,6 +120,9 @@ bool TEST_FEEDBACK_PLAY_INTERNAL(void); bool TEST_FEEDBACK_PLAY_SOUNDPATH_INTERNAL(void); bool TEST_FEEDBACK_PLAY_TYPE_INTERNAL(void); bool TEST_FEEDBACK_PLAY_TYPE_SOUNDPATH_INTERNAL(void); +bool TEST_FEEDBACK_GET_COUNT_OF_SOUND_THEME_INTERNAL(void); +bool TEST_FEEDBACK_GET_SOUND_THEME_INDEX_INTERNAL(void); +bool TEST_FEEDBACK_SET_SOUND_THEME_INDEX_INTERNAL(void); void TEST_INTERNAL_INIT(void); |