tizenwlsink: Add unittest 93/194093/4
authorHyunil <hyunil46.park@samsung.com>
Thu, 29 Nov 2018 03:43:45 +0000 (12:43 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Thu, 29 Nov 2018 08:14:51 +0000 (08:14 +0000)
Change-Id: I026f0c0bf23f2b81f7f516ed3613399e9841a7b7
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
configure.ac
tizenwlsink/Makefile.am
tizenwlsink/unittest/Makefile.am [new file with mode: 0644]
tizenwlsink/unittest/gtests_tizenwlsink.cpp [new file with mode: 0644]
tizenwlsink/unittest/gtests_tizenwlsink.h [new file with mode: 0644]

index df2c8a2..f764d71 100644 (file)
@@ -511,6 +511,7 @@ video360/Makefile
 video360/src/Makefile
 tizenwlsink/Makefile
 tizenwlsink/src/Makefile
+tizenwlsink/unittest/Makefile
 tizencamerasrc/Makefile
 tizencamerasrc/src/Makefile
 )
index af437a6..5008a5c 100644 (file)
@@ -1 +1,5 @@
 SUBDIRS = src
+
+if IS_TESTS
+SUBDIRS += unittest
+endif
diff --git a/tizenwlsink/unittest/Makefile.am b/tizenwlsink/unittest/Makefile.am
new file mode 100644 (file)
index 0000000..32a1a08
--- /dev/null
@@ -0,0 +1,14 @@
+bin_PROGRAMS = gtests-tizenwlsink\r
+\r
+gtests_tizenwlsink_SOURCES = gtests_tizenwlsink.cpp\r
+\r
+gtests_tizenwlsink_CXXFLAGS = \\r
+                       -I$(top_srcdir)/tizenwlsink/src \\r
+                       -DTIZEN_FEATURE_WLSINK_ENHANCEMENT \\r
+                       $(GST_CFLAGS) $(GST_BASE_CFLAGS)$ $(GST_PLUGINS_BASE_CFLAGS) $(GST_VIDEO_CFLAGS) $(GST_ALLOCATORS_CFLAGS)\\r
+                       $(WAYLAND_CFLAGS) $(DRM_CFLAGS) $(TBM_CFLAGS) $(MMCOMMON_CFLAGS) $(GTESTS_CFLAGS)\r
+\r
+gtests_tizenwlsink_LDADD = \\r
+                       $(top_builddir)/tizenwlsink/src/libgsttizenwlsink.la \\r
+                       $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_ALLOCATORS_LIBS)\\r
+                       $(WAYLAND_LIBS) $(DRM_LIBS) $(TBM_LIBS) $(MMCOMMON_LIBS) $(GTESTS_LIBS)\r
diff --git a/tizenwlsink/unittest/gtests_tizenwlsink.cpp b/tizenwlsink/unittest/gtests_tizenwlsink.cpp
new file mode 100644 (file)
index 0000000..dda685f
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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 "gtests_tizenwlsink.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using namespace std;
+
+struct convert_format_param
+{
+       GstVideoFormat gst_format;
+       int tbm_format;
+};
+
+class tizenwlsink_Test : public ::testing::TestWithParam<convert_format_param> {
+};
+
+INSTANTIATE_TEST_CASE_P(tizenwlsink_Test_param_instant,
+                                               tizenwlsink_Test,
+                                               ::testing::Values(
+                                                       convert_format_param { GST_VIDEO_FORMAT_UNKNOWN, -1 },
+                                                       convert_format_param { GST_VIDEO_FORMAT_SN12, TBM_FORMAT_NV12 },
+                                                       convert_format_param { GST_VIDEO_FORMAT_SN21, TBM_FORMAT_NV21 },
+                                                       convert_format_param { GST_VIDEO_FORMAT_S420, TBM_FORMAT_YUV420 },
+                                                       convert_format_param { GST_VIDEO_FORMAT_SR32, TBM_FORMAT_ARGB8888 }
+                                               ));
+
+TEST_P(tizenwlsink_Test, GstFormatToTbmFormat_Param)
+{
+       auto param = GetParam();
+       auto tbm_format = gst_video_format_to_wl_tbm_format(param.gst_format);
+
+       EXPECT_EQ(tbm_format, param.tbm_format);
+}
+
+int main(int argc, char **argv)
+{
+       InitGoogleTest(&argc, argv);
+
+       return RUN_ALL_TESTS();
+}
\ No newline at end of file
diff --git a/tizenwlsink/unittest/gtests_tizenwlsink.h b/tizenwlsink/unittest/gtests_tizenwlsink.h
new file mode 100644 (file)
index 0000000..c84489e
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+#ifndef __TIZENWLSINK_UNITTEST_H__
+#define __TIZENWLSINK_UNITTEST_H__
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include "gsttizenwlsink.h"
+#include "tizen-wlvideoformat.h"
+
+#undef LOG_TAG
+#define LOG_TAG                "GTESTS_TIZENWLSINK"
+
+#endif /*__TIZENWLSINK_UNITTEST_H__*/