gstreamer: test: add tests for new element_factory api.

Stefan Kost ensonic at kemper.freedesktop.org
Wed Mar 9 05:49:20 PST 2011


Module: gstreamer
Branch: master
Commit: 7f49a9189afd2fa2bdaedd61bd2b5a37349af9c3
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=7f49a9189afd2fa2bdaedd61bd2b5a37349af9c3

Author: Stefan Kost <ensonic at users.sf.net>
Date:   Tue Mar  8 12:11:08 2011 +0200

test: add tests for new element_factory api.

---

 tests/check/gst/gstelementfactory.c |   44 +++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/tests/check/gst/gstelementfactory.c b/tests/check/gst/gstelementfactory.c
index 84a9570..25dcfd1 100644
--- a/tests/check/gst/gstelementfactory.c
+++ b/tests/check/gst/gstelementfactory.c
@@ -77,6 +77,48 @@ GST_START_TEST (test_create)
 
 GST_END_TEST;
 
+/* test if the factory can accept some caps */
+GST_START_TEST (test_can_sink_any_caps)
+{
+  GstElementFactory *factory;
+  GstCaps *caps;
+  gboolean res;
+
+  factory = setup_factory ();
+  fail_if (factory == NULL);
+
+  caps = gst_caps_new_simple ("audio/x-raw-int", NULL);
+  fail_if (caps == NULL);
+  res = gst_element_factory_can_sink_any_caps (factory, caps);
+  fail_if (!res);
+  gst_caps_unref (caps);
+
+  g_object_unref (factory);
+}
+
+GST_END_TEST;
+
+/* test if the factory is compabible with some caps */
+GST_START_TEST (test_can_sink_all_caps)
+{
+  GstElementFactory *factory;
+  GstCaps *caps;
+  gboolean res;
+
+  factory = setup_factory ();
+  fail_if (factory == NULL);
+
+  caps = gst_caps_new_simple ("audio/x-raw-int", NULL);
+  fail_if (caps == NULL);
+  res = gst_element_factory_can_sink_all_caps (factory, caps);
+  fail_if (res);
+  gst_caps_unref (caps);
+
+  g_object_unref (factory);
+}
+
+GST_END_TEST;
+
 /* check if the elementfactory of a class is filled (see #131079) */
 GST_START_TEST (test_class)
 {
@@ -131,6 +173,8 @@ gst_element_factory_suite (void)
   suite_add_tcase (s, tc_chain);
   tcase_add_test (tc_chain, test_class);
   tcase_add_test (tc_chain, test_create);
+  tcase_add_test (tc_chain, test_can_sink_any_caps);
+  tcase_add_test (tc_chain, test_can_sink_all_caps);
 
   return s;
 }



More information about the gstreamer-commits mailing list