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
This commit is contained in:
Johan Dahlin 2004-07-15 10:15:18 +00:00
parent 4e37d3cd9a
commit acefacc62c
5 changed files with 95 additions and 1 deletions

View file

@ -1,5 +1,13 @@
2004-07-15 Johan Dahlin <johan@gnome.org>
* 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)

View file

@ -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")

View file

@ -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;
}

16
testsuite/registry.py Normal file
View file

@ -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()

View file

@ -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()