Git init
[framework/multimedia/libmedia-thumbnail.git] / TC / utc / utc_thumbnail_request_from_db_func.c
1 /*
2  * libmedia-thumbnail
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 /**
23 * @file         utc_thumbnail_request_from_db_func.c
24 * @brief        This is a suit of unit test cases to test thumbnail_request_from_db API function
25 * @author
26 * @version      Initial Creation Version 0.1
27 * @date         2011-10-13
28 */
29
30 #include "utc_thumbnail_request_from_db_func.h"
31
32
33 /**
34 * @brief        This tests int thumbnail_request_from_db() API with valid parameters
35 * @par ID       utc_thumbnail_request_from_db_func_01
36 * @param        [in] 
37 * @return       This function returns zero on success, or negative value with error code
38 */
39 void utc_thumbnail_request_from_db_func_01()
40 {
41         int ret = -1;
42          
43         const char *origin_path = "/opt/media/Images and videos/Wallpapers/Home_default.png";
44         char thumb_path[1024] = {0,};
45
46         ret = thumbnail_request_from_db(origin_path, thumb_path, sizeof(thumb_path));
47         
48         if (ret < MEDIA_THUMB_ERROR_NONE) {
49                 UTC_THUMB_LOG( "unable to get thumbnail from thumb-daemon. error code->%d", ret);
50                 tet_result(TET_FAIL);
51                 return;
52         } else {
53                 tet_result(TET_PASS);
54         }
55         
56         return;
57 }
58
59
60 /**
61 * @brief        This tests int thumbnail_request_from_db() API with invalid parameters
62 * @par ID       utc_thumbnail_request_from_db_func_02
63 * @param        [in] 
64 * @return       error code on success 
65 */
66 void utc_thumbnail_request_from_db_func_02()
67 {       
68         int ret = -1;
69
70         const char *origin_path = NULL;
71         char thumb_path[1024] = {0,};
72
73         ret = thumbnail_request_from_db(origin_path, thumb_path, sizeof(thumb_path));
74
75         if (ret < MEDIA_THUMB_ERROR_NONE) {
76                 UTC_THUMB_LOG("abnormal condition test for null, error code->%d", ret);
77                 tet_result(TET_PASS);
78         } else {
79                 UTC_THUMB_LOG("Getting thumbnail from thumb-daemon should be failed because the origin_path is NULL");
80                 tet_result(TET_FAIL);
81         }
82
83         return ;
84 }
85