[gstreamermm] Test: added tests for Gst module



commit 482d8c1dd12b0f4561ae255b63bf89b89e3edccf
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Sun Aug 3 22:09:15 2014 +0200

    Test: added tests for Gst module

 .gitignore         |    1 +
 tests/Makefile.am  |    3 +-
 tests/test-init.cc |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 23c30db..7feee4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -478,6 +478,7 @@ tests/test-buffer
 tests/test-bus
 tests/test-caps
 tests/test-ghostpad
+tests/test-init
 tests/test-pad
 tests/test-query
 tests/test-structure
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 906926d..eba8a47 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,7 +21,7 @@ AM_CXXFLAGS = $(GSTREAMERMM_WXXFLAGS) -g
 LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lgtest -lpthread
 
 check_PROGRAMS = test-caps test-buffer test-bus test-caps test-pad \
-                 test-urihandler test-ghostpad \
+                 test-urihandler test-ghostpad test-init \
                  test-query test-structure test-taglist test-plugin-appsink \
                  test-plugin-appsrc test-plugin-register test-plugin-pushsrc \
                  test-regression-bininpipeline test-regression-binplugin \
@@ -37,6 +37,7 @@ 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_init_SOURCES                      = test-init.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)
diff --git a/tests/test-init.cc b/tests/test-init.cc
new file mode 100644
index 0000000..243693a
--- /dev/null
+++ b/tests/test-init.cc
@@ -0,0 +1,62 @@
+/*
+ * test-init.cc
+ *
+ *  Created on: Aug 3, 2014
+ *      Author: loganek
+ */
+
+#include <gtest/gtest.h>
+#include <gstreamermm.h>
+#include <glibmm.h>
+
+using namespace Gst;
+using Glib::RefPtr;
+
+class InitTest : public ::testing::Test
+{
+protected:
+  virtual void SetUp()
+  {
+    deinit();
+  }
+  static void TearDownTestCase()
+  {
+     init();
+  }
+
+};
+
+TEST(InitTest, ShouldValidInitializeAndDeinitialize)
+{
+  init();
+  ASSERT_TRUE(is_initialized());
+}
+
+TEST(InitTest, ShouldReturnCorrectGstreamerVersion)
+{
+  guint major, minor, micro, nano;
+  version(major, minor, micro, nano);
+
+  EXPECT_EQ(major, GST_VERSION_MAJOR);
+  EXPECT_EQ(minor, GST_VERSION_MINOR);
+  EXPECT_EQ(micro, GST_VERSION_MICRO);
+  EXPECT_EQ(nano, GST_VERSION_NANO);
+}
+
+TEST(InitTest, ShouldCorrectSetsSIGSEVHandling)
+{
+  bool prev = segtrap_is_enabled();
+  segtrap_set_enabled(!prev);
+  EXPECT_EQ(!prev, segtrap_is_enabled());
+  segtrap_set_enabled(prev);
+  EXPECT_EQ(prev, segtrap_is_enabled());
+}
+
+TEST(InitTest, ShouldCorrectSetsScanningRegistry)
+{
+  bool prev = registry_fork_is_enabled();
+  registry_fork_set_enabled(!prev);
+  EXPECT_EQ(!prev, registry_fork_is_enabled());
+  registry_fork_set_enabled(prev);
+  EXPECT_EQ(prev, registry_fork_is_enabled());
+}


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