mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
testsuite/element.py (QueryTest.testQuery): Another small test
Original commit message from CVS: * testsuite/element.py (QueryTest.testQuery): Another small test * gst/gst.override (_wrap_gst_element_query): Ditto (_wrap_gst_pad_convert): Ditto
This commit is contained in:
parent
0a37fd1928
commit
9165bf8c35
4 changed files with 45 additions and 5 deletions
|
@ -1,5 +1,10 @@
|
||||||
2004-07-13 Johan Dahlin <johan@gnome.org>
|
2004-07-13 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
|
* testsuite/element.py (QueryTest.testQuery): Another small test
|
||||||
|
|
||||||
|
* gst/gst.override (_wrap_gst_element_query): Ditto
|
||||||
|
(_wrap_gst_pad_convert): Ditto
|
||||||
|
|
||||||
* testsuite/event.py (EventFileSrcTest.setUp): Start the pipeline,
|
* testsuite/event.py (EventFileSrcTest.setUp): Start the pipeline,
|
||||||
so we don't get warnings when sending events
|
so we don't get warnings when sending events
|
||||||
(EventTest.setUp): Ditto.
|
(EventTest.setUp): Ditto.
|
||||||
|
|
|
@ -204,7 +204,12 @@ _wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||||
return NULL;
|
return NULL;
|
||||||
value = 0;
|
value = 0;
|
||||||
ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value);
|
ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value);
|
||||||
return Py_BuildValue("(bL)", ret, value);
|
if (!ret) {
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, "query could not be performed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PyInt_FromLong(value);
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
override gst_pad_convert kwargs
|
override gst_pad_convert kwargs
|
||||||
|
@ -222,7 +227,12 @@ _wrap_gst_pad_convert(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||||
src_value = PyLong_AsLongLong(src_value_obj);
|
src_value = PyLong_AsLongLong(src_value_obj);
|
||||||
dest_value = 0;
|
dest_value = 0;
|
||||||
ret = gst_pad_convert(GST_PAD(self->obj), src_format, src_value, &dest_format, &dest_value);
|
ret = gst_pad_convert(GST_PAD(self->obj), src_format, src_value, &dest_format, &dest_value);
|
||||||
return Py_BuildValue("(bL)", ret, dest_value);
|
if (!ret) {
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, "conversion could not be performed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PyInt_FromLong(dest_value);
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
override gst_element_convert kwargs
|
override gst_element_convert kwargs
|
||||||
|
@ -240,7 +250,12 @@ _wrap_gst_element_convert(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||||
src_value = PyLong_AsLongLong(src_value_obj);
|
src_value = PyLong_AsLongLong(src_value_obj);
|
||||||
dest_value = 0;
|
dest_value = 0;
|
||||||
ret = gst_element_convert(GST_ELEMENT(self->obj), src_format, src_value, &dest_format, &dest_value);
|
ret = gst_element_convert(GST_ELEMENT(self->obj), src_format, src_value, &dest_format, &dest_value);
|
||||||
return Py_BuildValue("(bL)", ret, dest_value);
|
if (!ret) {
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, "conversion could not be performed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PyInt_FromLong(dest_value);
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
override gst_element_link_many args
|
override gst_element_link_many args
|
||||||
|
|
|
@ -146,5 +146,15 @@ class ElementName(unittest.TestCase):
|
||||||
assert get_name(-1) == 'UNKNOWN!'
|
assert get_name(-1) == 'UNKNOWN!'
|
||||||
self.assertRaises(TypeError, get_name, '')
|
self.assertRaises(TypeError, get_name, '')
|
||||||
|
|
||||||
|
class QueryTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink')
|
||||||
|
self.element = self.pipeline.get_by_name('source')
|
||||||
|
|
||||||
|
def testQuery(self):
|
||||||
|
assert self.element.query(gst.QUERY_TOTAL, gst.FORMAT_BYTES) == -1
|
||||||
|
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0
|
||||||
|
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -146,5 +146,15 @@ class ElementName(unittest.TestCase):
|
||||||
assert get_name(-1) == 'UNKNOWN!'
|
assert get_name(-1) == 'UNKNOWN!'
|
||||||
self.assertRaises(TypeError, get_name, '')
|
self.assertRaises(TypeError, get_name, '')
|
||||||
|
|
||||||
|
class QueryTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink')
|
||||||
|
self.element = self.pipeline.get_by_name('source')
|
||||||
|
|
||||||
|
def testQuery(self):
|
||||||
|
assert self.element.query(gst.QUERY_TOTAL, gst.FORMAT_BYTES) == -1
|
||||||
|
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0
|
||||||
|
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in a new issue