[gstreamermm: 132/167] added ghostpad's tests



commit b295f55d9d4e1695fbf25915467608eb34528576
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Mon Aug 5 08:48:57 2013 +0200

    added ghostpad's tests

 .gitignore             |    1 +
 tests/Makefile.am      |   25 ++++++++++++++-----------
 tests/test-ghostpad.cc |   35 +++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 11 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index c5bda50..50d1b2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -468,6 +468,7 @@ gstreamer/src/xvimagesink.hg
 tests/test-buffer
 tests/test-bus
 tests/test-caps
+tests/test-ghostpad
 tests/test-pad
 tests/test-query
 tests/test-structure
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d64f23a..8238f99 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,21 +21,24 @@ AM_CXXFLAGS = $(GSTREAMERMM_WXXFLAGS) -g
 LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lgtest
 
 check_PROGRAMS = test-caps test-buffer test-bus test-caps test-pad \
+                 test-ghostpad \
                  test-query test-structure test-taglist test-plugin-appsink \
                  test-plugin-appsrc test-plugin-register test-plugin-pushsrc
 
 # Include run of test programs in check:
 TESTS = $(check_PROGRAMS)
+TEST_MAIN_SOURCE = main.cc
 
-test_caps_SOURCES                      = test-caps.cc main.cc
-test_buffer_SOURCES                    = test-buffer.cc main.cc
-test_bus_SOURCES                       = test-bus.cc main.cc
-test_pad_SOURCES                       = test-pad.cc main.cc
-test_query_SOURCES                     = test-query.cc main.cc
-test_structure_SOURCES         = test-structure.cc main.cc
-test_taglist_SOURCES           = test-taglist.cc main.cc
+test_caps_SOURCES                      = test-caps.cc $(TEST_MAIN_SOURCE)
+test_buffer_SOURCES                    = test-buffer.cc $(TEST_MAIN_SOURCE)
+test_bus_SOURCES                       = test-bus.cc $(TEST_MAIN_SOURCE)
+test_ghostpad_SOURCES          = test-ghostpad.cc $(TEST_MAIN_SOURCE)
+test_pad_SOURCES                       = test-pad.cc $(TEST_MAIN_SOURCE)
+test_query_SOURCES                     = test-query.cc $(TEST_MAIN_SOURCE)
+test_structure_SOURCES         = test-structure.cc $(TEST_MAIN_SOURCE)
+test_taglist_SOURCES           = test-taglist.cc $(TEST_MAIN_SOURCE)
 
-test_plugin_appsink_SOURCES                    = plugins/test-plugin-appsink.cc main.cc
-test_plugin_appsrc_SOURCES                     = plugins/test-plugin-appsrc.cc main.cc
-test_plugin_pushsrc_SOURCES                    = plugins/test-plugin-pushsrc.cc main.cc
-test_plugin_register_SOURCES           = plugins/test-plugin-register.cc main.cc
+test_plugin_appsink_SOURCES                    = plugins/test-plugin-appsink.cc $(TEST_MAIN_SOURCE)
+test_plugin_appsrc_SOURCES                     = plugins/test-plugin-appsrc.cc $(TEST_MAIN_SOURCE)
+test_plugin_pushsrc_SOURCES                    = plugins/test-plugin-pushsrc.cc $(TEST_MAIN_SOURCE)
+test_plugin_register_SOURCES           = plugins/test-plugin-register.cc $(TEST_MAIN_SOURCE)
diff --git a/tests/test-ghostpad.cc b/tests/test-ghostpad.cc
new file mode 100644
index 0000000..930798b
--- /dev/null
+++ b/tests/test-ghostpad.cc
@@ -0,0 +1,35 @@
+/*
+ * test-ghostpad.cc
+ *
+ *  Created on: Aug 5, 2013
+ *      Author: m.kolny
+ */
+
+#include <gtest/gtest.h>
+#include <gstreamermm.h>
+
+using namespace Gst;
+using Glib::RefPtr;
+
+TEST(GhostPadTest, CreatingGhostPad)
+{
+    Glib::ustring pad_name = "sample_name";
+    PadDirection direction = PAD_SINK;
+    RefPtr<GhostPad> ghost_pad = GhostPad::create(direction, pad_name);
+
+    ASSERT_TRUE(ghost_pad);
+    ASSERT_EQ(direction, ghost_pad->get_direction());
+    ASSERT_STREQ(pad_name.c_str(), ghost_pad->get_name().c_str());
+}
+
+TEST(GhostPadTest, CreatingGhostPadFromTemplate)
+{
+    PadDirection direction = PAD_SRC;
+    RefPtr<Caps> caps = Caps::create_simple("video/x-raw-yuv");
+    RefPtr<PadTemplate> templ = PadTemplate::create("pad-template", direction, PAD_ALWAYS, caps);
+
+    RefPtr<GhostPad> ghost_pad = GhostPad::create(templ);
+
+    ASSERT_TRUE(ghost_pad);
+    ASSERT_EQ(direction, ghost_pad->get_direction());
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]