[pitivi: 6/10] test_factories_file.py: check in unit test for SourceFactory.setFilterCaps()



commit 4311ab7b5f5baaa4c24d5cb7ad6d0b301a41d006
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Thu Mar 4 12:38:20 2010 -0800

    test_factories_file.py: check in unit test for SourceFactory.setFilterCaps()
    
    it's easier to test this functionality when it's part of FileSourceFactory, as
    it involves creating bins with SourceFactorie's _makeStreamBin

 tests/test_factories_file.py |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_factories_file.py b/tests/test_factories_file.py
index 6a43e8d..e2e0f48 100644
--- a/tests/test_factories_file.py
+++ b/tests/test_factories_file.py
@@ -82,6 +82,38 @@ class TestFileSourceFactory(TestCase):
         self.failUnlessEqual(video, bin.decodebin.stream)
         self.factory.releaseBin(bin)
 
+    def testSetFilterCaps(self):
+        stream = VideoStream(gst.Caps("video/x-raw-rgb"))
+        self.factory.addOutputStream(stream)
+
+        caps1 = gst.Caps("video/x-raw-yuv,width=320,height=240")
+        caps2 = gst.Caps("video/x-raw-yuv,width=640,height=480")
+
+        self.factory.setFilterCaps(caps1)
+
+        bin1 = self.factory.makeBin(stream)
+        self.failUnlessEqual(self.factory.current_bins, 1)
+        self.failUnless(isinstance(bin1, gst.Bin))
+        self.failUnless(hasattr(bin1, "scale"))
+        self.failUnlessEqual(bin1.scale.widthout, 320)
+        self.failUnlessEqual(bin1.scale.heightout, 240)
+
+        bin2 = self.factory.makeBin(stream)
+        self.failUnlessEqual(self.factory.current_bins, 2)
+        self.failUnless(isinstance(bin2, gst.Bin))
+        self.failUnless(hasattr(bin2, "scale"))
+        self.failUnlessEqual(bin2.scale.widthout, 320)
+        self.failUnlessEqual(bin2.scale.heightout, 240)
+
+        self.factory.setFilterCaps(caps2)
+        self.failUnlessEqual(bin1.scale.widthout, 640)
+        self.failUnlessEqual(bin1.scale.heightout, 480)
+        self.failUnlessEqual(bin2.scale.widthout, 640)
+        self.failUnlessEqual(bin2.scale.heightout, 480)
+
+        self.factory.releaseBin(bin1)
+        self.factory.releaseBin(bin2)
+
 class StubPictureFileSourceFactory(PictureFileSourceFactory):
     singleDecodeBinClass = StubSingleDecodeBin
 



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