[gstreamermm: 109/167] added tests for Bus
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm: 109/167] added tests for Bus
- Date: Tue, 3 Sep 2013 19:28:13 +0000 (UTC)
commit e146b301aecda48ee26c09ac9cf1015fb78b6e71
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date: Thu Aug 1 12:27:32 2013 +0200
added tests for Bus
tests/test-bus.cc | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-bus.cc b/tests/test-bus.cc
new file mode 100644
index 0000000..0ae919e
--- /dev/null
+++ b/tests/test-bus.cc
@@ -0,0 +1,63 @@
+/*
+ * test-bus.cc
+ *
+ * Created on: Aug 1, 2013
+ * Author: m.kolny
+ */
+
+#include <gtest/gtest.h>
+#include <gstreamermm.h>
+
+using namespace Gst;
+
+class BusTest : public ::testing::Test
+{
+protected:
+ Glib::RefPtr<Bus> bus;
+ Glib::RefPtr<Message> message;
+
+ void PostMessage()
+ {
+ bool message_posted = bus->post(MessageEos::create(Glib::RefPtr<Object>()));
+ ASSERT_TRUE(message_posted);
+ }
+
+ void CheckPending(bool expected = true)
+ {
+ bool have_pending = bus->have_pending();
+ EXPECT_EQ(expected, have_pending);
+ }
+};
+
+TEST_F(BusTest, CorrectCreateBus)
+{
+ bus = Bus::create();
+
+ ASSERT_TRUE(bus);
+}
+
+TEST_F(BusTest, PostMessageAndPeekIt)
+{
+ bus = Bus::create();
+
+ PostMessage();
+ CheckPending();
+
+ Glib::RefPtr<Message> msg = bus->peek();
+
+ ASSERT_TRUE(msg);
+}
+
+TEST_F(BusTest, PostMessageAndPopIt)
+{
+ bus = Bus::create();
+
+ PostMessage();
+ CheckPending();
+
+ Glib::RefPtr<Message> msg = bus->pop();
+
+ ASSERT_TRUE(msg);
+
+ CheckPending(false);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]