testsuite/registry.py: Add some basic tests
authorJohan Dahlin <johan@gnome.org>
Thu, 15 Jul 2004 10:15:18 +0000 (10:15 +0000)
committerJohan Dahlin <johan@gnome.org>
Thu, 15 Jul 2004 10:15:18 +0000 (10:15 +0000)
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
gst/gst-types.defs
gst/gst.override
testsuite/registry.py [new file with mode: 0644]
testsuite/test_registry.py [new file with mode: 0644]

index 738af87..ee6d4b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
 
index 0ff429b..346f8ae 100644 (file)
    '("gchar*" "message"))
 )
 
+(define-boxed Plugin
+  (in-module "Gst")
+  (parent "GObject")
+  (c-name "GstPlugin")
+  (gtype-id "GST_TYPE_PLUGIN")
+)
 
 (define-boxed Structure
   (in-module "Gst")
index f1a3ad8..f8d69d3 100644 (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;
+}
diff --git a/testsuite/registry.py b/testsuite/registry.py
new file mode 100644 (file)
index 0000000..aebc273
--- /dev/null
@@ -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 (file)
index 0000000..aebc273
--- /dev/null
@@ -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()