diff options
author | Maarten Bosmans <mkbosmans@gmail.com> | 2009-06-18 18:18:01 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-06-20 11:29:24 +0200 |
commit | c123dd008add3af39136d67739002af2be3a78e4 (patch) | |
tree | 8dd900ca3ed521b018e600a5c772363a1af4cd90 /tests | |
parent | 1bf720556359089a86509ed8a292a7a3786b51cc (diff) |
Add some tests that depend on nunit >= 2.4 functionality
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BinTest.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/BinTest.cs b/tests/BinTest.cs index de40698..0b28172 100644 --- a/tests/BinTest.cs +++ b/tests/BinTest.cs @@ -99,4 +99,46 @@ public class BinTest Assert.AreEqual(elements[elements.Length - i - 1], bin.GetChildByIndex(i)); } } + + [Test] + public void TestElements() + { + Bin bin = new Bin("test-bin"); + + Element [] elements = new Element [] { + new CapsFilter(), + new MultiQueue(), + new Queue(), + new Tee(), + new TypeFindElement() + }; + + bin.Add(elements); + CollectionAssert.AreEquivalent(elements, bin.Elements); + CollectionAssert.AreEquivalent(elements, bin.ElementsRecurse); + CollectionAssert.AreEquivalent(elements, bin.ElementsSorted); + } + + [Test] + public void TestGhostPad() + { + Bin bin = new Bin(String.Empty); + Element filesrc = ElementFactory.Make("filesrc"); + bin.Add(filesrc); + CollectionAssert.IsEmpty(bin.Pads); + + GhostPad pad1 = new GhostPad("ghost-sink", PadDirection.Sink); + GhostPad pad2 = new GhostPad("ghost-src", new PadTemplate("src-template", PadDirection.Src, PadPresence.Request, Caps.NewAny())); + + Assert.IsFalse(pad1.SetTarget(filesrc.GetStaticPad("src"))); + Assert.IsTrue(pad2.SetTarget(filesrc.GetStaticPad("src"))); + + bin.AddPad(pad1); + bin.AddPad(pad2); + + CollectionAssert.Contains(bin.Pads, pad1); + CollectionAssert.Contains(bin.Pads, pad2); + CollectionAssert.Contains(bin.SinkPads, pad1); + CollectionAssert.Contains(bin.SrcPads, pad2); + } } |