2004-06-10 18:14:22 +00:00
|
|
|
import sys
|
|
|
|
from common import gst, unittest
|
|
|
|
|
|
|
|
class CapsTest(unittest.TestCase):
|
2004-08-06 17:38:42 +00:00
|
|
|
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)
|
2004-06-10 18:14:22 +00:00
|
|
|
def testCapsMime(self):
|
2004-08-06 17:38:42 +00:00
|
|
|
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]
|
2004-06-10 18:14:22 +00:00
|
|
|
mime = structure.get_name()
|
|
|
|
assert mime == 'video/x-raw-yuv'
|
2004-08-06 17:38:42 +00:00
|
|
|
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
|
2004-06-10 18:14:22 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|