<background-category value="media"/>
<background-category value="sensor"/>
</ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/mediastorage</privilege>
+ <privilege>http://tizen.org/privilege/externalstorage</privilege>
+ </privileges>
</manifest>
chsmack -a "User::App::Shared" $APP_DATA_DIR/*
chsmack -e "User::App::Shared" $APP_DATA_DIR/*
;;
+ "org.tizen.mime-type-native-itc")
+ echo "Installing pre-requisites for the package $1"
+ mkdir -p $APP_DATA_DIR
+ chsmack -a "User::App::Shared" $APP_DATA_DIR
+ chsmack -e "User::App::Shared" $APP_DATA_DIR
+ cp Tizen-logo-wallpaper.jpg $APP_DATA_DIR/Tizen-logo-wallpaper.jpg
+ chown -R 5000:5000 $APP_DATA_DIR
+ chmod -R 777 $APP_DATA_DIR
+ chsmack -a "User::App::Shared" $APP_DATA_DIR/*
+ chsmack -e "User::App::Shared" $APP_DATA_DIR/*
+ ;;
"org.tizen.video-util-native-itc")
echo "Installing pre-requisites for the package $1"
mkdir -p $APP_DATA_DIR
return szErrorVal;
}
-/** @} */ //end of itc-mime-type
\ No newline at end of file
+/**
+* @function MimeTypeGetDataPath
+* @description Get the path to application data directory
+* @parameter [IN] char* pszFileName [file name]
+* @return Total Path of file "pszFilename"
+*/
+char* MimeTypeGetDataPath(char *pszFileName)
+{
+ char *pszAppData = app_get_data_path(),*pszImgPath = NULL;
+ if ( pszAppData == NULL || strlen(pszAppData) == 0 )
+ {
+ FPRINTF("[Line : %d][%s] app_get_data_path() returned invalid path\\n", __LINE__, API_NAMESPACE);
+ return NULL;
+ }
+
+ pszImgPath = (char*) calloc(1, strlen(pszAppData) + strlen(pszFileName)+1);
+ if (pszImgPath == NULL)
+ return NULL;
+ sprintf(pszImgPath, "%s%s",pszAppData, pszFileName );
+ return pszImgPath;
+}
+
+/** @} */ //end of itc-mime-type
#include "tct_common.h"
#include <mime_type.h>
+#include <app.h>
/** @addtogroup itc-mime-type
* @ingroup itc
*/
#define API_NAMESPACE "MIME_TYPE_ITC"
+#define SAMPLE_FILE_PATH "Tizen-logo-wallpaper.jpg"
+#define PATH_LEN 1024
//Add test package related includes here
#define START_TEST {\
}
char* MimeTypeGetError(int nRet);
+bool FileUtilGetDataPath(char* pAppDataPath);
+bool FileUtilAppendToAppDataPath(char* pInputPath, char* pFinalPath);
+char* MimeTypeGetDataPath(char *pszFileName);
/** @} */ //end of itc-mime-type
-#endif //_ITS_MIME_TYPE_COMMON_H_
\ No newline at end of file
+#endif //_ITS_MIME_TYPE_COMMON_H_
return 0;
}
+//& purpose: Gets the MIME type for the given data.
+//& type: auto
+/**
+* @testcase ITc_mime_type_get_mime_type_for_data
+* @since_tizen 4.0
+* @author SRID(samuel.peter)
+* @reviewer SRID(manoj.g2)
+* @type auto
+* @description Gets the MIME type for the given data.
+* @scenario Get mime-type using mime_type_get_mime_type_for_data
+* @apicovered mime_type_get_mime_type_for_data
+* @passcase if mime_type_get_mime_type_for_data successful
+* @failcase if mime_type_get_mime_type_for_data fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_mime_type_get_mime_type_for_data(void)
+{
+ START_TEST;
+
+ char *pszMimeType = NULL;
+ char *pszPath = NULL;
+ char *pszOutMimeType = "image//jpeg";
+ FILE *pFilePtr = NULL;
+ int nSize = 0;
+ int nRet = 0;
+
+ pszPath = MimeTypeGetDataPath(SAMPLE_FILE_PATH);
+ if ( NULL == pszPath)
+ {
+ FPRINTF("[Line : %d][%s] MimeTypeGetDataPath failed, error returned\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ pFilePtr = fopen(pszPath, "rb");
+ if(NULL == pFilePtr)
+ {
+ FPRINTF("[Line : %d][%s] unable to open data file: %s\\n", __LINE__, API_NAMESPACE, pszPath);
+ FREE_MEMORY(pszPath);
+ return 1;
+ }
+
+ nSize = sizeof(pFilePtr);
+ nRet = mime_type_get_mime_type_for_data(pFilePtr, nSize, &pszMimeType);
+ PRINT_RESULT_CLEANUP(MIME_TYPE_ERROR_NONE, nRet, "mime_type_get_mime_type_for_data", MimeTypeGetError(nRet), FREE_MEMORY(pszPath);FREE_MEMORY(pFilePtr));
+ CHECK_HANDLE(pszMimeType,"mime_type_get_mime_type_for_data");
+
+ nSize = sizeof(pszOutMimeType);
+ if(!strncmp(pszMimeType, pszOutMimeType, nSize))
+ {
+ FPRINTF("[Line : %d][%s] incorrect mime_type returned.\\n", __LINE__, API_NAMESPACE);
+ FREE_MEMORY(pszMimeType);
+ FREE_MEMORY(pszPath);
+ FREE_MEMORY(pFilePtr);
+ return 1;
+ }
+
+ FPRINTF("[Line : %d][%s] mime_type : %s\\n", __LINE__, API_NAMESPACE, pszMimeType);
+ FREE_MEMORY(pszMimeType);
+ FREE_MEMORY(pszPath);
+ FREE_MEMORY(pFilePtr);
+
+ return 0;
+}
+
+//& purpose: Gets the MIME type for the given file extension.
+//& type: auto
+/**
+* @testcase ITc_mime_type_get_mime_type_for_file
+* @since_tizen 4.0
+* @author SRID(samuel.peter)
+* @reviewer SRID(manoj.g2)
+* @type auto
+* @description Gets the MIME type for the given file.
+* @scenario Get mime-type using mime_type_get_mime_type_for_file
+* @apicovered mime_type_get_mime_type_for_file
+* @passcase if mime_type_get_mime_type_for_file successful
+* @failcase if mime_type_get_mime_type_for_file fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_mime_type_get_mime_type_for_file(void)
+{
+ START_TEST;
+
+ char *pszMimeType = NULL;
+ char *pszPath = NULL;
+ char *pszOutMimeType = "application//octet-stream";
+ int nSize = 0;
+ int nRet = 0;
+
+ pszPath = MimeTypeGetDataPath(SAMPLE_FILE_PATH);
+ if ( NULL == pszPath)
+ {
+ FPRINTF("[Line : %d][%s] MimeTypeGetDataPath failed, error returned\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRet = mime_type_get_mime_type_for_file(pszPath, &pszMimeType);
+ PRINT_RESULT_CLEANUP(MIME_TYPE_ERROR_NONE, nRet, "mime_type_get_mime_type_for_file", MimeTypeGetError(nRet),FREE_MEMORY(pszPath));
+ CHECK_HANDLE(pszMimeType,"mime_type_get_mime_type_for_file");
+
+ nSize = sizeof(pszOutMimeType);
+ if(!strncmp(pszMimeType, pszOutMimeType, nSize))
+ {
+ FPRINTF("[Line : %d][%s] incorrect mime_type returned.\\n", __LINE__, API_NAMESPACE);
+ FREE_MEMORY(pszMimeType);
+ FREE_MEMORY(pszPath);
+ return 1;
+ }
+
+ FPRINTF("[Line : %d][%s] mime_type : %s\\n", __LINE__, API_NAMESPACE, pszMimeType);
+ FREE_MEMORY(pszMimeType);
+ FREE_MEMORY(pszPath);
+
+ return 0;
+}
/** @} */ //end of itc-mime-type
-/** @} */ //end of itc-mime-type-testcases
\ No newline at end of file
+/** @} */ //end of itc-mime-type-testcases
extern int ITc_mime_type_get_file_extension_p(void);
extern int ITc_mime_type_get_mime_type_p(void);
+extern int ITc_mime_type_get_mime_type_for_file(void);
+extern int ITc_mime_type_get_mime_type_for_data(void);
testcase tc_array[] = {
{"ITc_mime_type_get_file_extension_p",ITc_mime_type_get_file_extension_p,ITs_mime_type_startup,ITs_mime_type_cleanup},
{"ITc_mime_type_get_mime_type_p",ITc_mime_type_get_mime_type_p,ITs_mime_type_startup,ITs_mime_type_cleanup},
+ {"ITc_mime_type_get_mime_type_for_file",ITc_mime_type_get_mime_type_for_file,ITs_mime_type_startup,ITs_mime_type_cleanup},
+ {"ITc_mime_type_get_mime_type_for_data",ITc_mime_type_get_mime_type_for_data,ITs_mime_type_startup,ITs_mime_type_cleanup},
{NULL, NULL}
};
extern int ITc_mime_type_get_file_extension_p(void);
extern int ITc_mime_type_get_mime_type_p(void);
+extern int ITc_mime_type_get_mime_type_for_file(void);
+extern int ITc_mime_type_get_mime_type_for_data(void);
testcase tc_array[] = {
{"ITc_mime_type_get_file_extension_p",ITc_mime_type_get_file_extension_p,ITs_mime_type_startup,ITs_mime_type_cleanup},
{"ITc_mime_type_get_mime_type_p",ITc_mime_type_get_mime_type_p,ITs_mime_type_startup,ITs_mime_type_cleanup},
+ {"ITc_mime_type_get_mime_type_for_file",ITc_mime_type_get_mime_type_for_file,ITs_mime_type_startup,ITs_mime_type_cleanup},
+ {"ITc_mime_type_get_mime_type_for_data",ITc_mime_type_get_mime_type_for_data,ITs_mime_type_startup,ITs_mime_type_cleanup},
{NULL, NULL}
};