2 * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "libmm_fileinfo_unittest.h"
20 #define GTEST_VIDEO_FILE_PATH "/usr/bin/libmm-fileinfo-unittest.mp4"
21 #define GTEST_SOUND_FILE_PATH "/usr/bin/libmm-fileinfo-unittest.mp3"
23 using ::testing::InitGoogleTest;
24 using ::testing::Test;
25 using ::testing::TestCase;
27 class libmm_fileinfo_Test : public ::testing::Test {
30 std::cout << "SetUp()" << std::endl;
34 std::cout << "TearDown()" << std::endl;
38 TEST(libmm_fileinfo_Test, mm_file_create_content_attrs_p)
40 int ret = FILEINFO_ERROR_NONE;
41 MMHandleType content_attrs;
43 ret = mm_file_create_content_attrs(&content_attrs, GTEST_VIDEO_FILE_PATH);
44 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
46 ret = mm_file_destroy_content_attrs(content_attrs);
47 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
50 TEST(libmm_fileinfo_Test, mm_file_get_content_attrs_p)
52 int ret = FILEINFO_ERROR_NONE;
53 MMHandleType content_attrs;
56 ret = mm_file_create_content_attrs(&content_attrs, GTEST_VIDEO_FILE_PATH);
57 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
59 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_DURATION, &p, NULL);
60 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
63 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_VIDEO_BITRATE, &p, NULL);
64 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
67 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_VIDEO_FPS, &p, NULL);
68 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
71 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_VIDEO_WIDTH, &p, NULL);
72 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
75 ret = mm_file_get_attrs(content_attrs, MM_FILE_CONTENT_VIDEO_HEIGHT, &p, NULL);
76 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
79 ret = mm_file_destroy_content_attrs(content_attrs);
80 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
83 TEST(libmm_fileinfo_Test, mm_file_create_tag_attrs_p)
85 int ret = FILEINFO_ERROR_NONE;
86 MMHandleType tag_attrs;
88 ret = mm_file_create_tag_attrs(&tag_attrs, GTEST_VIDEO_FILE_PATH);
89 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
91 ret = mm_file_destroy_tag_attrs(tag_attrs);
92 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
95 TEST(libmm_fileinfo_Test, mm_file_get_tag_attrs_p)
97 int ret = FILEINFO_ERROR_NONE;
98 MMHandleType tag_attrs;
100 unsigned int size = 0;
102 ret = mm_file_create_tag_attrs(&tag_attrs, GTEST_VIDEO_FILE_PATH);
103 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
105 ret = mm_file_get_attrs(tag_attrs, MM_FILE_TAG_ARTIST, &p, &size, NULL);
106 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
107 EXPECT_STREQ(p, "Test");
109 ret = mm_file_get_attrs(tag_attrs, MM_FILE_TAG_TITLE, &p, &size, NULL);
110 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
111 EXPECT_STREQ(p, "Test");
113 ret = mm_file_get_attrs(tag_attrs, MM_FILE_TAG_ALBUM, &p, &size, NULL);
114 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
115 EXPECT_STREQ(p, "Test");
117 ret = mm_file_get_attrs(tag_attrs, MM_FILE_TAG_GENRE, &p, &size, NULL);
118 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
119 EXPECT_STREQ(p, "Test");
121 ret = mm_file_destroy_tag_attrs(tag_attrs);
122 EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
125 int main(int argc, char **argv)
127 InitGoogleTest(&argc, argv);
129 return RUN_ALL_TESTS();