mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
testsuite/*: Put test_ prefix on all test filenames
Original commit message from CVS: testsuite/*: Put test_ prefix on all test filenames
This commit is contained in:
parent
b9f4f5e5f7
commit
b70d9b6d4c
10 changed files with 13 additions and 494 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2004-11-23 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
|
* testsuite/*: Put test_ prefix on all test filenames
|
||||||
|
|
||||||
2004-11-23 Johan Dahlin <johan@gnome.org>
|
2004-11-23 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
* gst/gstmodule.c: sink GstObject, much like GtkObject
|
* gst/gstmodule.c: sink GstObject, much like GtkObject
|
||||||
|
|
|
@ -18,19 +18,20 @@ testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
|
||||||
$(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
|
$(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
|
||||||
|
|
||||||
tests = \
|
tests = \
|
||||||
buffer.py \
|
test_buffer.py \
|
||||||
caps.py \
|
test_caps.py \
|
||||||
common.py \
|
test_element.py \
|
||||||
element.py \
|
|
||||||
test_event.py \
|
test_event.py \
|
||||||
interface.py \
|
test_interface.py \
|
||||||
pad.py \
|
test_pad.py \
|
||||||
pipeline.py \
|
test_pipeline.py \
|
||||||
|
test_registry.py \
|
||||||
|
test_struct.py \
|
||||||
test_xml.py
|
test_xml.py
|
||||||
|
|
||||||
check-local: testhelper.la
|
check-local: testhelper.la
|
||||||
@PYTHONPATH=$(PYTHONPATH):$(top_builddir):$(top_builddir)/gst/.libs $(PYTHON) $(srcdir)/runtests.py
|
@PYTHONPATH=$(PYTHONPATH):$(top_builddir):$(top_builddir)/gst/.libs $(PYTHON) $(srcdir)/runtests.py
|
||||||
@rm -fr *.pyc
|
@rm -fr *.pyc
|
||||||
|
|
||||||
EXTRA_DIST = $(tests) runtests.py test-object.h
|
EXTRA_DIST = $(tests) common.py runtests.py test-object.h
|
||||||
|
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
import sys
|
|
||||||
from common import gst, unittest
|
|
||||||
|
|
||||||
class BufferTest(unittest.TestCase):
|
|
||||||
def testBufferBuffer(self):
|
|
||||||
buf = gst.Buffer('test')
|
|
||||||
assert str(buffer(buf)) == 'test'
|
|
||||||
|
|
||||||
def testBufferStr(self):
|
|
||||||
buffer = gst.Buffer('test')
|
|
||||||
assert str(buffer) == 'test'
|
|
||||||
|
|
||||||
def testBufferBadConstructor(self):
|
|
||||||
self.assertRaises(TypeError, gst.Buffer, 'test', 0)
|
|
||||||
|
|
||||||
def testBufferStrNull(self):
|
|
||||||
test_string = 't\0e\0s\0t\0'
|
|
||||||
buffer = gst.Buffer(test_string)
|
|
||||||
assert str(buffer) == test_string
|
|
||||||
|
|
||||||
def testBufferSize(self):
|
|
||||||
test_string = 'a little string'
|
|
||||||
buffer = gst.Buffer(test_string)
|
|
||||||
assert len(buffer) == len(test_string)
|
|
||||||
#assert hasattr(buffer, 'size')
|
|
||||||
#assert buffer.size == len(buffer)
|
|
||||||
|
|
||||||
def testBufferMaxSize(self):
|
|
||||||
buffer = gst.Buffer(buffer_size=16)
|
|
||||||
assert hasattr(buffer, 'maxsize')
|
|
||||||
assert buffer.maxsize == 16
|
|
||||||
|
|
||||||
def testBufferCreateSub(self):
|
|
||||||
s = ''
|
|
||||||
for i in range(64):
|
|
||||||
s += '%02d' % i
|
|
||||||
|
|
||||||
buffer = gst.Buffer(s)
|
|
||||||
assert len(buffer) == 128
|
|
||||||
|
|
||||||
sub = buffer.create_sub(16, 16)
|
|
||||||
assert sub.maxsize == 16
|
|
||||||
assert sub.offset == -1, sub.offset
|
|
||||||
|
|
||||||
def testBufferMerge(self):
|
|
||||||
buffer1 = gst.Buffer('foo')
|
|
||||||
buffer2 = gst.Buffer('bar')
|
|
||||||
|
|
||||||
merged_buffer = buffer1.merge(buffer2)
|
|
||||||
assert str(merged_buffer) == 'foobar'
|
|
||||||
|
|
||||||
def testBufferJoin(self):
|
|
||||||
buffer1 = gst.Buffer('foo')
|
|
||||||
buffer2 = gst.Buffer('bar')
|
|
||||||
|
|
||||||
joined_buffer = buffer1.merge(buffer2)
|
|
||||||
assert str(joined_buffer) == 'foobar'
|
|
||||||
|
|
||||||
def testBufferSpan(self):
|
|
||||||
buffer1 = gst.Buffer('foo')
|
|
||||||
buffer2 = gst.Buffer('bar')
|
|
||||||
|
|
||||||
spaned_buffer = buffer1.span(0L, buffer2, 6L)
|
|
||||||
assert str(spaned_buffer) == 'foobar'
|
|
||||||
|
|
||||||
def testBufferFlagIsSet(self):
|
|
||||||
buffer = gst.Buffer()
|
|
||||||
# Off by default
|
|
||||||
assert not buffer.flag_is_set(gst.BUFFER_READONLY)
|
|
||||||
|
|
||||||
# Try switching on and off
|
|
||||||
buffer.flag_set(gst.BUFFER_READONLY)
|
|
||||||
assert buffer.flag_is_set(gst.BUFFER_READONLY)
|
|
||||||
buffer.flag_unset(gst.BUFFER_READONLY)
|
|
||||||
assert not buffer.flag_is_set(gst.BUFFER_READONLY)
|
|
||||||
|
|
||||||
# Try switching on and off
|
|
||||||
buffer.flag_set(gst.BUFFER_IN_CAPS)
|
|
||||||
assert buffer.flag_is_set(gst.BUFFER_IN_CAPS)
|
|
||||||
buffer.flag_unset(gst.BUFFER_IN_CAPS)
|
|
||||||
assert not buffer.flag_is_set(gst.BUFFER_IN_CAPS)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
|
@ -1,85 +0,0 @@
|
||||||
import sys
|
|
||||||
from common import gst, unittest
|
|
||||||
|
|
||||||
class CapsTest(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.caps = gst.caps_from_string('video/x-raw-yuv,width=10,framerate=5.0;video/x-raw-rgb,width=15,framerate=10.0')
|
|
||||||
self.structure = self.caps.get_structure(0)
|
|
||||||
|
|
||||||
def testCapsMime(self):
|
|
||||||
mime = self.structure.get_name()
|
|
||||||
assert mime == 'video/x-raw-yuv'
|
|
||||||
|
|
||||||
def testCapsList(self):
|
|
||||||
'check if we can access Caps as a list'
|
|
||||||
structure = self.caps[0]
|
|
||||||
mime = structure.get_name()
|
|
||||||
assert mime == 'video/x-raw-yuv'
|
|
||||||
structure = self.caps[1]
|
|
||||||
mime = structure.get_name()
|
|
||||||
assert mime == 'video/x-raw-rgb'
|
|
||||||
|
|
||||||
def testCapsConstructEmpty(self):
|
|
||||||
caps = gst.Caps()
|
|
||||||
assert isinstance(caps, gst.Caps)
|
|
||||||
|
|
||||||
def testCapsConstructFromString(self):
|
|
||||||
caps = gst.Caps('video/x-raw-yuv,width=10')
|
|
||||||
assert isinstance(caps, gst.Caps)
|
|
||||||
assert len(caps) == 1
|
|
||||||
assert isinstance(caps[0], gst.Structure)
|
|
||||||
assert caps[0].get_name() == 'video/x-raw-yuv'
|
|
||||||
assert isinstance(caps[0]['width'], int)
|
|
||||||
assert caps[0]['width'] == 10
|
|
||||||
|
|
||||||
def testCapsConstructFromStructure(self):
|
|
||||||
struct = gst.structure_from_string('video/x-raw-yuv,width=10')
|
|
||||||
caps = gst.Caps(struct)
|
|
||||||
assert isinstance(caps, gst.Caps)
|
|
||||||
assert len(caps) == 1
|
|
||||||
assert isinstance(caps[0], gst.Structure)
|
|
||||||
assert caps[0].get_name() == 'video/x-raw-yuv'
|
|
||||||
assert isinstance(caps[0]['width'], int)
|
|
||||||
assert caps[0]['width'] == 10
|
|
||||||
|
|
||||||
def testCapsConstructFromStructures(self):
|
|
||||||
struct1 = gst.structure_from_string('video/x-raw-yuv,width=10')
|
|
||||||
struct2 = gst.structure_from_string('video/x-raw-rgb,height=20.0')
|
|
||||||
caps = gst.Caps(struct1, struct2)
|
|
||||||
assert isinstance(caps, gst.Caps)
|
|
||||||
assert len(caps) == 2
|
|
||||||
struct = caps[0]
|
|
||||||
assert isinstance(struct, gst.Structure), struct
|
|
||||||
assert struct.get_name() == 'video/x-raw-yuv', struct.get_name()
|
|
||||||
assert struct.has_key('width')
|
|
||||||
assert isinstance(struct['width'], int)
|
|
||||||
assert struct['width'] == 10
|
|
||||||
struct = caps[1]
|
|
||||||
assert isinstance(struct, gst.Structure), struct
|
|
||||||
assert struct.get_name() == 'video/x-raw-rgb', struct.get_name()
|
|
||||||
assert struct.has_key('height')
|
|
||||||
assert isinstance(struct['height'], float)
|
|
||||||
assert struct['height'] == 20.0
|
|
||||||
|
|
||||||
def testCapsStructureChange(self):
|
|
||||||
'test if changing the structure of the caps works by reference'
|
|
||||||
assert self.structure['width'] == 10
|
|
||||||
self.structure['width'] = 5
|
|
||||||
assert self.structure['width'] == 5.0
|
|
||||||
# check if we changed the caps as well
|
|
||||||
structure = self.caps[0]
|
|
||||||
assert structure['width'] == 5.0
|
|
||||||
|
|
||||||
def testCapsBadConstructor(self):
|
|
||||||
struct = gst.structure_from_string('video/x-raw-yuv,width=10')
|
|
||||||
self.assertRaises(TypeError, gst.Caps, None)
|
|
||||||
self.assertRaises(TypeError, gst.Caps, 1)
|
|
||||||
self.assertRaises(TypeError, gst.Caps, 2.0)
|
|
||||||
self.assertRaises(TypeError, gst.Caps, object)
|
|
||||||
self.assertRaises(TypeError, gst.Caps, 1, 2, 3)
|
|
||||||
|
|
||||||
# This causes segfault!
|
|
||||||
#self.assertRaises(TypeError, gst.Caps, struct, 10, None)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
|
@ -1,158 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
#
|
|
||||||
# testsuite for gstreamer.Element
|
|
||||||
|
|
||||||
import common
|
|
||||||
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):
|
|
||||||
self.element = gst.element_factory_make('fakesink', 'sink')
|
|
||||||
|
|
||||||
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)
|
|
||||||
self.error = False
|
|
||||||
def error_cb(element, source, gerror, debug):
|
|
||||||
assert isinstance(element, gst.Element)
|
|
||||||
assert element == self.element
|
|
||||||
assert isinstance(source, gst.Element)
|
|
||||||
assert source == self.element
|
|
||||||
assert isinstance(gerror, gst.GError)
|
|
||||||
self.error = True
|
|
||||||
|
|
||||||
self.element.connect('error', error_cb)
|
|
||||||
common.run_silent(self.element.set_state, state)
|
|
||||||
assert self.error, 'error not set'
|
|
||||||
#assert error_message.find('ERROR') != -1
|
|
||||||
|
|
||||||
self.element.get_state() == old_state, 'state changed'
|
|
||||||
|
|
||||||
def testStateErrorNullReady(self):
|
|
||||||
self.checkError(gst.STATE_NULL, gst.STATE_READY,
|
|
||||||
self.FAKESINK_STATE_ERROR_NULL_READY)
|
|
||||||
|
|
||||||
def testStateErrorReadyPaused(self):
|
|
||||||
self.checkError(gst.STATE_READY, gst.STATE_PAUSED,
|
|
||||||
self.FAKESINK_STATE_ERROR_READY_PAUSED)
|
|
||||||
|
|
||||||
def testStateErrorPausedPlaying(self):
|
|
||||||
self.checkError(gst.STATE_PAUSED, gst.STATE_PLAYING,
|
|
||||||
self.FAKESINK_STATE_ERROR_PAUSED_PLAYING)
|
|
||||||
|
|
||||||
def testStateErrorPlayingPaused(self):
|
|
||||||
self.checkError(gst.STATE_PLAYING, gst.STATE_PAUSED,
|
|
||||||
self.FAKESINK_STATE_ERROR_PLAYING_PAUSED)
|
|
||||||
|
|
||||||
def testStateErrorPausedReady(self):
|
|
||||||
self.checkError(gst.STATE_PAUSED, gst.STATE_READY,
|
|
||||||
self.FAKESINK_STATE_ERROR_PAUSED_READY)
|
|
||||||
|
|
||||||
def testStateErrorReadyNull(self):
|
|
||||||
self.checkError(gst.STATE_READY, gst.STATE_NULL,
|
|
||||||
self.FAKESINK_STATE_ERROR_READY_NULL)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
def testStateChangeReadyPaused(self):
|
|
||||||
self.checkStateChange(gst.STATE_READY, gst.STATE_PAUSED)
|
|
||||||
|
|
||||||
def testStateChangePausedPlaying(self):
|
|
||||||
self.checkStateChange(gst.STATE_PAUSED, gst.STATE_PLAYING)
|
|
||||||
|
|
||||||
def testStateChangePlayingPaused(self):
|
|
||||||
self.checkStateChange(gst.STATE_PLAYING, gst.STATE_PAUSED)
|
|
||||||
|
|
||||||
def testStateChangePausedReady(self):
|
|
||||||
self.checkStateChange(gst.STATE_PAUSED, gst.STATE_READY)
|
|
||||||
|
|
||||||
def testStateChangeReadyNull(self):
|
|
||||||
self.checkStateChange(gst.STATE_READY, gst.STATE_NULL)
|
|
||||||
|
|
||||||
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'
|
|
||||||
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
|
|
||||||
|
|
||||||
class QueueTest(unittest.TestCase):
|
|
||||||
def testConstruct(self):
|
|
||||||
queue = gst.element_factory_make('queue')
|
|
||||||
assert isinstance(queue, gst.Queue)
|
|
||||||
assert queue.get_name() == 'queue0'
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
|
@ -1,22 +0,0 @@
|
||||||
from common import gst, unittest
|
|
||||||
|
|
||||||
import gobject
|
|
||||||
|
|
||||||
class Availability(unittest.TestCase):
|
|
||||||
def testXOverlay(self):
|
|
||||||
assert hasattr(gst.interfaces, 'XOverlay')
|
|
||||||
assert issubclass(gst.interfaces.XOverlay, gobject.GInterface)
|
|
||||||
|
|
||||||
def testMixer(self):
|
|
||||||
assert hasattr(gst.interfaces, 'Mixer')
|
|
||||||
assert issubclass(gst.interfaces.Mixer, gobject.GInterface)
|
|
||||||
|
|
||||||
class FunctionCall(unittest.TestCase):
|
|
||||||
def testXOverlay(self):
|
|
||||||
element = gst.element_factory_make('xvimagesink')
|
|
||||||
assert isinstance(element, gst.Element)
|
|
||||||
assert isinstance(element, gst.interfaces.XOverlay)
|
|
||||||
element.set_xwindow_id(0L)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
|
@ -1,16 +0,0 @@
|
||||||
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()
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
from common import gst, unittest
|
|
||||||
|
|
||||||
class PipelineConstructor(unittest.TestCase):
|
|
||||||
def testGoodConstructor(self):
|
|
||||||
name = 'test-pipeline'
|
|
||||||
pipeline = gst.Pipeline(name)
|
|
||||||
assert pipeline is not None, 'pipeline is None'
|
|
||||||
assert isinstance(pipeline, gst.Pipeline), 'pipeline is not a GstPipline'
|
|
||||||
assert pipeline.get_name() == name, 'pipelines name is wrong'
|
|
||||||
|
|
||||||
class ThreadConstructor(unittest.TestCase):
|
|
||||||
def testCreate(self):
|
|
||||||
thread = gst.Thread('test-thread')
|
|
||||||
assert thread is not None, 'thread is None'
|
|
||||||
assert isinstance(thread, gst.Thread)
|
|
||||||
|
|
||||||
class Pipeline(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.pipeline = gst.Pipeline('test-pipeline')
|
|
||||||
source = gst.element_factory_make('fakesrc', 'source')
|
|
||||||
source.set_property('num-buffers', 5)
|
|
||||||
sink = gst.element_factory_make('fakesink', 'sink')
|
|
||||||
self.pipeline.add_many(source, sink)
|
|
||||||
gst.element_link_many(source, sink)
|
|
||||||
|
|
||||||
def testRun(self):
|
|
||||||
self.assertEqual(self.pipeline.get_state(), gst.STATE_NULL)
|
|
||||||
self.pipeline.set_state(gst.STATE_PLAYING)
|
|
||||||
self.assertEqual(self.pipeline.get_state(), gst.STATE_PLAYING)
|
|
||||||
|
|
||||||
while self.pipeline.iterate():
|
|
||||||
pass
|
|
||||||
|
|
||||||
self.assertEqual(self.pipeline.get_state(), gst.STATE_PAUSED)
|
|
||||||
self.pipeline.set_state(gst.STATE_NULL)
|
|
||||||
self.assertEqual(self.pipeline.get_state(), gst.STATE_NULL)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
|
@ -1,16 +0,0 @@
|
||||||
import sys
|
|
||||||
from common import gst, unittest
|
|
||||||
|
|
||||||
class RegistryPoolTest(unittest.TestCase):
|
|
||||||
def testPluginList(self):
|
|
||||||
plugins = gst.registry_pool_plugin_list()
|
|
||||||
elements = map(lambda p: p.get_name(), plugins)
|
|
||||||
assert 'gstcoreelements' in elements
|
|
||||||
|
|
||||||
def testFeatureList(self):
|
|
||||||
plugins = gst.registry_pool_feature_list(gst.ElementFactory)
|
|
||||||
elements = map(lambda p: p.get_name(), plugins)
|
|
||||||
assert 'fakesink' in elements, elements
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
|
@ -1,66 +0,0 @@
|
||||||
import sys
|
|
||||||
from common import gst, unittest
|
|
||||||
|
|
||||||
class StructureTest(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.struct = gst.structure_from_string('video/x-raw-yuv,width=10,foo="bar",pixel-aspect-ratio=1/2,framerate=5.0')
|
|
||||||
|
|
||||||
#def foo(self):
|
|
||||||
# gst.structure_from_string("foo")
|
|
||||||
|
|
||||||
def testName(self):
|
|
||||||
assert self.struct.get_name() == 'video/x-raw-yuv'
|
|
||||||
self.struct.set_name('foobar')
|
|
||||||
assert self.struct.get_name() == 'foobar'
|
|
||||||
|
|
||||||
def testInt(self):
|
|
||||||
assert self.struct.has_key('width')
|
|
||||||
assert isinstance(self.struct['width'], int)
|
|
||||||
assert self.struct['width'] == 10, self.struct['width']
|
|
||||||
self.struct['width'] = 5
|
|
||||||
assert self.struct.has_key('width')
|
|
||||||
assert isinstance(self.struct['width'], int)
|
|
||||||
assert self.struct['width'] == 5, self.struct['width']
|
|
||||||
|
|
||||||
def testString(self):
|
|
||||||
assert self.struct.has_key('foo')
|
|
||||||
assert isinstance(self.struct['foo'], str)
|
|
||||||
assert self.struct['foo'] == 'bar', self.struct['foo']
|
|
||||||
self.struct['foo'] = 'baz'
|
|
||||||
assert self.struct.has_key('foo')
|
|
||||||
assert isinstance(self.struct['foo'], str)
|
|
||||||
assert self.struct['foo'] == 'baz', self.struct['foo']
|
|
||||||
|
|
||||||
def testCreateInt(self):
|
|
||||||
self.struct['integer'] = 5
|
|
||||||
assert self.struct.has_key('integer')
|
|
||||||
assert isinstance(self.struct['integer'], int)
|
|
||||||
assert self.struct['integer'] == 5, self.struct['integer']
|
|
||||||
|
|
||||||
def testCreateFourCC(self):
|
|
||||||
self.struct['fourcc'] = "(fourcc)XVID"
|
|
||||||
#assert self.struct.has_key('fourcc')
|
|
||||||
#print self.struct.to_string()
|
|
||||||
#assert isinstance(self.struct['fourcc'], int)
|
|
||||||
#assert self.struct['integer'] == 5, self.struct['integer']
|
|
||||||
|
|
||||||
def testStructureChange(self):
|
|
||||||
#assert structure['pixel-aspect-ratio'].numerator == 1
|
|
||||||
#assert structure['pixel-aspect-ratio'].denominator == 2
|
|
||||||
#assert float(structure['pixel-aspect-ratio']) == 0.5
|
|
||||||
#structure['pixel-aspect-ratio'] = gst.Fraction(3, 4)
|
|
||||||
#assert structure['pixel-aspect-ratio'].numerator == 3
|
|
||||||
#assert structure['pixel-aspect-ratio'].denominator == 4
|
|
||||||
#assert float(structure['pixel-aspect-ratio']) == 0.75
|
|
||||||
|
|
||||||
assert self.struct['framerate'] == 5.0
|
|
||||||
self.struct['framerate'] = 10.0
|
|
||||||
assert self.struct['framerate'] == 10.0
|
|
||||||
|
|
||||||
# a list of heights
|
|
||||||
#structure['height'] = (20, 40, 60)
|
|
||||||
#assert structure['width'] == (20, 40, 60)
|
|
||||||
# FIXME: add ranges
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
Loading…
Reference in a new issue