From c123dd008add3af39136d67739002af2be3a78e4 Mon Sep 17 00:00:00 2001 From: Maarten Bosmans Date: Thu, 18 Jun 2009 18:18:01 +0200 Subject: [PATCH] Add some tests that depend on nunit >= 2.4 functionality --- configure.ac | 2 +- tests/BinTest.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cd94ab8ab0..693a5e5035 100644 --- a/configure.ac +++ b/configure.ac @@ -130,7 +130,7 @@ if test "x$NUNIT_TESTER" = "xno" ; then fi AC_SUBST(NUNIT_TESTER) -PKG_CHECK_MODULES(MONO_NUNIT, mono-nunit >= 2.0, do_tests="yes", do_tests="no") +PKG_CHECK_MODULES(MONO_NUNIT, mono-nunit >= 2.4, do_tests="yes", do_tests="no") AC_SUBST(MONO_NUNIT_LIBS) AM_CONDITIONAL(ENABLE_TESTS, test "x$do_tests" = "xyes") if test "x$do_tests" = "xno"; then diff --git a/tests/BinTest.cs b/tests/BinTest.cs index de40698699..0b28172c6a 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); + } } -- 2.34.1