#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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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;
}
/*
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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;
}