mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 14:36:41 +00:00
Add some tests that where lost in Refcount cleanup
This commit is contained in:
parent
89ffc66700
commit
1bf7205563
4 changed files with 104 additions and 16 deletions
|
@ -38,6 +38,32 @@ public class BinTest
|
|||
Assert.AreEqual(bin.ChildrenCount, 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddRemove()
|
||||
{
|
||||
Bin bin = ElementFactory.Make("bin") as Bin;
|
||||
Assert.IsNotNull(bin, "Could not create bin");
|
||||
|
||||
Element e1 = new FakeSrc("fakesrc");
|
||||
Element e2 = new Identity("identity");
|
||||
Element e3 = new FakeSink("fakesink");
|
||||
|
||||
Assert.IsNotNull(e1, "Could not create fakesrc");
|
||||
Assert.IsNotNull(e2, "Could not create identity");
|
||||
Assert.IsNotNull(e3, "Could not create fakesink");
|
||||
|
||||
bin.Add(e1, e2, e3);
|
||||
Element.Link(e1, e2, e3);
|
||||
|
||||
Assert.AreEqual(bin.ChildrenCount, 3);
|
||||
bin.Remove(e2, e3);
|
||||
Assert.AreEqual(bin.ChildrenCount, 1);
|
||||
bin.Add(e2);
|
||||
Assert.AreEqual(bin.ChildrenCount, 2);
|
||||
bin.Remove(e1, e2);
|
||||
Assert.AreEqual(bin.ChildrenCount, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetByName()
|
||||
{
|
||||
|
@ -52,15 +78,15 @@ public class BinTest
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestChildren()
|
||||
public void TestGetChildByIndex()
|
||||
{
|
||||
Bin bin = new Bin("test-bin");
|
||||
|
||||
Element [] elements = new Element [] {
|
||||
ElementFactory.Make("fakesrc", "fakesrc"),
|
||||
ElementFactory.Make("audioconvert", "audioconvert"),
|
||||
ElementFactory.Make("wavenc", "wavenc"),
|
||||
ElementFactory.Make("fakesink", "fakesink")
|
||||
ElementFactory.Make("audioconvert", "audioconvert"),
|
||||
ElementFactory.Make("wavenc", "wavenc"),
|
||||
ElementFactory.Make("fakesink", "fakesink")
|
||||
};
|
||||
|
||||
foreach(Element element in elements) {
|
||||
|
@ -73,16 +99,4 @@ public class BinTest
|
|||
Assert.AreEqual(elements[elements.Length - i - 1], bin.GetChildByIndex(i));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInterface()
|
||||
{
|
||||
Bin bin = new Bin(String.Empty);
|
||||
Assert.IsNotNull(bin, "Could not create bin");
|
||||
|
||||
Element filesrc = ElementFactory.Make("filesrc");
|
||||
Assert.IsNotNull(filesrc, "Could not create filesrc");
|
||||
|
||||
bin.Add(filesrc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,25 @@ public class BufferTest
|
|||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCaps()
|
||||
{
|
||||
Gst.Buffer buffer = new Gst.Buffer(4);
|
||||
Caps caps = Caps.FromString("audio/x-raw-int");
|
||||
|
||||
Assert.IsNull(buffer.Caps, "buffer.Caps should be null");
|
||||
buffer.Caps = caps;
|
||||
Assert.IsNotNull(buffer.Caps, "buffer.Caps is null");
|
||||
|
||||
Caps caps2 = Caps.FromString("audio/x-raw-float");
|
||||
buffer.Caps = caps2;
|
||||
Assert.AreNotEqual(buffer.Caps, caps);
|
||||
Assert.AreEqual(buffer.Caps, caps2);
|
||||
|
||||
buffer.Caps = null;
|
||||
Assert.IsNull(buffer.Caps, "buffer.Caps should be null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSubbuffer()
|
||||
{
|
||||
|
|
|
@ -27,5 +27,51 @@ public class ElementTest
|
|||
Element sink = new Bin("sink");
|
||||
|
||||
Assert.IsFalse(src.Link(sink));
|
||||
Assert.IsFalse(Element.Link(src, sink));
|
||||
}
|
||||
|
||||
[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"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLink()
|
||||
{
|
||||
State state, pending;
|
||||
|
||||
Element source = ElementFactory.Make("fakesrc", "source");
|
||||
Assert.IsNotNull(source);
|
||||
Element sink = ElementFactory.Make("fakesink", "sink");
|
||||
Assert.IsNotNull(sink);
|
||||
|
||||
Assert.IsTrue(source.LinkPads("src", sink, "sink"));
|
||||
|
||||
sink.SetState(State.Paused);
|
||||
source.SetState(State.Paused);
|
||||
sink.GetState(out state, out pending, Clock.TimeNone);
|
||||
Assert.AreEqual(state, State.Paused);
|
||||
|
||||
sink.SetState(State.Playing);
|
||||
source.SetState(State.Playing);
|
||||
source.GetState(out state, out pending, Clock.TimeNone);
|
||||
Assert.AreEqual(state, State.Playing);
|
||||
|
||||
sink.SetState(State.Null);
|
||||
source.SetState(State.Null);
|
||||
sink.GetState(out state, out pending, Clock.TimeNone);
|
||||
Assert.AreEqual(state, State.Null);
|
||||
|
||||
Assert.AreEqual(source.GetStaticPad("src").Peer, sink.GetStaticPad("sink"));
|
||||
source.Unlink(sink);
|
||||
Assert.IsFalse(source.GetStaticPad("src").IsLinked);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,15 @@ public class PipelineTest
|
|||
Application.Init();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPipeline()
|
||||
{
|
||||
Pipeline pipeline = new Pipeline(String.Empty);
|
||||
Assert.IsNotNull(pipeline, "Could not create pipeline");
|
||||
Assert.IsNotNull(pipeline.Bus, "Bus on pipeline is null");
|
||||
Assert.IsNotNull(pipeline.Clock, "Clock on pipeline is null");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAsyncStateChangeEmpty()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue