mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
Adapt tests to new api
This commit is contained in:
parent
f100210c37
commit
14d7c20ce7
5 changed files with 33 additions and 37 deletions
|
@ -29,17 +29,17 @@ public class BinTest
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddMany()
|
||||
public void TestAdd()
|
||||
{
|
||||
Bin bin = new Bin("test-bin");
|
||||
Element e1 = ElementFactory.Make("fakesrc", "fakesrc");
|
||||
Element e2 = ElementFactory.Make("fakesink", "fakesink");
|
||||
|
||||
Assert.IsNotNull(bin, "Could not create bin");
|
||||
Assert.IsNotNull(e1, "Could not create fakesrc");
|
||||
Assert.IsNotNull(e2, "Could not create fakesink");
|
||||
Assert.IsNotNull(bin, "Could not create bin");
|
||||
Assert.IsNotNull(e1, "Could not create fakesrc");
|
||||
Assert.IsNotNull(e2, "Could not create fakesink");
|
||||
|
||||
bin.AddMany(e1, e2);
|
||||
bin.Add(e1, e2);
|
||||
|
||||
Assert.AreEqual(bin.ChildrenCount, 2);
|
||||
}
|
||||
|
@ -75,10 +75,9 @@ public class BinTest
|
|||
}
|
||||
|
||||
Assert.AreEqual(elements.Length, bin.ChildrenCount);
|
||||
Element [] children = bin.Children;
|
||||
|
||||
for(int i = 0; i < elements.Length; i++) {
|
||||
Assert.AreEqual(elements[elements.Length - i - 1], children[i]);
|
||||
for(uint i = 0; i < elements.Length; i++) {
|
||||
Assert.AreEqual(elements[elements.Length - i - 1], bin.GetChildByIndex(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ public class CapsTest
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestNewFromString()
|
||||
public void TestFromString()
|
||||
{
|
||||
Caps caps = Caps.NewFromString("video/x-raw-yuv, " +
|
||||
Caps caps = Caps.FromString("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"width=(int)384, " +
|
||||
"height=(int)288, " +
|
||||
|
@ -54,12 +54,12 @@ public class CapsTest
|
|||
[Test]
|
||||
public void TestIntersecting()
|
||||
{
|
||||
Caps caps1 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||
Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"width=(int)[ 1,1000 ], " +
|
||||
"height=(int)[ 1, 1000 ], " +
|
||||
"framerate=(fraction)[ 0/1, 100/1 ]");
|
||||
Caps caps2 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||
Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"width=(int)640, " +
|
||||
"height=(int)480");
|
||||
|
@ -80,10 +80,10 @@ public class CapsTest
|
|||
[Test]
|
||||
public void TestUnion()
|
||||
{
|
||||
Caps caps1 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||
Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"width=(int)640");
|
||||
Caps caps2 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||
Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
|
||||
"format=(fourcc)I420, " +
|
||||
"height=(int)480");
|
||||
Assert.IsNotNull(caps1);
|
||||
|
|
|
@ -25,12 +25,12 @@ public class MessageTest {
|
|||
[Test]
|
||||
public void TestParsing()
|
||||
{
|
||||
Message message = new Message(null);
|
||||
Message message = Message.NewEos(null);
|
||||
Assert.IsNotNull(message);
|
||||
Assert.AreEqual(message.Type, MessageType.Eos);
|
||||
Assert.IsNull(message.Src);
|
||||
|
||||
message = new Message(null, "error string");
|
||||
message = Message.NewError(null, CoreError.TooLazy);
|
||||
Assert.IsNotNull(message);
|
||||
Assert.AreEqual(message.Type, MessageType.Error);
|
||||
Assert.IsNull(message.Src);
|
||||
|
|
|
@ -46,14 +46,14 @@ public class PadTest
|
|||
|
||||
public static Caps PadGetCapsStub(Pad pad)
|
||||
{
|
||||
return Caps.NewFromString("video/x-raw-yuv");
|
||||
return Caps.FromString("video/x-raw-yuv");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFuncAssigning()
|
||||
{
|
||||
Pad src = new Pad("src", PadDirection.Src);
|
||||
src.GetcapsFunction = new PadGetCapsFunction(PadGetCapsStub);
|
||||
src.GetCapsFunction = new PadGetCapsFunction(PadGetCapsStub);
|
||||
|
||||
Caps caps = src.Caps;
|
||||
|
||||
|
@ -69,8 +69,8 @@ public class PadTest
|
|||
Assert.IsNotNull(element);
|
||||
Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
|
||||
|
||||
Pad src = element.GetPad("src");
|
||||
Pad sink = element.GetPad("sink");
|
||||
Pad src = element.GetStaticPad("src");
|
||||
Pad sink = element.GetStaticPad("sink");
|
||||
|
||||
Assert.IsNotNull(src, "Ooops, src pad is null");
|
||||
Assert.IsNotNull(sink, "Ooops, sink pad is null");
|
||||
|
@ -92,17 +92,13 @@ public class PadTest
|
|||
Assert.IsNotNull(element);
|
||||
Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
|
||||
|
||||
Assert.AreEqual(2, element.Numpads);
|
||||
Pad [] pads = new Pad [element.Numpads];
|
||||
element.Pads.CopyTo (pads, 0);
|
||||
|
||||
bool hassink = false;
|
||||
bool hassrc = false;
|
||||
|
||||
for(int i = 0; i < element.Numpads; i++) {
|
||||
if (pads [i].Name == "src")
|
||||
foreach(Pad pad in element.Pads) {
|
||||
if (pad.Name == "src")
|
||||
hassrc = true;
|
||||
else if (pads [i].Name == "sink")
|
||||
else if (pad.Name == "sink")
|
||||
hassink = true;
|
||||
}
|
||||
|
||||
|
@ -148,7 +144,7 @@ public class PadTest
|
|||
Caps caps = src.AllowedCaps;
|
||||
Assert.IsNull(caps);
|
||||
|
||||
caps = Caps.NewFromString("foo/bar");
|
||||
caps = Caps.FromString("foo/bar");
|
||||
|
||||
src.SetCaps(caps);
|
||||
sink.SetCaps(caps);
|
||||
|
@ -175,13 +171,13 @@ public class PadTest
|
|||
Caps caps = src.AllowedCaps;
|
||||
Assert.IsNull(caps);
|
||||
|
||||
caps = Caps.NewFromString("foo/bar");
|
||||
caps = Caps.FromString("foo/bar");
|
||||
src.SetCaps(caps);
|
||||
|
||||
Gst.Buffer buffer = new Gst.Buffer();
|
||||
Assert.AreEqual(src.Push(buffer), FlowReturn.NotLinked);
|
||||
|
||||
ulong handler_id = src.AddBufferProbe(new Pad.BufferProbeDelegate(ProbeHandler));
|
||||
ulong handler_id = src.AddBufferProbe(new PadBufferProbeCallback(ProbeHandler));
|
||||
buffer = new Gst.Buffer();
|
||||
Assert.AreEqual(src.Push(buffer), FlowReturn.Ok);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ using System;
|
|||
using NUnit.Framework;
|
||||
|
||||
using Gst;
|
||||
using Gst.CorePlugins;
|
||||
|
||||
[TestFixture]
|
||||
public class PipelineTest
|
||||
|
@ -44,7 +45,7 @@ public class PipelineTest
|
|||
Element sink = ElementFactory.Make("fakesink", null);
|
||||
|
||||
Bin bin = (Bin) pipeline;
|
||||
bin.AddMany(src, sink);
|
||||
bin.Add(src, sink);
|
||||
src.Link(sink);
|
||||
|
||||
Assert.AreEqual(((Element)pipeline).SetState(State.Ready), StateChangeReturn.Success);
|
||||
|
@ -61,7 +62,7 @@ public class PipelineTest
|
|||
Element sink = ElementFactory.Make("fakesink", null);
|
||||
|
||||
Bin bin = (Bin) pipeline;
|
||||
bin.AddMany(src, sink);
|
||||
bin.Add(src, sink);
|
||||
src.Link(sink);
|
||||
|
||||
Bus bus = pipeline.Bus;
|
||||
|
@ -118,7 +119,7 @@ public class PipelineTest
|
|||
Assert.IsNotNull(sink, "Could not create fakesink");
|
||||
|
||||
Bin bin = (Bin) pipeline;
|
||||
bin.AddMany(src, sink);
|
||||
bin.Add(src, sink);
|
||||
Assert.IsTrue(src.Link(sink), "Could not link between src and sink");
|
||||
|
||||
Assert.AreEqual(pipeline.SetState(State.Playing), StateChangeReturn.Async);
|
||||
|
@ -135,17 +136,17 @@ public class PipelineTest
|
|||
[Test]
|
||||
public void TestBaseTime() {
|
||||
Element pipeline = ElementFactory.Make("pipeline", "pipeline");
|
||||
Element fakesrc = ElementFactory.Make("fakesrc", "fakesrc");
|
||||
Element fakesink = ElementFactory.Make("fakesink", "fakesink");
|
||||
FakeSrc fakesrc = FakeSrc.Make("fakesrc");
|
||||
FakeSink fakesink = FakeSink.Make("fakesink");
|
||||
|
||||
Assert.IsNotNull(pipeline, "Could not create pipeline");
|
||||
Assert.IsNotNull(fakesrc, "Could not create fakesrc");
|
||||
Assert.IsNotNull(fakesink, "Could not create fakesink");
|
||||
|
||||
fakesrc.SetProperty("is-live", true);
|
||||
fakesrc.IsLive = true;
|
||||
|
||||
Bin bin = (Bin) pipeline;
|
||||
bin.AddMany(fakesrc, fakesink);
|
||||
bin.Add(fakesrc, fakesink);
|
||||
Assert.IsTrue(fakesrc.Link(fakesink));
|
||||
|
||||
Pad sink = fakesink.GetPad("sink");
|
||||
|
|
Loading…
Reference in a new issue