Clean up error handling

Original commit message from CVS:
Clean up error handling
This commit is contained in:
Johan Dahlin 2004-07-15 14:57:48 +00:00
parent acefacc62c
commit ed111af937
2 changed files with 18 additions and 14 deletions

View file

@ -43,21 +43,23 @@ class FakeSinkTest(ElementTest):
assert self.element.get_state() == gst.STATE_NULL assert self.element.get_state() == gst.STATE_NULL
assert self.element.set_state(old_state) assert self.element.set_state(old_state)
assert self.element.get_state() == old_state assert self.element.get_state() == old_state
self.element.set_property('state-error', name) self.element.set_property('state-error', name)
def error_cb(element, source, error, debug): self.error = False
def error_cb(element, source, gerror, debug):
assert isinstance(element, gst.Element) assert isinstance(element, gst.Element)
assert element == self.element assert element == self.element
assert isinstance(source, gst.Element) assert isinstance(source, gst.Element)
assert source == self.element assert source == self.element
assert isinstance(error, gst.GError) assert isinstance(gerror, gst.GError)
self.error = True
self.element.connect('error', error_cb) self.element.connect('error', error_cb)
error_message = common.run_silent(self.element.set_state, state) common.run_silent(self.element.set_state, state)
assert self.error, 'error not set'
#assert error_message.find('ERROR') != -1
assert error_message.find('ERROR') != -1
self.element.get_state() == old_state, 'state changed' self.element.get_state() == old_state, 'state changed'
def testStateErrorNullReady(self): def testStateErrorNullReady(self):
self.checkError(gst.STATE_NULL, gst.STATE_READY, self.checkError(gst.STATE_NULL, gst.STATE_READY,
self.FAKESINK_STATE_ERROR_NULL_READY) self.FAKESINK_STATE_ERROR_NULL_READY)

View file

@ -43,21 +43,23 @@ class FakeSinkTest(ElementTest):
assert self.element.get_state() == gst.STATE_NULL assert self.element.get_state() == gst.STATE_NULL
assert self.element.set_state(old_state) assert self.element.set_state(old_state)
assert self.element.get_state() == old_state assert self.element.get_state() == old_state
self.element.set_property('state-error', name) self.element.set_property('state-error', name)
def error_cb(element, source, error, debug): self.error = False
def error_cb(element, source, gerror, debug):
assert isinstance(element, gst.Element) assert isinstance(element, gst.Element)
assert element == self.element assert element == self.element
assert isinstance(source, gst.Element) assert isinstance(source, gst.Element)
assert source == self.element assert source == self.element
assert isinstance(error, gst.GError) assert isinstance(gerror, gst.GError)
self.error = True
self.element.connect('error', error_cb) self.element.connect('error', error_cb)
error_message = common.run_silent(self.element.set_state, state) common.run_silent(self.element.set_state, state)
assert self.error, 'error not set'
#assert error_message.find('ERROR') != -1
assert error_message.find('ERROR') != -1
self.element.get_state() == old_state, 'state changed' self.element.get_state() == old_state, 'state changed'
def testStateErrorNullReady(self): def testStateErrorNullReady(self):
self.checkError(gst.STATE_NULL, gst.STATE_READY, self.checkError(gst.STATE_NULL, gst.STATE_READY,
self.FAKESINK_STATE_ERROR_NULL_READY) self.FAKESINK_STATE_ERROR_NULL_READY)