Don't use gst.Element

Original commit message from CVS:
Don't use gst.Element
This commit is contained in:
Johan Dahlin 2004-10-11 08:47:37 +00:00
parent 01b4bd0ab5
commit f4d7a870ef
4 changed files with 6 additions and 34 deletions

View file

@ -9,17 +9,7 @@ class ElementTest(unittest.TestCase):
name = 'fakesink' name = 'fakesink'
alias = 'sink' alias = 'sink'
def testBadConstruct(self):
self.assertRaises(TypeError, gst.Element)
self.assertRaises(TypeError, gst.Element, None)
def testGoodConstructor(self): def testGoodConstructor(self):
element = gst.Element(self.name, self.alias)
assert element is not None, 'element is None'
assert isinstance(element, gst.Element)
assert element.get_name() == self.alias
def testGoodConstructor2(self):
element = gst.element_factory_make(self.name, self.alias) element = gst.element_factory_make(self.name, self.alias)
assert element is not None, 'element is None' assert element is not None, 'element is None'
assert isinstance(element, gst.Element) assert isinstance(element, gst.Element)
@ -37,7 +27,7 @@ class FakeSinkTest(ElementTest):
name = 'fakesink' name = 'fakesink'
alias = 'sink' alias = 'sink'
def setUp(self): def setUp(self):
self.element = gst.Element('fakesink', 'sink') self.element = gst.element_factory_make('fakesink', 'sink')
def checkError(self, old_state, state, name): def checkError(self, old_state, state, name):
assert self.element.get_state() == gst.STATE_NULL assert self.element.get_state() == gst.STATE_NULL
@ -164,9 +154,5 @@ class QueueTest(unittest.TestCase):
assert isinstance(queue, gst.Queue) assert isinstance(queue, gst.Queue)
assert queue.get_name() == 'queue0' assert queue.get_name() == 'queue0'
#queue = gst.Element('queue')
#assert isinstance(queue, gst.Queue)
#assert queue.get_name() == 'queue0'
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View file

@ -17,9 +17,9 @@ class ThreadConstructor(unittest.TestCase):
class Pipeline(unittest.TestCase): class Pipeline(unittest.TestCase):
def setUp(self): def setUp(self):
self.pipeline = gst.Pipeline('test-pipeline') self.pipeline = gst.Pipeline('test-pipeline')
source = gst.Element('fakesrc', 'source') source = gst.element_factory_make('fakesrc', 'source')
source.set_property('num-buffers', 5) source.set_property('num-buffers', 5)
sink = gst.Element('fakesink', 'sink') sink = gst.element_factory_make('fakesink', 'sink')
self.pipeline.add_many(source, sink) self.pipeline.add_many(source, sink)
gst.element_link_many(source, sink) gst.element_link_many(source, sink)

View file

@ -9,17 +9,7 @@ class ElementTest(unittest.TestCase):
name = 'fakesink' name = 'fakesink'
alias = 'sink' alias = 'sink'
def testBadConstruct(self):
self.assertRaises(TypeError, gst.Element)
self.assertRaises(TypeError, gst.Element, None)
def testGoodConstructor(self): def testGoodConstructor(self):
element = gst.Element(self.name, self.alias)
assert element is not None, 'element is None'
assert isinstance(element, gst.Element)
assert element.get_name() == self.alias
def testGoodConstructor2(self):
element = gst.element_factory_make(self.name, self.alias) element = gst.element_factory_make(self.name, self.alias)
assert element is not None, 'element is None' assert element is not None, 'element is None'
assert isinstance(element, gst.Element) assert isinstance(element, gst.Element)
@ -37,7 +27,7 @@ class FakeSinkTest(ElementTest):
name = 'fakesink' name = 'fakesink'
alias = 'sink' alias = 'sink'
def setUp(self): def setUp(self):
self.element = gst.Element('fakesink', 'sink') self.element = gst.element_factory_make('fakesink', 'sink')
def checkError(self, old_state, state, name): def checkError(self, old_state, state, name):
assert self.element.get_state() == gst.STATE_NULL assert self.element.get_state() == gst.STATE_NULL
@ -164,9 +154,5 @@ class QueueTest(unittest.TestCase):
assert isinstance(queue, gst.Queue) assert isinstance(queue, gst.Queue)
assert queue.get_name() == 'queue0' assert queue.get_name() == 'queue0'
#queue = gst.Element('queue')
#assert isinstance(queue, gst.Queue)
#assert queue.get_name() == 'queue0'
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View file

@ -17,9 +17,9 @@ class ThreadConstructor(unittest.TestCase):
class Pipeline(unittest.TestCase): class Pipeline(unittest.TestCase):
def setUp(self): def setUp(self):
self.pipeline = gst.Pipeline('test-pipeline') self.pipeline = gst.Pipeline('test-pipeline')
source = gst.Element('fakesrc', 'source') source = gst.element_factory_make('fakesrc', 'source')
source.set_property('num-buffers', 5) source.set_property('num-buffers', 5)
sink = gst.Element('fakesink', 'sink') sink = gst.element_factory_make('fakesink', 'sink')
self.pipeline.add_many(source, sink) self.pipeline.add_many(source, sink)
gst.element_link_many(source, sink) gst.element_link_many(source, sink)