[pitivi: 4/7] tests: Check data is written to fakesink in still image tests



commit 203cae6c6d63f20e459243d7602e19de677af401
Author: Robert Swain <robert swain collabora co uk>
Date:   Mon Aug 16 11:45:18 2010 +0200

    tests: Check data is written to fakesink in still image tests

 tests/test_still_image.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/tests/test_still_image.py b/tests/test_still_image.py
index 69cfe86..df3b681 100644
--- a/tests/test_still_image.py
+++ b/tests/test_still_image.py
@@ -66,8 +66,9 @@ class TestStillImage(TestCase):
         vsettings = StreamEncodeSettings(encoder="theoraenc")
         rsettings = RenderSettings(settings=[vsettings],
                                    muxer="oggmux")
+        self.fakesink = common.FakeSinkFactory()
         rendersink = RenderSinkFactory(RenderFactory(settings=rsettings),
-                                       common.FakeSinkFactory())
+                                       self.fakesink)
         self.render = RenderAction()
         self.pipeline = Pipeline()
         self.pipeline.connect("eos", self._renderEOSCb)
@@ -93,12 +94,19 @@ class TestStillImage(TestCase):
 
     def startRender(self):
         self.render.activate()
+        self.data_written = 0
+        self.fakesink.bins[0].props.signal_handoffs = True
+        self.fakesink.bins[0].connect("handoff", self._fakesinkHandoffCb)
         self.pipeline.play()
         self.mainloop.run()
 
+    def _fakesinkHandoffCb(self, fakesink, buf, pad):
+        self.data_written += buf.size
+
     def _renderEOSCb(self, obj):
         self.mainloop.quit()
         # check the render was successful
+        self.assertTrue(self.data_written > 0)
 
     def _renderErrorCb(self, obj, error, details):
         print "Error: %s\nDetails: %s" % (str(error), str(details))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]