From: JinWang An Date: Thu, 3 Sep 2020 12:31:53 +0000 (+0900) Subject: [ITC][base-utils][Non-ACR][Fix resource path for ures test] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42ae5eb2dbd32fc70f532066196c31412edf582c;p=test%2Ftct%2Fnative%2Fapi.git [ITC][base-utils][Non-ACR][Fix resource path for ures test] Change-Id: Id1f598e495fd419969dea8d76315f79f0251b1dd Signed-off-by: JinWang An --- diff --git a/src/itc/base-utils/ITs-base-utils-ures.c b/src/itc/base-utils/ITs-base-utils-ures.c index 5813a3062..b34076ed1 100755 --- a/src/itc/base-utils/ITs-base-utils-ures.c +++ b/src/itc/base-utils/ITs-base-utils-ures.c @@ -17,41 +17,60 @@ #include "ITs-base-utils-common.h" /** @addtogroup itc-base-utils -* @ingroup itc -* @{ -*/ + * @ingroup itc + * @{ + */ /** -* @function ITs_base_utils_ures_startup -* @description Called before each test -* @parameter NA -* @return NA -*/ + * @function ITs_base_utils_ures_startup + * @description Called before each test + * @parameter NA + * @return NA + */ void ITs_base_utils_ures_startup(void) { - struct stat stBuff; - if ( stat(ERR_LOG, &stBuff) == 0 ) - { - remove(ERR_LOG); - } + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } #if DEBUG - FPRINTF("\\n[Line : %d][%s] TEST SUIT start-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE); + FPRINTF("\\n[Line : %d][%s] TEST SUIT start-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE); #endif - return; + return; } /** -* @function ITs_base_utils_ures_cleanup -* @description Called after each test -* @parameter NA -* @return NA -*/ + * @function ITs_base_utils_ures_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ void ITs_base_utils_ures_cleanup(void) { #if DEBUG - FPRINTF("\\n[Line : %d][%s] TEST SUIT clean-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE); + FPRINTF("\\n[Line : %d][%s] TEST SUIT clean-up: ITs_Base_Utils_p\\n", __LINE__, API_NAMESPACE); #endif - return; + return; +} + +static void itc_base_utils_get_resource_path(char *path, int size) +{ + char apps_root[CONFIG_VALUE_LEN_MAX] = {0,}; + bool ret; + + if (NULL == path) + return; + + ret = GetValueForTCTSetting("DEVICE_ADMIN_USER_APPS_ROOT_30", apps_root, API_NAMESPACE); + if (false == ret) + { + FPRINTF("ERR]GetValueForTCTString(DEVICE_ADMIN_USER_APPS_ROOT_30) false"); + return; + } + snprintf(path, size, "%s/org.tizen.base-utils-native-itc/res/", apps_root); + FPRINTF("resource path]: %s", path); } + /* * @testcase ITc_i18n_ures_create_destroy_p * @since_tizen 6.0 @@ -68,24 +87,24 @@ void ITs_base_utils_ures_cleanup(void) */ int ITc_i18n_ures_create_destroy_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "en"; - const char *pszPackageName = NULL; - i18n_ures_h hUres = NULL; + int nRet = -1; + const char *pszLocale = "en"; + const char *pszPackageName = NULL; + i18n_ures_h hUres = NULL; - //Target API - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + //Target API + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - hUres = NULL; + //Target API + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + hUres = NULL; - return 0; + return 0; } /* * @testcase ITc_i18n_ures_create_direct_p @@ -103,22 +122,22 @@ int ITc_i18n_ures_create_destroy_p(void) */ int ITc_i18n_ures_create_direct_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "en"; - const char *pszPackageName = NULL; - i18n_ures_h hUres = NULL; + int nRet = -1; + const char *pszLocale = "en"; + const char *pszPackageName = NULL; + i18n_ures_h hUres = NULL; - //Target API - nRet = i18n_ures_create_direct(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create_direct", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create_direct"); + //Target API + nRet = i18n_ures_create_direct(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create_direct", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create_direct"); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_create_unicode_p @@ -136,22 +155,22 @@ int ITc_i18n_ures_create_direct_p(void) */ int ITc_i18n_ures_create_unicode_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "en"; - const char *pszPackageName = NULL; - i18n_ures_h hUres = NULL; + int nRet = -1; + const char *pszLocale = "en"; + const char *pszPackageName = NULL; + i18n_ures_h hUres = NULL; - //Target API - nRet = i18n_ures_create_unicode(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create_unicode", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create_unicode"); + //Target API + nRet = i18n_ures_create_unicode(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create_unicode", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create_unicode"); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_version_p @@ -169,26 +188,26 @@ int ITc_i18n_ures_create_unicode_p(void) */ int ITc_i18n_ures_get_version_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "en"; - const char *pszPackageName = NULL; - i18n_ures_h hUres = NULL; - i18n_uversion_info version_array; + int nRet = -1; + const char *pszLocale = "en"; + const char *pszPackageName = NULL; + i18n_ures_h hUres = NULL; + i18n_uversion_info version_array; - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API + //Target API nRet = i18n_ures_get_version(hUres, version_array); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_version", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_locale_by_type_p @@ -206,27 +225,27 @@ int ITc_i18n_ures_get_version_p(void) */ int ITc_i18n_ures_get_locale_by_type_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "en"; - const char *pszPackageName = NULL; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; + int nRet = -1; + const char *pszLocale = "en"; + const char *pszPackageName = NULL; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API - nRet = i18n_ures_get_locale_by_type(hUres, I18N_ULOCALE_DATA_LOCALE_TYPE_ACTUAL_LOCALE, &pszLocaleType); - PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_locale_by_type", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(pszLocaleType, "i18n_ures_get_locale_by_type", i18n_ures_destroy(hUres)); + //Target API + nRet = i18n_ures_get_locale_by_type(hUres, I18N_ULOCALE_DATA_LOCALE_TYPE_ACTUAL_LOCALE, &pszLocaleType); + PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_locale_by_type", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(pszLocaleType, "i18n_ures_get_locale_by_type", i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_string_p @@ -244,68 +263,69 @@ int ITc_i18n_ures_get_locale_by_type_p(void) */ int ITc_i18n_ures_get_string_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hItem = NULL; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hItem = NULL; int32_t len = -1; int count = -1; const i18n_uchar *pszStrResult = NULL; i18n_ures_type_e type_result; - int i = 0; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - nRet = i18n_ures_get_size(hUres, &count); + nRet = i18n_ures_get_size(hUres, &count); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_size", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(count < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } - - for(i = 0; i < count; ++i) - { + if(count < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } + + for(i = 0; i < count; ++i) + { nRet = i18n_ures_get_by_index(hUres, i, hItem, &hItem); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_index", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); nRet = i18n_ures_get_type(hItem, &type_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_type", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); switch(type_result) - { - case I18N_URES_STRING: + { + case I18N_URES_STRING: { - //Target API + //Target API nRet = i18n_ures_get_string(hItem, &len, &pszStrResult); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_string", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); - if(len < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_string failed ,len is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hItem); - i18n_ures_destroy(hUres); - return 1; - } + if(len < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_string failed ,len is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hItem); + i18n_ures_destroy(hUres); + return 1; + } break; } } - } - nRet = i18n_ures_destroy(hItem); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + } + nRet = i18n_ures_destroy(hItem); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_UTF8_string_p @@ -323,68 +343,69 @@ int ITc_i18n_ures_get_string_p(void) */ int ITc_i18n_ures_get_UTF8_string_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hItem = NULL; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hItem = NULL; int32_t len = -1; int count = -1; i18n_ures_type_e type_result; - int i = 0; - const char *pszResult = NULL; + int i = 0; + const char *pszResult = NULL; char *pszBuff = NULL; char szBuffer[16]; pszBuff = szBuffer; int32_t result_len = (int32_t)sizeof(szBuffer); + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - nRet = i18n_ures_get_size(hUres, &count); + nRet = i18n_ures_get_size(hUres, &count); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_size", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(count < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } - - if(count > 10) - { - count = 10; - } - for(i = 0; i < count; ++i) - { + if(count < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } + + if(count > 10) + { + count = 10; + } + for(i = 0; i < count; ++i) + { nRet = i18n_ures_get_by_index(hUres, i, hItem, &hItem); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_index", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); nRet = i18n_ures_get_type(hItem, &type_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_type", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); switch(type_result) - { - case I18N_URES_STRING: + { + case I18N_URES_STRING: { - //Target API + //Target API nRet = i18n_ures_get_UTF8_string(hItem, pszBuff, &result_len, true, &pszResult); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_string", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); break; } } - } - nRet = i18n_ures_destroy(hItem); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + } + nRet = i18n_ures_destroy(hItem); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_binary_p @@ -402,51 +423,52 @@ int ITc_i18n_ures_get_UTF8_string_p(void) */ int ITc_i18n_ures_get_binary_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hUresKey = NULL; - int32_t len; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hUresKey = NULL; + int32_t len; const uint8_t *binary_result; - int i = 0; - int nCount = 15; + int i = 0; + int nCount = 15; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); nRet = i18n_ures_get_by_key(hUres, "binarytest", hUresKey, &hUresKey); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); - //Target API + //Target API nRet = i18n_ures_get_binary(hUresKey, &len, &binary_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_binary", BaseUtilsGetError(nRet), i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); - if(len < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_binary failed ,len is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUresKey); - i18n_ures_destroy(hUres); - return 1; - } + if(len < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_binary failed ,len is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUresKey); + i18n_ures_destroy(hUres); + return 1; + } for(i = 0; i < nCount; ++i) - { + { PRINT_RESULT_CLEANUP(binary_result[i], i, "i18n_ures_get_binary", "obtained and expected result are not same", i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); } - nRet = i18n_ures_destroy(hUresKey); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUresKey); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_int_vector_p @@ -464,38 +486,39 @@ int ITc_i18n_ures_get_binary_p(void) */ int ITc_i18n_ures_get_int_vector_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hUresKey = NULL; - int32_t len = -1; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hUresKey = NULL; + int32_t len = -1; const int32_t *int_vector_result; - int i = 0; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); nRet = i18n_ures_get_by_key(hUres, "emptyintv", hUresKey, &hUresKey); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); - //Target API + //Target API nRet = i18n_ures_get_int_vector(hUresKey, &len, &int_vector_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_int_vector", BaseUtilsGetError(nRet), i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); - PRINT_RESULT_CLEANUP(len, 0, "i18n_ures_get_int_vector", "obtained and expected length are not same", i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); + PRINT_RESULT_CLEANUP(len, 0, "i18n_ures_get_int_vector", "obtained and expected length are not same", i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUresKey); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUresKey); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_uint_p @@ -513,39 +536,40 @@ int ITc_i18n_ures_get_int_vector_p(void) */ int ITc_i18n_ures_get_uint_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hUresKey = NULL; - int32_t len = -1; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hUresKey = NULL; + int32_t len = -1; const int32_t *int_vector_result; - uint32_t uint_result; - int i = 0; + uint32_t uint_result; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); nRet = i18n_ures_get_by_key(hUres, "one", hUresKey, &hUresKey); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); - //Target API + //Target API nRet = i18n_ures_get_uint(hUresKey, &uint_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_uint", BaseUtilsGetError(nRet), i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); - PRINT_RESULT_CLEANUP(uint_result, 1, "i18n_ures_get_uint", "obtained and expected length are not same", i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); + PRINT_RESULT_CLEANUP(uint_result, 1, "i18n_ures_get_uint", "obtained and expected length are not same", i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUresKey); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUresKey); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_int_p @@ -563,60 +587,61 @@ int ITc_i18n_ures_get_uint_p(void) */ int ITc_i18n_ures_get_int_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hItem = NULL; - int32_t int_result; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hItem = NULL; + int32_t int_result; int count; i18n_ures_type_e type_result; - int i = 0; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - nRet = i18n_ures_get_size(hUres, &count); + nRet = i18n_ures_get_size(hUres, &count); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_size", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(count < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } - - for(i = 0; i < count; ++i) - { + if(count < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } + + for(i = 0; i < count; ++i) + { nRet = i18n_ures_get_by_index(hUres, i, hItem, &hItem); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_index", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); nRet = i18n_ures_get_type(hItem, &type_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_type", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); switch(type_result) - { - case I18N_URES_INT: + { + case I18N_URES_INT: { - //Target API + //Target API nRet = i18n_ures_get_int(hItem, &int_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_int", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); - break; + break; } } - } - nRet = i18n_ures_destroy(hItem); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + } + nRet = i18n_ures_destroy(hItem); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_size_p @@ -634,33 +659,34 @@ int ITc_i18n_ures_get_int_p(void) */ int ITc_i18n_ures_get_size_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - i18n_ures_h hUres = NULL; + int nRet = -1; + const char *pszLocale = "testtypes"; + i18n_ures_h hUres = NULL; int count = -1; - int i = 0; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API - nRet = i18n_ures_get_size(hUres, &count); + //Target API + nRet = i18n_ures_get_size(hUres, &count); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_size", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(count < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } + if(count < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_type_p @@ -678,48 +704,49 @@ int ITc_i18n_ures_get_size_p(void) */ int ITc_i18n_ures_get_type_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hItem = NULL; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hItem = NULL; int count; i18n_ures_type_e type_result; - int i = 0; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - nRet = i18n_ures_get_size(hUres, &count); + nRet = i18n_ures_get_size(hUres, &count); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_size", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(count < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } - - for(i = 0; i < count; ++i) - { + if(count < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } + + for(i = 0; i < count; ++i) + { nRet = i18n_ures_get_by_index(hUres, i, hItem, &hItem); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_index", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); - //Target API + //Target API nRet = i18n_ures_get_type(hItem, &type_result); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_type", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); - } - nRet = i18n_ures_destroy(hItem); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + } + nRet = i18n_ures_destroy(hItem); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_key_p @@ -737,49 +764,50 @@ int ITc_i18n_ures_get_type_p(void) */ int ITc_i18n_ures_get_key_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hItem = NULL; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hItem = NULL; int count; i18n_ures_type_e type_result; - const char *pszKey = NULL; - int i = 0; + const char *pszKey = NULL; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - nRet = i18n_ures_get_size(hUres, &count); + nRet = i18n_ures_get_size(hUres, &count); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_size", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(count < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } - - for(i = 0; i < count; ++i) - { + if(count < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } + + for(i = 0; i < count; ++i) + { nRet = i18n_ures_get_by_index(hUres, i, hItem, &hItem); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_index", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); - //Target API + //Target API nRet = i18n_ures_get_key(hItem, &pszKey); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_type", BaseUtilsGetError(nRet), i18n_ures_destroy(hItem); i18n_ures_destroy(hUres)); - } - nRet = i18n_ures_destroy(hItem); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + } + nRet = i18n_ures_destroy(hItem); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_reset_iterator_p @@ -797,26 +825,27 @@ int ITc_i18n_ures_get_key_p(void) */ int ITc_i18n_ures_reset_iterator_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API - nRet = i18n_ures_reset_iterator(hUres); - PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_reset_iterator", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); + //Target API + nRet = i18n_ures_reset_iterator(hUres); + PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_reset_iterator", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* @@ -835,28 +864,29 @@ int ITc_i18n_ures_reset_iterator_p(void) */ int ITc_i18n_ures_has_next_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - bool bHasNext = false; + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + bool bHasNext = false; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API - nRet = i18n_ures_has_next(hUres, &bHasNext); - PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_has_next", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - PRINT_RESULT_CLEANUP(true, bHasNext, "i18n_ures_has_next", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); + //Target API + nRet = i18n_ures_has_next(hUres, &bHasNext); + PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_has_next", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); + PRINT_RESULT_CLEANUP(true, bHasNext, "i18n_ures_has_next", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_next_resource_p @@ -874,31 +904,32 @@ int ITc_i18n_ures_has_next_p(void) */ int ITc_i18n_ures_get_next_resource_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - i18n_ures_h hUres = NULL; - i18n_ures_h hUresNextResource = NULL; - bool bHasNext = false; + int nRet = -1; + const char *pszLocale = "testtypes"; + i18n_ures_h hUres = NULL; + i18n_ures_h hUresNextResource = NULL; + bool bHasNext = false; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API - nRet = i18n_ures_get_next_resource(hUres, hUresNextResource, &hUresNextResource); - PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_next_resource", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hUresNextResource, "i18n_ures_get_next_resource", i18n_ures_destroy(hUres)); + //Target API + nRet = i18n_ures_get_next_resource(hUres, hUresNextResource, &hUresNextResource); + PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_next_resource", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hUresNextResource, "i18n_ures_get_next_resource", i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUresNextResource); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUresNextResource); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_next_string_p @@ -916,35 +947,36 @@ int ITc_i18n_ures_get_next_resource_p(void) */ int ITc_i18n_ures_get_next_string_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - i18n_ures_h hUres = NULL; - const i18n_uchar *pszResult = NULL; + int nRet = -1; + const char *pszLocale = "testtypes"; + i18n_ures_h hUres = NULL; + const i18n_uchar *pszResult = NULL; int32_t result_len = 0; const char *pszKey = NULL; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); + + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); + + //Target API + nRet = i18n_ures_get_next_string(hUres, &result_len, &pszKey, &pszResult); + PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_next_string", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); + + if(result_len < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_next_string failed ,result_len is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); - - //Target API - nRet = i18n_ures_get_next_string(hUres, &result_len, &pszKey, &pszResult); - PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_next_string", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - - if(result_len < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_next_string failed ,result_len is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } - - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_by_index_p @@ -962,44 +994,45 @@ int ITc_i18n_ures_get_next_string_p(void) */ int ITc_i18n_ures_get_by_index_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "testtypes"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hItem = NULL; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "testtypes"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hItem = NULL; int count = -1; - int i = 0; + int i = 0; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - nRet = i18n_ures_get_size(hUres, &count); + nRet = i18n_ures_get_size(hUres, &count); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_size", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(count < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } - - for(i = 0; i < count; ++i) - { - //Target API + if(count < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_size failed ,count is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } + + for(i = 0; i < count; ++i) + { + //Target API nRet = i18n_ures_get_by_index(hUres, i, hItem, &hItem); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_index", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); - } - nRet = i18n_ures_destroy(hItem); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + CHECK_HANDLE_CLEANUP(hItem, "i18n_ures_get_by_index", i18n_ures_destroy(hUres)); + } + nRet = i18n_ures_destroy(hItem); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_string_by_index_p @@ -1017,43 +1050,44 @@ int ITc_i18n_ures_get_by_index_p(void) */ int ITc_i18n_ures_get_string_by_index_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "te"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hUresKey = NULL; - int32_t len = -1; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "te"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hUresKey = NULL; + int32_t len = -1; const i18n_uchar *pszStrResult = NULL; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); nRet = i18n_ures_get_by_key(hUres, "array_only_in_te", hUresKey, &hUresKey); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); - - //Target API - nRet = i18n_ures_get_string_by_index(hUresKey, 0, &len, &pszStrResult); - PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_string_by_index", BaseUtilsGetError(nRet),i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); - if(len < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_string_by_index failed ,len is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUresKey); - i18n_ures_destroy(hUres); - return 1; - } - - nRet = i18n_ures_destroy(hUresKey); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - - return 0; + CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); + + //Target API + nRet = i18n_ures_get_string_by_index(hUresKey, 0, &len, &pszStrResult); + PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_string_by_index", BaseUtilsGetError(nRet),i18n_ures_destroy(hUresKey); i18n_ures_destroy(hUres)); + if(len < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_string_by_index failed ,len is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUresKey); + i18n_ures_destroy(hUres); + return 1; + } + + nRet = i18n_ures_destroy(hUresKey); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + + return 0; } /* * @testcase ITc_i18n_ures_get_UTF8_string_by_index_p @@ -1071,31 +1105,32 @@ int ITc_i18n_ures_get_string_by_index_p(void) */ int ITc_i18n_ures_get_UTF8_string_by_index_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "te"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - const char *pszStrResult = NULL; - char *pszBuff = NULL; - char szBuffer[16]; - pszBuff = szBuffer; - int32_t len = (int32_t)sizeof(szBuffer); - - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); - - //Target API + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "te"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + const char *pszStrResult = NULL; + char *pszBuff = NULL; + char szBuffer[16]; + pszBuff = szBuffer; + int32_t len = (int32_t)sizeof(szBuffer); + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); + + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); + + //Target API nRet = i18n_ures_get_UTF8_string_by_index(hUres, 1, pszBuff, &len, false, &pszStrResult); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_UTF8_string_by_index", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_by_key_p @@ -1113,31 +1148,32 @@ int ITc_i18n_ures_get_UTF8_string_by_index_p(void) */ int ITc_i18n_ures_get_by_key_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "te"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - const char *pszLocaleType = NULL; - i18n_ures_h hUres = NULL; - i18n_ures_h hUresKey = NULL; + int nRet = -1; + const char *pszLocale = "te"; + const char *pszLocaleType = NULL; + i18n_ures_h hUres = NULL; + i18n_ures_h hUresKey = NULL; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API + //Target API nRet = i18n_ures_get_by_key(hUres, "array_only_in_te", hUresKey, &hUresKey); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); + CHECK_HANDLE_CLEANUP(hUresKey, "i18n_ures_get_by_key", i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUresKey); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUresKey); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_string_by_key_p @@ -1155,33 +1191,34 @@ int ITc_i18n_ures_get_by_key_p(void) */ int ITc_i18n_ures_get_string_by_key_p(void) { - START_TEST_PRINT; + START_TEST_PRINT; - int nRet = -1; - const char *pszLocale = "te"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - i18n_ures_h hUres = NULL; - const i18n_uchar *pszResult = NULL; + int nRet = -1; + const char *pszLocale = "te"; + i18n_ures_h hUres = NULL; + const i18n_uchar *pszResult = NULL; int32_t result_len = -1; + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API + //Target API nRet = i18n_ures_get_string_by_key(hUres, "string_only_in_te", &result_len, &pszResult); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_string_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - if(result_len < 0) - { - FPRINTF("\\n[Line : %d][%s] i18n_ures_get_string_by_key failed ,result_len is not correct \n", __LINE__, API_NAMESPACE); - i18n_ures_destroy(hUres); - return 1; - } + if(result_len < 0) + { + FPRINTF("\\n[Line : %d][%s] i18n_ures_get_string_by_key failed ,result_len is not correct \n", __LINE__, API_NAMESPACE); + i18n_ures_destroy(hUres); + return 1; + } - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; } /* * @testcase ITc_i18n_ures_get_UTF8_string_by_key_p @@ -1199,40 +1236,41 @@ int ITc_i18n_ures_get_string_by_key_p(void) */ int ITc_i18n_ures_get_UTF8_string_by_key_p(void) { - START_TEST_PRINT; - - int nRet = -1; - const char *pszLocale = "te"; - const char *pszPackageName = "/opt/usr/globalapps/org.tizen.base-utils-native-itc/res/"; - i18n_ures_h hUres = NULL; - const i18n_uchar *pszExpectedResult = "TE"; - const char *pszResult = NULL; + START_TEST_PRINT; + + int nRet = -1; + const char *pszLocale = "te"; + i18n_ures_h hUres = NULL; + const i18n_uchar *pszExpectedResult = "TE"; + const char *pszResult = NULL; char *pszBuff = NULL; char szBuffer[16]; pszBuff = szBuffer; int32_t result_len = (int32_t)sizeof(szBuffer); + char pszPackageName[CONFIG_VALUE_LEN_MAX] = {0,}; + itc_base_utils_get_resource_path(pszPackageName, CONFIG_VALUE_LEN_MAX - 1); - nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); - PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); - CHECK_HANDLE(hUres, "i18n_ures_create"); + nRet = i18n_ures_create(pszPackageName, pszLocale, &hUres); + PRINT_RESULT(I18N_ERROR_NONE, nRet, "i18n_ures_create", BaseUtilsGetError(nRet)); + CHECK_HANDLE(hUres, "i18n_ures_create"); - //Target API + //Target API nRet = i18n_ures_get_UTF8_string_by_key(hUres, "string_only_in_te", pszBuff, &result_len, false, &pszResult); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_UTF8_string_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); if(strncmp(pszResult, pszExpectedResult, strlen(pszExpectedResult)) != 0) - { - FPRINTF("[Line : %d][%s] i18n_ures_get_UTF8_string_by_key mismatch pszResult = %s. \\n", __LINE__, API_NAMESPACE, pszResult); - i18n_ures_destroy(hUres); - return 1; - } + { + FPRINTF("[Line : %d][%s] i18n_ures_get_UTF8_string_by_key mismatch pszResult = %s. \\n", __LINE__, API_NAMESPACE, pszResult); + i18n_ures_destroy(hUres); + return 1; + } - pszResult = NULL; + pszResult = NULL; nRet = i18n_ures_get_UTF8_string_by_key(hUres, "string_only_in_te", pszBuff, &result_len, true, &pszResult); PRINT_RESULT_CLEANUP(I18N_ERROR_NONE, nRet, "i18n_ures_get_UTF8_string_by_key", BaseUtilsGetError(nRet), i18n_ures_destroy(hUres)); - nRet = i18n_ures_destroy(hUres); - PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); + nRet = i18n_ures_destroy(hUres); + PRINT_RESULT_NORETURN(I18N_ERROR_NONE, nRet, "i18n_ures_destroy", BaseUtilsGetError(nRet)); - return 0; + return 0; }