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)
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 testCapsConstructFromStructure(self): struct = gst.structure_from_string('video/x-raw-yuv,width=10,framerate=[0/1, 25/3]') 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 assert isinstance(caps[0]['framerate'], gst.FractionRange)
def setUp(self): TestCase.setUp(self) self.struct = gst.structure_from_string( 'video/x-raw-yuv,width=10,foo="bar",pixel-aspect-ratio=1/2,framerate=5/1,boolean=(boolean)true' )
def setUp(self): TestCase.setUp(self) self.struct = gst.structure_from_string('video/x-raw-yuv,width=10,foo="bar",pixel-aspect-ratio=1/2,framerate=5/1,boolean=(boolean)true')