MCPcopy Create free account
hub / github.com/GStreamer/gst-python / testAddPad

Method testAddPad

testsuite/old/test_pad.py:488–523  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

486
487class PadRefCountTest(TestCase):
488 def testAddPad(self):
489 # add a pad to an element
490 e = gst.element_factory_make('fakesrc')
491 self.assertEquals(sys.getrefcount(e), pygobject_2_13 and 2 or 3)
492 self.assertEquals(e.__gstrefcount__, 1)
493
494 gst.debug('creating pad with name mypad')
495 pad = gst.Pad("mypad", gst.PAD_SRC)
496 self.failUnless(pad)
497 self.assertEquals(sys.getrefcount(pad), pygobject_2_13 and 2 or 3)
498 self.assertEquals(pad.__gstrefcount__, 1)
499
500 gst.debug('adding pad to element')
501 e.add_pad(pad)
502 self.assertEquals(sys.getrefcount(e), pygobject_2_13 and 2 or 3)
503 self.assertEquals(e.__gstrefcount__, 1)
504 self.assertEquals(sys.getrefcount(pad), pygobject_2_13 and 2 or 3)
505 self.assertEquals(pad.__gstrefcount__, 2) # added to element
506
507 gst.debug('deleting element and collecting')
508 self.gccollect()
509 del e
510 if not pygobject_2_13:
511 # the element will be collected at 'del e' if we're using
512 # pygobject >= 2.13.0
513 self.assertEquals(self.gccollect(), 1) # collected the element
514 self.assertEquals(sys.getrefcount(pad), pygobject_2_13 and 2 or 3)
515 self.assertEquals(pad.__gstrefcount__, 1) # removed from element
516
517 gst.debug('deleting pad and collecting')
518 del pad
519 if not pygobject_2_13:
520 # the pad will be collected at 'del pad' if we're using
521 # pygobject >= 2.13.0
522 self.assertEquals(self.gccollect(), 1) # collected the pad
523 gst.debug('going into teardown')
524
525class PadBlockTest(TestCase):
526 def testCallbackFlush(self):

Callers

nothing calls this directly

Calls 1

gccollectMethod · 0.80

Tested by

no test coverage detected