mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +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>
|
||||
|
||||
* 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,
|
||||
so we don't get warnings when sending events
|
||||
(EventTest.setUp): Ditto.
|
||||
|
|
|
@ -204,7 +204,12 @@ _wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs)
|
|||
return NULL;
|
||||
value = 0;
|
||||
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
|
||||
|
@ -222,7 +227,12 @@ _wrap_gst_pad_convert(PyGObject *self, PyObject *args, PyObject *kwargs)
|
|||
src_value = PyLong_AsLongLong(src_value_obj);
|
||||
dest_value = 0;
|
||||
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
|
||||
|
@ -240,7 +250,12 @@ _wrap_gst_element_convert(PyGObject *self, PyObject *args, PyObject *kwargs)
|
|||
src_value = PyLong_AsLongLong(src_value_obj);
|
||||
dest_value = 0;
|
||||
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
|
||||
|
|
|
@ -114,7 +114,7 @@ class FakeSinkTest(ElementTest):
|
|||
|
||||
def testStateChangeReadyNull(self):
|
||||
self.checkStateChange(gst.STATE_READY, gst.STATE_NULL)
|
||||
|
||||
|
||||
class NonExistentTest(ElementTest):
|
||||
name = 'this-element-does-not-exist'
|
||||
alias = 'no-alias'
|
||||
|
@ -146,5 +146,15 @@ class ElementName(unittest.TestCase):
|
|||
assert get_name(-1) == 'UNKNOWN!'
|
||||
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__":
|
||||
unittest.main()
|
||||
|
|
|
@ -114,7 +114,7 @@ class FakeSinkTest(ElementTest):
|
|||
|
||||
def testStateChangeReadyNull(self):
|
||||
self.checkStateChange(gst.STATE_READY, gst.STATE_NULL)
|
||||
|
||||
|
||||
class NonExistentTest(ElementTest):
|
||||
name = 'this-element-does-not-exist'
|
||||
alias = 'no-alias'
|
||||
|
@ -146,5 +146,15 @@ class ElementName(unittest.TestCase):
|
|||
assert get_name(-1) == 'UNKNOWN!'
|
||||
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__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue