testsuite/test_element.py: add another link test
authorThomas Vander Stichele <thomas@apestaart.org>
Wed, 1 Feb 2006 11:14:20 +0000 (11:14 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Wed, 1 Feb 2006 11:14:20 +0000 (11:14 +0000)
Original commit message from CVS:
2006-02-01  Thomas Vander Stichele  <thomas at apestaart dot org>

* testsuite/test_element.py:
add another link test

ChangeLog
common
testsuite/test_element.py

index 10cdd76..a248a6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-02-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * testsuite/test_element.py:
+         add another link test
+
 2006-01-30  Edward Hervey  <edward@fluendo.com>
 
        * configure.ac:
diff --git a/common b/common
index bc43253..0b93085 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit bc4325349e8d0ec90aa5c5e74566880cc2e82527
+Subproject commit 0b93085188e83fe678ec5ded2823cd7c24dfa843
index a33fa52..d82a095 100644 (file)
@@ -222,11 +222,47 @@ class DebugTest(TestCase):
         e.set_property("name", "testelement")
         e.break_it_down()
         
-class LinkNoPadsTest(TestCase):
+class LinkTest(TestCase):
     def testLinkNoPads(self):
         src = gst.Bin()
         sink = gst.Bin()
         self.assertRaises(gst.LinkError, src.link, sink)
 
+    def testLink(self):
+        src = gst.element_factory_make('fakesrc')
+        sink = gst.element_factory_make('fakesink')
+        self.failUnless(src.link(sink))
+        # FIXME: this unlink leaks, no idea why
+        # src.unlink(sink)
+        # print src.__gstrefcount__
+
+    def testLinkPads(self):
+        src = gst.element_factory_make('fakesrc')
+        sink = gst.element_factory_make('fakesink')
+        # print src.__gstrefcount__
+        self.failUnless(src.link_pads("src", sink, "sink"))
+        src.unlink_pads("src", sink, "sink")
+
+    def testLinkFiltered(self):
+        # a filtered link uses capsfilter and thus needs a bin
+        bin = gst.Bin()
+        src = gst.element_factory_make('fakesrc')
+        sink = gst.element_factory_make('fakesink')
+        bin.add(src, sink)
+        caps = gst.caps_from_string("audio/x-raw-int")
+
+        self.failUnless(src.link(sink, caps))
+
+        # DANGER WILL.  src is not actually connected to sink, since
+        # there's a capsfilter in the way.  What a leaky abstraction.
+        # FIXME
+        # src.unlink(sink)
+
+        # instead, mess with pads directly
+        pad = src.get_pad('src')
+        pad.unlink(pad.get_peer())
+        pad = sink.get_pad('sink')
+        pad.get_peer().unlink(pad)
+
 if __name__ == "__main__":
     unittest.main()