From acefacc62c9bb66d810521640615ef928f9dbad9 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Thu, 15 Jul 2004 10:15:18 +0000 Subject: [PATCH] testsuite/registry.py: Add some basic tests Original commit message from CVS: * testsuite/registry.py: Add some basic tests * gst/gst.override: Don't ignore all gst_registry_* symbols (_wrap_gst_registry_pool_plugin_list): Impl. (_wrap_gst_registry_pool_feature_list): Impl. * gst/gst-types.defs (Plugin): Add as a boxed --- ChangeLog | 8 ++++++ gst/gst-types.defs | 6 +++++ gst/gst.override | 50 +++++++++++++++++++++++++++++++++++++- testsuite/registry.py | 16 ++++++++++++ testsuite/test_registry.py | 16 ++++++++++++ 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 testsuite/registry.py create mode 100644 testsuite/test_registry.py diff --git a/ChangeLog b/ChangeLog index 738af87b06..ee6d4b3590 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-07-15 Johan Dahlin + * testsuite/registry.py: Add some basic tests + + * gst/gst.override: Don't ignore all gst_registry_* symbols + (_wrap_gst_registry_pool_plugin_list): Impl. + (_wrap_gst_registry_pool_feature_list): Impl. + + * gst/gst-types.defs (Plugin): Add as a boxed + * gst/__init__.py: Use DLFCN instead of dl to help python installations without the dl module (gentoo for instance) diff --git a/gst/gst-types.defs b/gst/gst-types.defs index 0ff429bf3d..346f8ae9ca 100644 --- a/gst/gst-types.defs +++ b/gst/gst-types.defs @@ -205,6 +205,12 @@ '("gchar*" "message")) ) +(define-boxed Plugin + (in-module "Gst") + (parent "GObject") + (c-name "GstPlugin") + (gtype-id "GST_TYPE_PLUGIN") +) (define-boxed Structure (in-module "Gst") diff --git a/gst/gst.override b/gst/gst.override index f1a3ad80fc..f8d69d3b1d 100644 --- a/gst/gst.override +++ b/gst/gst.override @@ -66,7 +66,6 @@ ignore-glob gst_debug_* gst_init* gst_interface_* - gst_registry_* gst_tag_list_get_* gst_value_* gst_xml_* @@ -911,3 +910,52 @@ _wrap_gst_element_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return _wrap_gst_element_factory_make(NULL, args, kwargs); } +%% +override gst_registry_pool_plugin_list noargs +static PyObject * +_wrap_gst_registry_pool_plugin_list(PyGObject *self) +{ + GList *l, *plugins; + PyObject *list; + + plugins = gst_registry_pool_plugin_list(); + + list = PyList_New(0); + for (l = plugins; l; l = l->next) { + GstPlugin *plugin = (GstPlugin*)l->data; + PyList_Append(list, + pyg_boxed_new(GST_TYPE_PLUGIN, plugin, TRUE, TRUE)); + } + g_list_free(plugins); + + return list; +} +%% +override gst_registry_pool_feature_list +static PyObject * +_wrap_gst_registry_pool_feature_list(PyGObject *self, PyObject *args) +{ + GList *l, *features; + PyObject *pygtype, *list; + GType gtype; + + if (!PyArg_ParseTuple(args, "O:registry_pool_feature_list", + &pygtype)) + return NULL; + + gtype = pyg_type_from_object (pygtype); + if (!gtype) + return NULL; + + features = gst_registry_pool_feature_list(gtype); + + list = PyList_New(0); + for (l = features; l; l = l->next) { + GstPluginFeature *feature = (GstPluginFeature*)l->data; + PyList_Append(list, pygobject_new (G_OBJECT (feature))); + + } + g_list_free(features); + + return list; +} diff --git a/testsuite/registry.py b/testsuite/registry.py new file mode 100644 index 0000000000..aebc2735bb --- /dev/null +++ b/testsuite/registry.py @@ -0,0 +1,16 @@ +import sys +from common import gst, unittest + +class RegistryPoolTest(unittest.TestCase): + def testPluginList(self): + plugins = gst.registry_pool_plugin_list() + elements = map(lambda p: p.get_name(), plugins) + assert 'gstcoreelements' in elements + + def testFeatureList(self): + plugins = gst.registry_pool_feature_list(gst.ElementFactory) + elements = map(lambda p: p.get_name(), plugins) + assert 'fakesink' in elements, elements + +if __name__ == "__main__": + unittest.main() diff --git a/testsuite/test_registry.py b/testsuite/test_registry.py new file mode 100644 index 0000000000..aebc2735bb --- /dev/null +++ b/testsuite/test_registry.py @@ -0,0 +1,16 @@ +import sys +from common import gst, unittest + +class RegistryPoolTest(unittest.TestCase): + def testPluginList(self): + plugins = gst.registry_pool_plugin_list() + elements = map(lambda p: p.get_name(), plugins) + assert 'gstcoreelements' in elements + + def testFeatureList(self): + plugins = gst.registry_pool_feature_list(gst.ElementFactory) + elements = map(lambda p: p.get_name(), plugins) + assert 'fakesink' in elements, elements + +if __name__ == "__main__": + unittest.main()