2004-06-21 09:26:59 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
#
|
|
|
|
# testsuite for gstreamer.Element
|
|
|
|
|
|
|
|
from common import gst, unittest
|
|
|
|
|
|
|
|
class ElementTest(unittest.TestCase):
|
|
|
|
name = 'fakesink'
|
|
|
|
alias = 'sink'
|
|
|
|
|
|
|
|
def testGoodConstructor(self):
|
|
|
|
element = gst.element_factory_make(self.name, self.alias)
|
|
|
|
assert element is not None, 'element is None'
|
|
|
|
assert isinstance(element, gst.Element)
|
|
|
|
assert element.get_name() == self.alias
|
|
|
|
|
|
|
|
class FakeSinkTest(ElementTest):
|
|
|
|
FAKESINK_STATE_ERROR_NONE = "0"
|
|
|
|
FAKESINK_STATE_ERROR_NULL_READY, = "1"
|
|
|
|
FAKESINK_STATE_ERROR_READY_PAUSED, = "2"
|
|
|
|
FAKESINK_STATE_ERROR_PAUSED_PLAYING = "3"
|
|
|
|
FAKESINK_STATE_ERROR_PLAYING_PAUSED = "4"
|
|
|
|
FAKESINK_STATE_ERROR_PAUSED_READY = "5"
|
|
|
|
FAKESINK_STATE_ERROR_READY_NULL = "6"
|
|
|
|
|
|
|
|
name = 'fakesink'
|
|
|
|
alias = 'sink'
|
|
|
|
def setUp(self):
|
2004-10-11 08:47:37 +00:00
|
|
|
self.element = gst.element_factory_make('fakesink', 'sink')
|
2004-06-21 09:26:59 +00:00
|
|
|
|
|
|
|
def checkError(self, old_state, state, name):
|
|
|
|
assert self.element.get_state() == gst.STATE_NULL
|
|
|
|
assert self.element.set_state(old_state)
|
|
|
|
assert self.element.get_state() == old_state
|
|
|
|
self.element.set_property('state-error', name)
|
2004-07-15 14:57:48 +00:00
|
|
|
self.error = False
|
|
|
|
def error_cb(element, source, gerror, debug):
|
2004-06-21 09:26:59 +00:00
|
|
|
assert isinstance(element, gst.Element)
|
|
|
|
assert element == self.element
|
|
|
|
assert isinstance(source, gst.Element)
|
|
|
|
assert source == self.element
|
2004-07-15 14:57:48 +00:00
|
|
|
assert isinstance(gerror, gst.GError)
|
|
|
|
self.error = True
|
|
|
|
|
2004-06-21 09:26:59 +00:00
|
|
|
self.element.connect('error', error_cb)
|
2005-06-17 10:59:47 +00:00
|
|
|
self.element.set_state (state)
|
2004-07-15 14:57:48 +00:00
|
|
|
assert self.error, 'error not set'
|
|
|
|
#assert error_message.find('ERROR') != -1
|
2004-06-21 09:26:59 +00:00
|
|
|
|
|
|
|
self.element.get_state() == old_state, 'state changed'
|
2004-07-15 14:57:48 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateErrorNullReady(self):
|
|
|
|
## self.checkError(gst.STATE_NULL, gst.STATE_READY,
|
|
|
|
## self.FAKESINK_STATE_ERROR_NULL_READY)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateErrorReadyPaused(self):
|
|
|
|
## self.checkError(gst.STATE_READY, gst.STATE_PAUSED,
|
|
|
|
## self.FAKESINK_STATE_ERROR_READY_PAUSED)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateErrorPausedPlaying(self):
|
|
|
|
## self.checkError(gst.STATE_PAUSED, gst.STATE_PLAYING,
|
|
|
|
## self.FAKESINK_STATE_ERROR_PAUSED_PLAYING)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateErrorPlayingPaused(self):
|
|
|
|
## self.checkError(gst.STATE_PLAYING, gst.STATE_PAUSED,
|
|
|
|
## self.FAKESINK_STATE_ERROR_PLAYING_PAUSED)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateErrorPausedReady(self):
|
|
|
|
## self.checkError(gst.STATE_PAUSED, gst.STATE_READY,
|
|
|
|
## self.FAKESINK_STATE_ERROR_PAUSED_READY)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateErrorReadyNull(self):
|
|
|
|
## self.checkError(gst.STATE_READY, gst.STATE_NULL,
|
|
|
|
## self.FAKESINK_STATE_ERROR_READY_NULL)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
|
|
|
def checkStateChange(self, old, new):
|
|
|
|
def state_change_cb(element, old_s, new_s):
|
|
|
|
assert isinstance(element, gst.Element)
|
|
|
|
assert element == self.element
|
|
|
|
assert old_s == old
|
|
|
|
assert new_s == new
|
|
|
|
|
|
|
|
assert self.element.set_state(old)
|
|
|
|
assert self.element.get_state() == old
|
|
|
|
|
|
|
|
self.element.connect('state-change', state_change_cb)
|
|
|
|
|
|
|
|
assert self.element.set_state(new)
|
|
|
|
assert self.element.get_state() == new
|
|
|
|
|
|
|
|
def testStateChangeNullReady(self):
|
|
|
|
self.checkStateChange(gst.STATE_NULL, gst.STATE_READY)
|
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateChangeReadyPaused(self):
|
|
|
|
## self.checkStateChange(gst.STATE_READY, gst.STATE_PAUSED)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateChangePausedPlaying(self):
|
|
|
|
## self.checkStateChange(gst.STATE_PAUSED, gst.STATE_PLAYING)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateChangePlayingPaused(self):
|
|
|
|
## self.checkStateChange(gst.STATE_PLAYING, gst.STATE_PAUSED)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## def testStateChangePausedReady(self):
|
|
|
|
## self.checkStateChange(gst.STATE_PAUSED, gst.STATE_READY)
|
2004-06-21 09:26:59 +00:00
|
|
|
|
|
|
|
def testStateChangeReadyNull(self):
|
|
|
|
self.checkStateChange(gst.STATE_READY, gst.STATE_NULL)
|
2004-07-13 09:08:32 +00:00
|
|
|
|
2004-06-21 09:26:59 +00:00
|
|
|
class NonExistentTest(ElementTest):
|
|
|
|
name = 'this-element-does-not-exist'
|
|
|
|
alias = 'no-alias'
|
|
|
|
|
|
|
|
testGoodConstructor = lambda s: None
|
|
|
|
testGoodConstructor2 = lambda s: None
|
|
|
|
|
|
|
|
class FileSrcTest(ElementTest):
|
|
|
|
name = 'filesrc'
|
|
|
|
alias = 'source'
|
|
|
|
|
|
|
|
class FileSinkTest(ElementTest):
|
|
|
|
name = 'filesink'
|
|
|
|
alias = 'sink'
|
|
|
|
|
|
|
|
class ElementName(unittest.TestCase):
|
|
|
|
def testElementStateGetName(self):
|
|
|
|
get_name = gst.element_state_get_name
|
|
|
|
for state in ('NULL',
|
|
|
|
'READY',
|
|
|
|
'PLAYING',
|
|
|
|
'PAUSED'):
|
|
|
|
name = 'STATE_' + state
|
|
|
|
assert hasattr(gst, name)
|
|
|
|
attr = getattr(gst, name)
|
|
|
|
assert get_name(attr) == state
|
|
|
|
|
|
|
|
assert get_name(gst.STATE_VOID_PENDING) == 'NONE_PENDING'
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
assert get_name(-1) == 'UNKNOWN!(-1)'
|
2004-06-21 09:26:59 +00:00
|
|
|
self.assertRaises(TypeError, get_name, '')
|
|
|
|
|
2004-07-13 09:08:32 +00:00
|
|
|
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):
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
res = self.element.query_position(gst.FORMAT_BYTES)
|
|
|
|
assert res
|
|
|
|
assert res[0] == 0
|
|
|
|
assert res[1] == -1
|
|
|
|
res = self.element.query_position(gst.FORMAT_TIME)
|
|
|
|
assert not res
|
2004-07-13 09:08:32 +00:00
|
|
|
|
2004-08-30 10:42:36 +00:00
|
|
|
class QueueTest(unittest.TestCase):
|
|
|
|
def testConstruct(self):
|
|
|
|
queue = gst.element_factory_make('queue')
|
|
|
|
assert isinstance(queue, gst.Queue)
|
|
|
|
assert queue.get_name() == 'queue0'
|
|
|
|
|
2004-06-21 09:26:59 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|