Adding initial structure for unittest
[platform/core/multimedia/libmedia-thumbnail.git] / unittest / libmedia_thumbnail_unittest.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <tzplatform_config.h>
18
19 #include "libmedia_thumbnail_unittest.h"
20 #include "media-util.h"
21 #include "media-thumbnail.h"
22
23 #define GTEST_IMAGE_FILE_PATH           tzplatform_mkpath(TZ_SYS_BIN, "libmedia-thumbnail-unittest.jpg")
24
25 #define THUMBNAIL_WIDTH                 512
26 #define THUMBNAIL_HEIGHT                288
27
28 using ::testing::InitGoogleTest;
29 using ::testing::Test;
30 using ::testing::TestCase;
31
32 class libmedia_thumbnail_Test : public ::testing::Test {
33         protected:
34                 void SetUp() {
35                         std::cout << "SetUp()" << std::endl;
36                 }
37
38                 void TearDown() {
39                         std::cout << "TearDown()" << std::endl;
40                 }
41 };
42
43 TEST(libmedia_thumbnail_Test, thumbnail_request_from_db_async_n)
44 {
45         int ret = MS_MEDIA_ERR_NONE;
46
47         ret = thumbnail_request_from_db_async(0, NULL, NULL, NULL, 5001);
48         EXPECT_EQ(ret, MS_MEDIA_ERR_INVALID_PARAMETER);
49
50         ret = thumbnail_request_from_db_async(0, GTEST_IMAGE_FILE_PATH, NULL, NULL, 5001);
51         EXPECT_EQ(ret, MS_MEDIA_ERR_INVALID_PARAMETER);
52 }
53
54 TEST(libmedia_thumbnail_Test, thumbnail_request_cancel_media_n)
55 {
56         int ret = MS_MEDIA_ERR_NONE;
57
58         ret = thumbnail_request_cancel_media(0);
59         EXPECT_EQ(ret, MS_MEDIA_ERR_INTERNAL);
60 }
61
62 int main(int argc, char **argv)
63 {
64         InitGoogleTest(&argc, argv);
65
66         return RUN_ALL_TESTS();
67 }