[CTC][platform-permission][Non-ACR][DPTTIZEN-2060: Changed Thumbnail Image Path to...
authorShashank Shekhar Shukla <shekhar1.s@samsung.com>
Fri, 17 Jun 2016 05:03:15 +0000 (14:03 +0900)
committerShashank Shekhar Shukla <shekhar1.s@samsung.com>
Fri, 17 Jun 2016 05:03:15 +0000 (14:03 +0900)
Change-Id: If37f82a21ce570f249517c8ebe66f8c3360194f0
Signed-off-by: Shashank Shekhar Shukla <shekhar1.s@samsung.com>
src/ctc/platform-permission/CTs-platform-permission-thumbnail-util.c

index 1d6a652..478f4a8 100755 (executable)
@@ -1,9 +1,10 @@
 #include "CTs-platform-permission-common.h"
 #include <thumbnail_util.h>
+#include <storage.h>
 
 #define MEDIA_IMAGE_WIDTH              1280
 #define MEDIA_IMAGE_HEIGHT             720
-#define SAMPLE_FILE_PATH_1             (ThumbnailGetDataPath("PlatformPermission_test.jpg"))
+#define SAMPLE_FILE_PATH_1             "PlatformPermission_test.jpg"
 bool g_bCallbackHit;
 bool g_bCallBackHit;
 int errorcode;
@@ -20,6 +21,28 @@ GMainLoop *g_pDataControlMainLoop;
         g_pDataControlMainLoop = NULL;\
 }\
 }
+
+const char *target_image_source_path = NULL;
+
+/**
+* @function             storage_device_cb
+* @description          Retrives the internal storage directory and set resource path
+* @parameter            int storage_id, storage_type_e type, storage_state_e state, const char* path
+, void* user_data
+* @return               bool
+*/
+static bool storage_device_cb(int storage_id, storage_type_e type, storage_state_e state, const char* path, void* user_data)
+{
+       if (type == STORAGE_TYPE_INTERNAL)
+       {
+               target_image_source_path=(char*)calloc(strlen(path)+strlen("/Images/")+strlen(SAMPLE_FILE_PATH_1)+1, sizeof(char));
+               snprintf(target_image_source_path, strlen(path)+strlen("/Images/")+strlen(SAMPLE_FILE_PATH_1)+1,"%s/Images/%s",path,SAMPLE_FILE_PATH_1);
+               FPRINTF("[Line : %d][%s] Thumbnail Image Path : %s\\n", __LINE__, API_NAMESPACE, target_image_source_path);
+               return false;
+       }
+       return true;
+}
+
 /**
 * @function             DataControlTimeout
 * @description          Called if some callback is not invoked for a particular timeout
@@ -138,6 +161,8 @@ void CTs_platform_permission_thumbnailutil_startup(void)
     FPRINTF("[Line : %d][%s] TEST SUIT start-up: CTs_Platform_Permission_p\\n", __LINE__, API_NAMESPACE);
 #endif
        TCT_CheckInstalledApp(5, TPK1, TPK2, TPK3, TPK4, TPK5);
+
+       storage_foreach_device_supported(storage_device_cb,NULL);
 }
 
 /**
@@ -149,9 +174,14 @@ void CTs_platform_permission_thumbnailutil_startup(void)
 void CTs_platform_permission_thumbnailutil_cleanup(void)
 {
 #if DEBUG
-    FPRINTF("[Line : %d][%s] TEST SUIT clean-up: CTs_Platform_Permission_p\\n", __LINE__, API_NAMESPACE);
+       FPRINTF("[Line : %d][%s] TEST SUIT clean-up: CTs_Platform_Permission_p\\n", __LINE__, API_NAMESPACE);
 #endif
-    return;
+       if (target_image_source_path)
+       {
+               free(target_image_source_path);
+               target_image_source_path = NULL;
+       }
+       return;
 }
 
 //& purpose: checking http://tizen.org/privilege/mediastorage
@@ -181,7 +211,7 @@ int CTc_ThumbnailUtil_PrivilegeMediaStorage(void)
        int nRet = thumbnail_util_create(&stHandleThumbnail);
        PRINT_RESULT(THUMBNAIL_UTIL_ERROR_NONE, nRet, "thumbnail_util_create", ThumbnailUtilGetError(nRet));
        
-       nRet = thumbnail_util_set_path(stHandleThumbnail, SAMPLE_FILE_PATH_1);
+       nRet = thumbnail_util_set_path(stHandleThumbnail, target_image_source_path);
        PRINT_RESULT(THUMBNAIL_UTIL_ERROR_NONE, nRet, "thumbnail_util_set_path", ThumbnailUtilGetError(nRet));
     
        nRet = thumbnail_util_set_size(stHandleThumbnail, MEDIA_IMAGE_WIDTH, MEDIA_IMAGE_HEIGHT);