mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 15:56:42 +00:00
tests: start a new test suite for element factories
Move one test from gstelement suite.
This commit is contained in:
parent
8aa3f380a5
commit
b6e2c69134
4 changed files with 87 additions and 47 deletions
|
@ -59,6 +59,7 @@ REGISTRY_CHECKS = \
|
||||||
gst/gstbin \
|
gst/gstbin \
|
||||||
gst/gstchildproxy \
|
gst/gstchildproxy \
|
||||||
gst/gstelement \
|
gst/gstelement \
|
||||||
|
gst/gstelementfactory \
|
||||||
gst/gstevent \
|
gst/gstevent \
|
||||||
gst/gstghostpad \
|
gst/gstghostpad \
|
||||||
gst/gstindex \
|
gst/gstindex \
|
||||||
|
@ -125,12 +126,12 @@ check_PROGRAMS = \
|
||||||
libs/bytewriter \
|
libs/bytewriter \
|
||||||
libs/gstnetclientclock \
|
libs/gstnetclientclock \
|
||||||
libs/gstnettimeprovider \
|
libs/gstnettimeprovider \
|
||||||
libs/transform1
|
libs/transform1
|
||||||
|
|
||||||
# failing tests
|
# failing tests
|
||||||
noinst_PROGRAMS = \
|
noinst_PROGRAMS = \
|
||||||
gst/gstpipeline \
|
gst/gstpipeline \
|
||||||
libs/collectpads
|
libs/collectpads
|
||||||
|
|
||||||
# elements to ignore for the state tests
|
# elements to ignore for the state tests
|
||||||
# STATE_IGNORE_ELEMENTS =
|
# STATE_IGNORE_ELEMENTS =
|
||||||
|
@ -162,7 +163,7 @@ AM_CXXFLAGS = $(GST_OBJ_CXXFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS
|
||||||
LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
|
LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
|
||||||
$(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \
|
$(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \
|
||||||
$(GST_OBJ_LIBS)
|
$(GST_OBJ_LIBS)
|
||||||
|
|
||||||
gst_gstcpp_SOURCES = gst/gstcpp.cc
|
gst_gstcpp_SOURCES = gst/gstcpp.cc
|
||||||
|
|
||||||
gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS)
|
gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS)
|
||||||
|
|
1
tests/check/gst/.gitignore
vendored
1
tests/check/gst/.gitignore
vendored
|
@ -12,6 +12,7 @@ gstcpp
|
||||||
gstdata
|
gstdata
|
||||||
gstdatetime
|
gstdatetime
|
||||||
gstelement
|
gstelement
|
||||||
|
gstelementfactory
|
||||||
gstevent
|
gstevent
|
||||||
gstghostpad
|
gstghostpad
|
||||||
gstiterator
|
gstiterator
|
||||||
|
|
|
@ -164,49 +164,6 @@ GST_START_TEST (test_link_no_pads)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
/* check if the elementfactory of a class is filled (see #131079) */
|
|
||||||
GST_START_TEST (test_class)
|
|
||||||
{
|
|
||||||
GstElementClass *klass;
|
|
||||||
GstElementFactory *factory, *tmp;
|
|
||||||
GType type;
|
|
||||||
|
|
||||||
GST_DEBUG ("finding factory for queue");
|
|
||||||
factory = gst_element_factory_find ("queue");
|
|
||||||
fail_if (factory == NULL);
|
|
||||||
|
|
||||||
/* it may already be loaded if check is being run with CK_FORK=no */
|
|
||||||
if (!GST_PLUGIN_FEATURE (factory)->loaded) {
|
|
||||||
GST_DEBUG ("getting the type");
|
|
||||||
/* feature is not loaded, should return 0 as the type */
|
|
||||||
type = gst_element_factory_get_element_type (factory);
|
|
||||||
fail_if (type != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG ("now loading the plugin");
|
|
||||||
tmp =
|
|
||||||
GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
|
|
||||||
(factory)));
|
|
||||||
fail_if (tmp == NULL);
|
|
||||||
|
|
||||||
gst_object_unref (factory);
|
|
||||||
factory = tmp;
|
|
||||||
|
|
||||||
/* feature is now loaded */
|
|
||||||
type = gst_element_factory_get_element_type (factory);
|
|
||||||
fail_if (type == 0);
|
|
||||||
|
|
||||||
klass = g_type_class_ref (factory->type);
|
|
||||||
fail_if (klass == NULL);
|
|
||||||
|
|
||||||
GST_DEBUG ("checking the element factory class field");
|
|
||||||
/* and elementfactory is filled in */
|
|
||||||
fail_if (klass->elementfactory == NULL);
|
|
||||||
fail_if (klass->elementfactory != factory);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_END_TEST;
|
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
gst_element_suite (void)
|
gst_element_suite (void)
|
||||||
|
@ -220,7 +177,6 @@ gst_element_suite (void)
|
||||||
tcase_add_test (tc_chain, test_error_no_bus);
|
tcase_add_test (tc_chain, test_error_no_bus);
|
||||||
tcase_add_test (tc_chain, test_link);
|
tcase_add_test (tc_chain, test_link);
|
||||||
tcase_add_test (tc_chain, test_link_no_pads);
|
tcase_add_test (tc_chain, test_link_no_pads);
|
||||||
tcase_add_test (tc_chain, test_class);
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
82
tests/check/gst/gstelementfactory.c
Normal file
82
tests/check/gst/gstelementfactory.c
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) 2011 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
*
|
||||||
|
* gstelementfactory.c: Unit test for GstElementFactory
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* check if the elementfactory of a class is filled (see #131079) */
|
||||||
|
GST_START_TEST (test_class)
|
||||||
|
{
|
||||||
|
GstElementClass *klass;
|
||||||
|
GstElementFactory *factory, *tmp;
|
||||||
|
GType type;
|
||||||
|
|
||||||
|
GST_DEBUG ("finding factory for queue");
|
||||||
|
factory = gst_element_factory_find ("queue");
|
||||||
|
fail_if (factory == NULL);
|
||||||
|
|
||||||
|
/* it may already be loaded if check is being run with CK_FORK=no */
|
||||||
|
if (!GST_PLUGIN_FEATURE (factory)->loaded) {
|
||||||
|
GST_DEBUG ("getting the type");
|
||||||
|
/* feature is not loaded, should return 0 as the type */
|
||||||
|
type = gst_element_factory_get_element_type (factory);
|
||||||
|
fail_if (type != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_DEBUG ("now loading the plugin");
|
||||||
|
tmp =
|
||||||
|
GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
|
||||||
|
(factory)));
|
||||||
|
fail_if (tmp == NULL);
|
||||||
|
|
||||||
|
gst_object_unref (factory);
|
||||||
|
factory = tmp;
|
||||||
|
|
||||||
|
/* feature is now loaded */
|
||||||
|
type = gst_element_factory_get_element_type (factory);
|
||||||
|
fail_if (type == 0);
|
||||||
|
|
||||||
|
klass = g_type_class_ref (factory->type);
|
||||||
|
fail_if (klass == NULL);
|
||||||
|
|
||||||
|
GST_DEBUG ("checking the element factory class field");
|
||||||
|
/* and elementfactory is filled in */
|
||||||
|
fail_if (klass->elementfactory == NULL);
|
||||||
|
fail_if (klass->elementfactory != factory);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
|
||||||
|
static Suite *
|
||||||
|
gst_element_factory_suite (void)
|
||||||
|
{
|
||||||
|
Suite *s = suite_create ("GstElementFactory");
|
||||||
|
TCase *tc_chain = tcase_create ("element-factory tests");
|
||||||
|
|
||||||
|
suite_add_tcase (s, tc_chain);
|
||||||
|
tcase_add_test (tc_chain, test_class);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_CHECK_MAIN (gst_element_factory);
|
Loading…
Reference in a new issue