--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "libmm_fileinfo_unittest.h"
+#include "mm_file.h"
+
+#define GTEST_VIDEO_FILE_PATH "/usr/bin/libmm-fileinfo-unittest.mp4"
+#define GTEST_SOUND_FILE_PATH "/usr/bin/libmm-fileinfo-unittest.mp3"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+
+class libmm_fileinfo_Test : public ::testing::Test {
+ protected:
+ void SetUp() {
+ std::cout << "SetUp()" << std::endl;
+ }
+
+ void TearDown() {
+ std::cout << "TearDown()" << std::endl;
+ }
+};
+
+TEST(libmm_fileinfo_Test, mm_file_create_content_attrs_p)
+{
+ int ret = FILEINFO_ERROR_NONE;
+ MMHandleType content_attrs;
+
+ ret = mm_file_create_content_attrs(&content_attrs, GTEST_VIDEO_FILE_PATH);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+
+ ret = mm_file_destroy_content_attrs(content_attrs);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+}
+
+TEST(libmm_fileinfo_Test, mm_file_get_content_attrs_p)
+{
+ int ret = FILEINFO_ERROR_NONE;
+ MMHandleType content_attrs;
+ char *err_attr_name = NULL;
+ int p = 0;
+
+ ret = mm_file_create_content_attrs(&content_attrs, GTEST_VIDEO_FILE_PATH);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+
+ ret = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_DURATION, &p, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_EQ(p, 11883);
+
+ ret = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_BITRATE, &p, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_EQ(p, 909428);
+
+ ret = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_FPS, &p, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_EQ(p, 30);
+
+ ret = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &p, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_EQ(p, 320);
+
+ ret = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_HEIGHT, &p, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_EQ(p, 240);
+
+ ret = mm_file_destroy_content_attrs(content_attrs);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+}
+
+TEST(libmm_fileinfo_Test, mm_file_create_tag_attrs_p)
+{
+ int ret = FILEINFO_ERROR_NONE;
+ MMHandleType tag_attrs;
+
+ ret = mm_file_create_tag_attrs(&tag_attrs, GTEST_VIDEO_FILE_PATH);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+
+ ret = mm_file_destroy_tag_attrs(tag_attrs);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+}
+
+TEST(libmm_fileinfo_Test, mm_file_get_tag_attrs_p)
+{
+ int ret = FILEINFO_ERROR_NONE;
+ MMHandleType tag_attrs;
+ char *err_attr_name = NULL;
+ char *p = NULL;
+ unsigned int size = 0;
+
+ ret = mm_file_create_tag_attrs(&tag_attrs, GTEST_VIDEO_FILE_PATH);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+
+ ret = mm_file_get_attrs(tag_attrs, &err_attr_name, MM_FILE_TAG_ARTIST, &p, &size, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_STREQ(p, "Test");
+
+ ret = mm_file_get_attrs(tag_attrs, &err_attr_name, MM_FILE_TAG_TITLE, &p, &size, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_STREQ(p, "Test");
+
+ ret = mm_file_get_attrs(tag_attrs, &err_attr_name, MM_FILE_TAG_ALBUM, &p, &size, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_STREQ(p, "Test");
+
+ ret = mm_file_get_attrs(tag_attrs, &err_attr_name, MM_FILE_TAG_GENRE, &p, &size, NULL);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+ EXPECT_STREQ(p, "Test");
+
+ ret = mm_file_destroy_tag_attrs(tag_attrs);
+ EXPECT_EQ(ret, FILEINFO_ERROR_NONE);
+}
+
+int main(int argc, char **argv)
+{
+ InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}