diff --git a/ChangeLog b/ChangeLog index 04d506d7ad..b39c444166 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-04-12 Thomas Vander Stichele + + * testsuite/test_probe.py: + add test for probes + 2005-03-15 Richard Hult * gst/gst.defs (element_factory_make): Caller owns return, fixes leak diff --git a/testsuite/test_probe.py b/testsuite/test_probe.py index 486561f5de..586d0e419b 100644 --- a/testsuite/test_probe.py +++ b/testsuite/test_probe.py @@ -50,5 +50,34 @@ class ProbeTest(unittest.TestCase): self._probe_result2 = result2 return True + # this test checks if the probe can replace the probed GstData with + # another, FIXME: use return values on probe callback for this + def notestPerformChangeBuffer(self): + probe = gst.Probe(True, self._probe_callback_change_buffer) + buffer = gst.Buffer('changeme') + probe.perform(buffer) + self.assertEqual(str(buffer), 'changed') + + def _probe_callback_change_buffer(self, probe, data): + data = gst.Buffer('changed') + + def testFakeSrcProbe(self): + pipeline = gst.Pipeline() + fakesrc = gst.element_factory_make('fakesrc') + fakesrc.set_property('num-buffers', 1) + fakesink = gst.element_factory_make('fakesink') + + pipeline.add_many(fakesrc, fakesink) + fakesrc.link(fakesink) + pad = fakesrc.get_pad('src') + probe = gst.Probe(True, self._probe_callback_fakesrc) + pad.add_probe(probe) + pipeline.set_state(gst.STATE_PLAYING) + while pipeline.iterate(): pass + self.assertEqual(self._got_fakesrc_buffer, True) + + def _probe_callback_fakesrc(self, probe, data): + self._got_fakesrc_buffer = True + if __name__ == "__main__": unittest.main()