[gstreamermm: 102/167] added first gstreamermm tests



commit 1c6e3f59307e5b41d3d7ca81f7bda6fb87495187
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Wed Jul 31 15:03:48 2013 +0200

    added first gstreamermm tests

 .gitignore      |    3 +++
 tests/buffer.cc |   40 ++++++++++++++++++++++++++++++++++++++++
 tests/main.cc   |   17 +++++------------
 3 files changed, 48 insertions(+), 12 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e9c298a..4850a4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -462,6 +462,9 @@ gstreamer/src/ximagesink.hg
 gstreamer/src/xvimagesink.ccg
 gstreamer/src/xvimagesink.hg
 
+#tests/
+tests/test-all
+
 # old-tests/
 old-tests/test-buffer-mapinfo
 old-tests/test-caps
diff --git a/tests/buffer.cc b/tests/buffer.cc
new file mode 100644
index 0000000..78af9bb
--- /dev/null
+++ b/tests/buffer.cc
@@ -0,0 +1,40 @@
+/*
+ * buffer.cc
+ *
+ *  Created on: Jul 31, 2013
+ *      Author: m.kolny
+ */
+
+#include <gtest/gtest.h>
+#include <gstreamermm/buffer.h>
+
+using namespace Gst;
+
+TEST(BufferTest, CheckBufferSize)
+{
+    int buff_size = 23;
+    Glib::RefPtr<Buffer> buf = Buffer::create(buff_size);
+    Glib::RefPtr<MapInfo> map_info(new MapInfo());
+
+    buf->map(map_info, MAP_READ);
+
+    EXPECT_EQ(buff_size, map_info->get_size());
+
+    buf->unmap(map_info);
+}
+
+TEST(BufferTest, CheckBufferFlags)
+{
+    guint buff_flags = 1;
+    Glib::RefPtr<Buffer> buf = Buffer::create();
+    buf->set_flags(buff_flags);
+    Glib::RefPtr<MapInfo> map_info(new MapInfo());
+
+    buf->map(map_info, MAP_READ);
+
+    buf->get_flags();
+
+    EXPECT_EQ(buff_flags, map_info->get_flags());
+
+    buf->unmap(map_info);
+}
diff --git a/tests/main.cc b/tests/main.cc
index e5078e4..6b5b5ef 100644
--- a/tests/main.cc
+++ b/tests/main.cc
@@ -1,17 +1,10 @@
 #include <gtest/gtest.h>
-
-TEST(FajnyTest, FailTest)
-{
-  EXPECT_EQ(1, 2);
-}
-
-TEST(FajnyTest, OKTest)
-{
-  EXPECT_EQ(1, 1);
-}
+#include <gstreamermm.h>
 
 int main(int argc, char** argv)
 {
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
+    ::testing::InitGoogleTest(&argc, argv);
+    Gst::init(argc, argv);
+
+    return RUN_ALL_TESTS();
 }


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