summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-06-23 13:26:11 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-06-23 13:26:11 +0200
commitbb977f37f684a8e1b93dedf64dc808e5bdee4c28 (patch)
tree562964ff5c12b38778021e3598ab13d7a0676984
parent58c9aeb8a6a2aadc932d07f8abb4b8d46c11b223 (diff)
Adjust tests for new protected methods by implementing subclasses
-rw-r--r--tests/BinTest.cs39
-rw-r--r--tests/ElementTest.cs24
2 files changed, 38 insertions, 25 deletions
diff --git a/tests/BinTest.cs b/tests/BinTest.cs
index 79d859e..f64ac30 100644
--- a/tests/BinTest.cs
+++ b/tests/BinTest.cs
@@ -119,26 +119,31 @@ public class BinTest
CollectionAssert.AreEquivalent(elements, bin.ElementsSorted);
}
- [Test]
- public void TestGhostPad()
- {
- Bin bin = new Bin();
- Element filesrc = ElementFactory.Make("filesrc");
- bin.Add(filesrc);
- CollectionAssert.IsEmpty(bin.Pads);
+ public class MyBin : Gst.Bin {
+ public MyBin () : base () {
+ Element filesrc = ElementFactory.Make("filesrc");
+ Add(filesrc);
+ CollectionAssert.IsEmpty(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()));
+ 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")));
+ Assert.IsFalse(pad1.SetTarget(filesrc.GetStaticPad("src")));
+ Assert.IsTrue(pad2.SetTarget(filesrc.GetStaticPad("src")));
- bin.AddPad(pad1);
- bin.AddPad(pad2);
+ AddPad(pad1);
+ AddPad(pad2);
- CollectionAssert.Contains(bin.Pads, pad1);
- CollectionAssert.Contains(bin.Pads, pad2);
- CollectionAssert.Contains(bin.SinkPads, pad1);
- CollectionAssert.Contains(bin.SrcPads, pad2);
+ CollectionAssert.Contains(Pads, pad1);
+ CollectionAssert.Contains(Pads, pad2);
+ CollectionAssert.Contains(SinkPads, pad1);
+ CollectionAssert.Contains(SrcPads, pad2);
+ }
+ }
+
+ [Test]
+ public void TestGhostPad()
+ {
+ new MyBin ();
}
}
diff --git a/tests/ElementTest.cs b/tests/ElementTest.cs
index 2fe57be..d15ec5d 100644
--- a/tests/ElementTest.cs
+++ b/tests/ElementTest.cs
@@ -31,17 +31,25 @@ public class ElementTest
Assert.IsFalse(Element.Link(src, sink));
}
+ public class PadAddElement : Gst.Element {
+ public PadAddElement () : base () {
+ Pad pad = new Pad("source", PadDirection.Src);
+ CollectionAssert.IsEmpty(Pads);
+
+ AddPad(pad);
+ Assert.AreEqual(pad, GetStaticPad("source"));
+ CollectionAssert.Contains(Pads, pad);
+
+ RemovePad(pad);
+ Assert.IsNull(GetStaticPad("source"));
+ CollectionAssert.IsEmpty(Pads);
+ }
+ }
+
[Test]
public void TestAddRemovePad()
{
- Element e = ElementFactory.Make("fakesrc", "source");
- Pad pad = new Pad("source", PadDirection.Src);
-
- e.AddPad(pad);
- Assert.AreEqual(pad, e.GetStaticPad("source"));
-
- e.RemovePad(pad);
- Assert.IsNull(e.GetStaticPad("source"));
+ new PadAddElement ();
}
[Test]