[gstreamermm: 148/167] added test to test-plugin-register suite - checking property



commit 852f7fce0d5ecad9c1c3e69ba53d473c54c86c18
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Wed Aug 7 11:52:18 2013 +0200

    added test to test-plugin-register suite - checking property

 tests/plugins/test-foo.h              |    6 +++++-
 tests/plugins/test-plugin-register.cc |   14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/tests/plugins/test-foo.h b/tests/plugins/test-foo.h
index 7175843..281b7d5 100644
--- a/tests/plugins/test-foo.h
+++ b/tests/plugins/test-foo.h
@@ -18,6 +18,7 @@ class Foo : public Element
 {
     Glib::RefPtr<Pad> sinkpad;
     Glib::RefPtr<Pad> srcpad;
+    Glib::Property<Glib::ustring> sample_property;
 
 public:
     static void base_init(BaseClassType *klass)
@@ -49,7 +50,10 @@ public:
     }
 
     explicit Foo(GstElement *gobj)
-        : Gst::Element(gobj)
+        : Glib::ObjectBase(typeid (Foo)), // type must be registered before use
+          Gst::Element(gobj),
+          sample_property(*this, "sample_property", "def_val")
+
     {
         add_pad(sinkpad = Gst::Pad::create(get_pad_template("sink"), "sink"));
         add_pad(srcpad = Gst::Pad::create(get_pad_template("src"), "src"));
diff --git a/tests/plugins/test-plugin-register.cc b/tests/plugins/test-plugin-register.cc
index 4fb0104..7702398 100644
--- a/tests/plugins/test-plugin-register.cc
+++ b/tests/plugins/test-plugin-register.cc
@@ -54,6 +54,20 @@ TEST_F(RegisterPluginTest, CreateRegisteredElement)
     ASSERT_TRUE(filter);
 }
 
+TEST_F(RegisterPluginTest, CheckPropertyUsage)
+{
+    filter = Gst::ElementFactory::create_element("foomm", "filter");
+
+    Glib::ustring property_value;
+    filter->get_property("sample_property", property_value);
+    ASSERT_STREQ("def_val", property_value.c_str());
+
+    Glib::ustring expected_property_value = "second_property_test";
+    filter->set_property("sample_property", expected_property_value);
+    filter->get_property("sample_property", property_value);
+    ASSERT_STREQ(expected_property_value.c_str(), property_value.c_str());
+}
+
 TEST_F(RegisterPluginTest, CreatePipelineWithRegisteredElement)
 {
     CreatePipelineWithElements();


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