testsuite/event.py (EventFileSrcTest.setUp): Start the pipeline, so we don't get warnings when sending events

Original commit message from CVS:
* testsuite/event.py (EventFileSrcTest.setUp): Start the pipeline,
so we don't get warnings when sending events
(EventTest.setUp): Ditto.

* testsuite/pad.py: New test, only testing simple pad queries so far.

* testsuite/Makefile.am (tests): Add missing tests

* gst/gst.override (_wrap_gst_pad_query): Raise RuntimeError if
the return value is False and only return the queried value.
This commit is contained in:
Johan Dahlin 2004-07-13 09:00:07 +00:00
parent 39381dbd87
commit 0a37fd1928
7 changed files with 61 additions and 5 deletions

View file

@ -1,3 +1,16 @@
2004-07-13 Johan Dahlin <johan@gnome.org>
* testsuite/event.py (EventFileSrcTest.setUp): Start the pipeline,
so we don't get warnings when sending events
(EventTest.setUp): Ditto.
* testsuite/pad.py: New test, only testing simple pad queries so far.
* testsuite/Makefile.am (tests): Add missing tests
* gst/gst.override (_wrap_gst_pad_query): Raise RuntimeError if
the return value is False and only return the queried value.
2004-07-02 David Schleef <ds@schleef.org>
* configure.ac: Correctly check for XML tools. Correctly set

2
common

@ -1 +1 @@
Subproject commit 1af22afdec71295108f882c828e08f10d8a3e94b
Subproject commit 8f16cd236828a8bb7be51696029e0e24b7a6c517

View file

@ -179,9 +179,15 @@ _wrap_gst_pad_query(PyGObject *self, PyObject *args, PyObject *kwargs)
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GstPad.query", kwlist, &type, &format))
return NULL;
value = 0;
ret = gst_pad_query(GST_PAD(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_element_query kwargs

View file

@ -1,9 +1,12 @@
tests = \
caps.py \
buffer.py \
caps.py \
common.py \
element.py \
interface.py \
pipeline.py
event.py \
interface.py \
pad.py \
pipeline.py
check-local:
@PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs $(PYTHON) $(srcdir)/runtests.py

View file

@ -6,6 +6,7 @@ class EventTest(unittest.TestCase):
def setUp(self):
pipeline = gst.parse_launch('fakesrc ! fakesink name=sink')
self.sink = pipeline.get_by_name('sink')
pipeline.set_state(gst.STATE_PLAYING)
def testEventEmpty(self):
event = gst.Event(gst.EVENT_EMPTY)
@ -26,6 +27,7 @@ class EventFileSrcTest(unittest.TestCase):
self.source = self.pipeline.get_by_name('source')
self.sink = self.pipeline.get_by_name('sink')
self.sink.connect('handoff', self.handoff_cb)
self.pipeline.set_state(gst.STATE_PLAYING)
def tearDown(self):
assert self.pipeline.set_state(gst.STATE_PLAYING)

16
testsuite/pad.py Normal file
View file

@ -0,0 +1,16 @@
from common import gst, unittest
class PadTest(unittest.TestCase):
def setUp(self):
self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink')
src = self.pipeline.get_by_name('source')
self.sink = src.get_pad('src')
def testQuery(self):
assert self.sink.query(gst.QUERY_TOTAL, gst.FORMAT_BYTES) == -1
assert self.sink.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0
assert self.sink.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0
if __name__ == "__main__":
unittest.main()

16
testsuite/test_pad.py Normal file
View file

@ -0,0 +1,16 @@
from common import gst, unittest
class PadTest(unittest.TestCase):
def setUp(self):
self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink')
src = self.pipeline.get_by_name('source')
self.sink = src.get_pad('src')
def testQuery(self):
assert self.sink.query(gst.QUERY_TOTAL, gst.FORMAT_BYTES) == -1
assert self.sink.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0
assert self.sink.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0
if __name__ == "__main__":
unittest.main()