mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
two new tests, one that fails
Original commit message from CVS: two new tests, one that fails
This commit is contained in:
parent
3f630774bb
commit
45ba78cb85
3 changed files with 46 additions and 5 deletions
|
@ -2,11 +2,30 @@ import sys
|
||||||
from common import gst, unittest
|
from common import gst, unittest
|
||||||
|
|
||||||
class CapsTest(unittest.TestCase):
|
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):
|
def testCapsMime(self):
|
||||||
caps = gst.caps_from_string('video/x-raw-yuv,width=10,framerate=5.0')
|
mime = self.structure.get_name()
|
||||||
structure = caps.get_structure(0)
|
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()
|
mime = structure.get_name()
|
||||||
assert mime == 'video/x-raw-yuv'
|
assert mime == 'video/x-raw-yuv'
|
||||||
|
structure = self.caps[1]
|
||||||
|
mime = structure.get_name()
|
||||||
|
assert mime == 'video/x-raw-rgb'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -7,7 +7,10 @@ import pygtk
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
|
||||||
import gobject
|
import gobject
|
||||||
|
try:
|
||||||
gobject.threads_init()
|
gobject.threads_init()
|
||||||
|
except:
|
||||||
|
print "WARNING: gobject doesn't have threads_init, no threadsafety"
|
||||||
|
|
||||||
# Don't insert before .
|
# Don't insert before .
|
||||||
sys.path.insert(1, os.path.join('..'))
|
sys.path.insert(1, os.path.join('..'))
|
||||||
|
|
|
@ -2,11 +2,30 @@ import sys
|
||||||
from common import gst, unittest
|
from common import gst, unittest
|
||||||
|
|
||||||
class CapsTest(unittest.TestCase):
|
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):
|
def testCapsMime(self):
|
||||||
caps = gst.caps_from_string('video/x-raw-yuv,width=10,framerate=5.0')
|
mime = self.structure.get_name()
|
||||||
structure = caps.get_structure(0)
|
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()
|
mime = structure.get_name()
|
||||||
assert mime == 'video/x-raw-yuv'
|
assert mime == 'video/x-raw-yuv'
|
||||||
|
structure = self.caps[1]
|
||||||
|
mime = structure.get_name()
|
||||||
|
assert mime == 'video/x-raw-rgb'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in a new issue