summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Bosmans <mkbosmans@gmail.com>2009-06-15 08:28:47 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-06-17 12:10:19 +0200
commit8e9831765ae2295bb63ae6f13bb3cbcbb5d842cd (patch)
tree06308e8a10e8ef77260a46dfeeaa9434076a0981
parent37b8bdd10dc66ddd9603ab5e2ab621c3012aec87 (diff)
Fix source code formatting for all the tests
-rw-r--r--tests/ApplicationTest.cs39
-rw-r--r--tests/BinTest.cs118
-rw-r--r--tests/BufferTest.cs7
-rw-r--r--tests/CapsTest.cs167
-rw-r--r--tests/ElementTest.cs2
-rw-r--r--tests/MessageTest.cs6
-rw-r--r--tests/PadTest.cs199
-rw-r--r--tests/PipelineTest.cs259
8 files changed, 393 insertions, 404 deletions
diff --git a/tests/ApplicationTest.cs b/tests/ApplicationTest.cs
index 3db4db8..9a1ce97 100644
--- a/tests/ApplicationTest.cs
+++ b/tests/ApplicationTest.cs
@@ -13,24 +13,23 @@ using NUnit.Framework;
[TestFixture]
public class ApplicationTest
{
- [Test]
- public void Init()
- {
- Gst.Application.Init();
- }
-
- [Test]
- public void InitArgs()
- {
- string [] args = { "arg_a", "arg_b" };
- Gst.Application.Init("gstreamer-sharp-test", ref args);
- }
-
- [Test]
- public void InitArgsCheck()
- {
- string [] args = { "arg_a", "arg_b" };
- Gst.Application.InitCheck("gstreamer-sharp-test", ref args);
- }
-}
+ [Test]
+ public void Init()
+ {
+ Gst.Application.Init();
+ }
+
+ [Test]
+ public void InitArgs()
+ {
+ string [] args = { "arg_a", "arg_b" };
+ Gst.Application.Init("gstreamer-sharp-test", ref args);
+ }
+ [Test]
+ public void InitArgsCheck()
+ {
+ string [] args = { "arg_a", "arg_b" };
+ Gst.Application.InitCheck("gstreamer-sharp-test", ref args);
+ }
+}
diff --git a/tests/BinTest.cs b/tests/BinTest.cs
index 51cde1d..feb3d0f 100644
--- a/tests/BinTest.cs
+++ b/tests/BinTest.cs
@@ -10,70 +10,68 @@
using System;
using NUnit.Framework;
-
using Gst;
[TestFixture]
public class BinTest
{
- [TestFixtureSetUp]
- public void Init()
- {
- Application.Init();
- }
-
- [Test]
- 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");
-
- bin.Add(e1, e2);
-
- Assert.AreEqual(bin.ChildrenCount, 2);
- }
-
-
- [Test]
- public void TestGetByName()
- {
- Bin bin = new Bin("test-bin");
- Element e1 = ElementFactory.Make("fakesrc", "element-name");
- bin.Add(e1);
-
- e1 = bin.GetByName("element-name");
-
- Assert.IsNotNull(e1);
- Assert.AreEqual(e1.Name, "element-name");
- }
-
- [Test]
- public void TestChildren()
- {
- 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")
- };
-
- foreach(Element element in elements) {
- bin.Add(element);
- }
-
- Assert.AreEqual(elements.Length, bin.ChildrenCount);
-
- for(uint i = 0; i < elements.Length; i++) {
- Assert.AreEqual(elements[elements.Length - i - 1], bin.GetChildByIndex(i));
- }
- }
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ Application.Init();
+ }
+
+ [Test]
+ 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");
+
+ bin.Add(e1, e2);
+
+ Assert.AreEqual(bin.ChildrenCount, 2);
+ }
+
+ [Test]
+ public void TestGetByName()
+ {
+ Bin bin = new Bin("test-bin");
+ Element e1 = ElementFactory.Make("fakesrc", "element-name");
+ bin.Add(e1);
+
+ e1 = bin.GetByName("element-name");
+
+ Assert.IsNotNull(e1);
+ Assert.AreEqual(e1.Name, "element-name");
+ }
+
+ [Test]
+ public void TestChildren()
+ {
+ 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")
+ };
+
+ foreach(Element element in elements) {
+ bin.Add(element);
+ }
+
+ Assert.AreEqual(elements.Length, bin.ChildrenCount);
+
+ for(uint i = 0; i < elements.Length; i++) {
+ Assert.AreEqual(elements[elements.Length - i - 1], bin.GetChildByIndex(i));
+ }
+ }
[Test]
public void TestInterface()
@@ -86,6 +84,4 @@ public class BinTest
bin.Add(filesrc);
}
-
}
-
diff --git a/tests/BufferTest.cs b/tests/BufferTest.cs
index 68238be..37ac309 100644
--- a/tests/BufferTest.cs
+++ b/tests/BufferTest.cs
@@ -10,7 +10,8 @@ using NUnit.Framework;
using Gst;
[TestFixture]
-public class BufferTest {
+public class BufferTest
+{
[TestFixtureSetUp]
public void Init()
{
@@ -36,11 +37,9 @@ public class BufferTest {
Gst.Buffer sub2 = buffer.CreateSub(2, 2);
Assert.IsNotNull(sub2, "CreateSub of buffer returned null");
-
+
Assert.IsFalse(buffer.IsSpanFast(sub2), "a parent buffer can not be SpanFasted");
Assert.IsFalse(sub1.IsSpanFast(buffer), "a parent buffer can not be SpanFasted");
Assert.IsTrue(sub1.IsSpanFast(sub2), "two subbuffers next to each other should be SpanFast");
}
-
}
-
diff --git a/tests/CapsTest.cs b/tests/CapsTest.cs
index dbc1d3e..3b363ab 100644
--- a/tests/CapsTest.cs
+++ b/tests/CapsTest.cs
@@ -9,93 +9,92 @@
using System;
using NUnit.Framework;
-
using Gst;
[TestFixture]
public class CapsTest
{
- [TestFixtureSetUp]
- public void Init()
- {
- Application.Init();
- }
-
- [Test]
- public void TestPlainCreation()
- {
- Caps caps = new Caps();
- Assert.IsNotNull(caps);
- Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
- }
-
- [Test]
- public void TestFromString()
- {
- Caps caps = Caps.FromString("video/x-raw-yuv, " +
- "format=(fourcc)I420, " +
- "width=(int)384, " +
- "height=(int)288, " +
- "framerate=(fraction)25/1");
- Assert.IsNotNull(caps);
-
- Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
- Assert.IsTrue(caps.IsFixed, "Caps should be FIXED!");
- Assert.IsFalse(caps.IsEmpty, "Caps shouldn't be EMPTY!");
- Assert.IsFalse(caps.IsAny, "Caps shouldn't be ANY!");
- }
-
- [Test]
- public void TestIntersecting()
- {
- 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.FromString("video/x-raw-yuv, " +
- "format=(fourcc)I420, " +
- "width=(int)640, " +
- "height=(int)480");
- Assert.IsNotNull(caps1);
- Assert.IsNotNull(caps2);
-
- Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
- Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
-
- Caps caps3 = caps1.Intersect(caps2);
-
- Assert.IsFalse(caps3.IsFixed, "How come caps are FIXED?!");
- Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
-
- Assert.AreEqual(caps2.ToString() + ", framerate=(fraction)[ 0/1, 100/1 ]", caps3.ToString());
- }
-
- [Test]
- public void TestUnion()
- {
- Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
- "format=(fourcc)I420, " +
- "width=(int)640");
- Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
- "format=(fourcc)I420, " +
- "height=(int)480");
- Assert.IsNotNull(caps1);
- Assert.IsNotNull(caps2);
-
- Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
- Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
-
- Caps caps3 = caps1.Union(caps2);
-
- Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
-
- Assert.AreEqual("video/x-raw-yuv, " +
- "format=(fourcc)I420, " +
- "width=(int)640; " +
- "video/x-raw-yuv, " +
- "format=(fourcc)I420, " +
- "height=(int)480",
- caps3.ToString());
- }
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ Application.Init();
+ }
+
+ [Test]
+ public void TestPlainCreation()
+ {
+ Caps caps = new Caps();
+ Assert.IsNotNull(caps);
+ Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
+ }
+
+ [Test]
+ public void TestFromString()
+ {
+ Caps caps = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)384, " +
+ "height=(int)288, " +
+ "framerate=(fraction)25/1");
+ Assert.IsNotNull(caps);
+
+ Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
+ Assert.IsTrue(caps.IsFixed, "Caps should be FIXED!");
+ Assert.IsFalse(caps.IsEmpty, "Caps shouldn't be EMPTY!");
+ Assert.IsFalse(caps.IsAny, "Caps shouldn't be ANY!");
+ }
+
+ [Test]
+ public void TestIntersecting()
+ {
+ 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.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)640, " +
+ "height=(int)480");
+ Assert.IsNotNull(caps1);
+ Assert.IsNotNull(caps2);
+
+ Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
+ Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
+
+ Caps caps3 = caps1.Intersect(caps2);
+
+ Assert.IsFalse(caps3.IsFixed, "How come caps are FIXED?!");
+ Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
+
+ Assert.AreEqual(caps2.ToString() + ", framerate=(fraction)[ 0/1, 100/1 ]", caps3.ToString());
+ }
+
+ [Test]
+ public void TestUnion()
+ {
+ Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)640");
+ Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "height=(int)480");
+ Assert.IsNotNull(caps1);
+ Assert.IsNotNull(caps2);
+
+ Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
+ Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
+
+ Caps caps3 = caps1.Union(caps2);
+
+ Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
+
+ Assert.AreEqual("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)640; " +
+ "video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "height=(int)480",
+ caps3.ToString());
+ }
}
diff --git a/tests/ElementTest.cs b/tests/ElementTest.cs
index c42f882..bb48cbf 100644
--- a/tests/ElementTest.cs
+++ b/tests/ElementTest.cs
@@ -9,7 +9,6 @@
using System;
using NUnit.Framework;
-
using Gst;
[TestFixture]
@@ -36,4 +35,3 @@ public class ElementTest
Assert.IsFalse(src.Link(sink));
}
}
-
diff --git a/tests/MessageTest.cs b/tests/MessageTest.cs
index a5ac634..59d4ca5 100644
--- a/tests/MessageTest.cs
+++ b/tests/MessageTest.cs
@@ -5,11 +5,12 @@
// (C) 2006
//
-using Gst;
using System;
using NUnit.Framework;
+using Gst;
-public class MessageTest {
+public class MessageTest
+{
[TestFixtureSetUp]
public void Init()
{
@@ -30,4 +31,3 @@ public class MessageTest {
Assert.IsNull(message.Src);
}
}
-
diff --git a/tests/PadTest.cs b/tests/PadTest.cs
index 8695262..d86d843 100644
--- a/tests/PadTest.cs
+++ b/tests/PadTest.cs
@@ -10,96 +10,95 @@
using System;
using NUnit.Framework;
-
using Gst;
[TestFixture]
public class PadTest
{
- [TestFixtureSetUp]
- public void Init()
- {
- Application.Init();
- }
-
- [Test]
- public void TestPlainCreation()
- {
- Pad src = new Pad("src", PadDirection.Src);
- Pad sink = new Pad("sink", PadDirection.Sink);
-
- Assert.IsNotNull(src);
- Assert.IsNotNull(sink);
-
- Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
- Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
-
- Assert.AreEqual(PadDirection.Src, src.Direction);
- Assert.AreEqual(PadDirection.Sink, sink.Direction);
- }
-
- public static Caps PadGetCapsStub(Pad pad)
- {
- return Caps.FromString("video/x-raw-yuv");
- }
-
- [Test]
- [Ignore("This test causes a crash")]
- public void TestFuncAssigning()
- {
- Pad src = new Pad("src", PadDirection.Src);
- src.GetCapsFunction = new PadGetCapsFunction(PadGetCapsStub);
-
- Caps caps = src.Caps;
-
- Assert.IsNotNull(caps, "Ooops, returned caps is null");
- Assert.IsFalse(caps.IsEmpty == true, "Ooops, returned caps are empty");
- Assert.AreEqual("video/x-raw-yuv", caps.ToString ());
- }
-
- [Test]
- public void TestElementPadAccessByName()
- {
- Element element = ElementFactory.Make("identity", null);
- Assert.IsNotNull(element);
- Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
-
- 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");
-
- Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
- Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
-
- Caps srccaps = src.Caps;
- Assert.IsTrue(srccaps.IsAny, "How come src pad caps is not ANY?");
-
- Caps sinkcaps = sink.Caps;
- Assert.IsTrue(sinkcaps.IsAny, "How come sink pad caps is not ANY?");
- }
-
- [Test]
- public void TestElementPadAccessByList()
- {
- Element element = ElementFactory.Make("identity", null);
- Assert.IsNotNull(element);
- Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
-
- bool hassink = false;
- bool hassrc = false;
-
- foreach(Pad pad in element.Pads) {
- if (pad.Name == "src")
- hassrc = true;
- else if (pad.Name == "sink")
- hassink = true;
- }
-
- Assert.IsTrue(hassink, "Sink pad not found in the list");
- Assert.IsTrue(hassrc, "Src pad not found in the list");
- }
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ Application.Init();
+ }
+
+ [Test]
+ public void TestPlainCreation()
+ {
+ Pad src = new Pad("src", PadDirection.Src);
+ Pad sink = new Pad("sink", PadDirection.Sink);
+
+ Assert.IsNotNull(src);
+ Assert.IsNotNull(sink);
+
+ Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
+ Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
+
+ Assert.AreEqual(PadDirection.Src, src.Direction);
+ Assert.AreEqual(PadDirection.Sink, sink.Direction);
+ }
+
+ public static Caps PadGetCapsStub(Pad pad)
+ {
+ return Caps.FromString("video/x-raw-yuv");
+ }
+
+ [Test]
+ [Ignore("This test causes a crash")]
+ public void TestFuncAssigning()
+ {
+ Pad src = new Pad("src", PadDirection.Src);
+ src.GetCapsFunction = new PadGetCapsFunction(PadGetCapsStub);
+
+ Caps caps = src.Caps;
+
+ Assert.IsNotNull(caps, "Ooops, returned caps is null");
+ Assert.IsFalse(caps.IsEmpty == true, "Ooops, returned caps are empty");
+ Assert.AreEqual("video/x-raw-yuv", caps.ToString ());
+ }
+
+ [Test]
+ public void TestElementPadAccessByName()
+ {
+ Element element = ElementFactory.Make("identity", null);
+ Assert.IsNotNull(element);
+ Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
+
+ 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");
+
+ Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
+ Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
+
+ Caps srccaps = src.Caps;
+ Assert.IsTrue(srccaps.IsAny, "How come src pad caps is not ANY?");
+
+ Caps sinkcaps = sink.Caps;
+ Assert.IsTrue(sinkcaps.IsAny, "How come sink pad caps is not ANY?");
+ }
+
+ [Test]
+ public void TestElementPadAccessByList()
+ {
+ Element element = ElementFactory.Make("identity", null);
+ Assert.IsNotNull(element);
+ Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
+
+ bool hassink = false;
+ bool hassrc = false;
+
+ foreach(Pad pad in element.Pads) {
+ if (pad.Name == "src")
+ hassrc = true;
+ else if (pad.Name == "sink")
+ hassink = true;
+ }
+
+ Assert.IsTrue(hassink, "Sink pad not found in the list");
+ Assert.IsTrue(hassrc, "Src pad not found in the list");
+ }
[Test]
public void TestLink()
@@ -115,24 +114,24 @@ public class PadTest
Assert.AreEqual(src.Link(sink), PadLinkReturn.Noformat);
}
-
+
[Test]
public void TestGetAllowedCaps()
{
-/*
- Gst.Buffer buffer = new Gst.Buffer();
-
- try {
- Pad pbuffer = (Pad) buffer;
- Caps pcaps = pbuffer.AllowedCaps;
- }
- catch (Exception ex) {
- Assert.Fail("buffer.AllowedCaps failed");
- }
-*/
+ /*
+ Gst.Buffer buffer = new Gst.Buffer();
+
+ try {
+ Pad pbuffer = (Pad) buffer;
+ Caps pcaps = pbuffer.AllowedCaps;
+ }
+ catch (Exception ex) {
+ Assert.Fail("buffer.AllowedCaps failed");
+ }
+ */
Pad sink = new Pad("sink", PadDirection.Sink);
-// try { Caps tcaps = sink.AllowedCaps; }
-// catch (Exception) { Assert.Fail("sink.AllowedCaps failed"); }
+ // try { Caps tcaps = sink.AllowedCaps; }
+ // catch (Exception) { Assert.Fail("sink.AllowedCaps failed"); }
Pad src = new Pad("src", PadDirection.Src);
Assert.IsNotNull(src);
@@ -157,7 +156,7 @@ public class PadTest
//Assert.Fail("event worked");
return false;
}
-
+
[Test]
public void TestPushUnlinked()
{
diff --git a/tests/PipelineTest.cs b/tests/PipelineTest.cs
index 860aeaf..40ebabf 100644
--- a/tests/PipelineTest.cs
+++ b/tests/PipelineTest.cs
@@ -9,140 +9,139 @@
using System;
using NUnit.Framework;
-
using Gst;
using Gst.CorePlugins;
[TestFixture]
public class PipelineTest
{
- [TestFixtureSetUp]
- public void Init()
- {
- Application.Init();
- }
-
- [Test]
- public void TestAsyncStateChangeEmpty()
- {
- Pipeline pipeline = new Pipeline(String.Empty);
- Assert.IsNotNull(pipeline, "Could not create pipeline");
-
- Assert.AreEqual(((Element)pipeline).SetState(State.Playing), StateChangeReturn.Success);
- }
-
- [Test]
- public void TestAsyncStateChangeFakeReady()
- {
- Pipeline pipeline = new Pipeline(String.Empty);
- Element src = ElementFactory.Make("fakesrc", null);
- Element sink = ElementFactory.Make("fakesink", null);
-
- Bin bin = (Bin) pipeline;
- bin.Add(src, sink);
- src.Link(sink);
-
- Assert.AreEqual(((Element)pipeline).SetState(State.Ready), StateChangeReturn.Success);
- }
-
- [Test]
- public void TestAsyncStateChangeFake()
- {
- bool done = false;
- Pipeline pipeline = new Pipeline(String.Empty);
- Assert.IsNotNull(pipeline, "Could not create pipeline");
-
- Element src = ElementFactory.Make("fakesrc", null);
- Element sink = ElementFactory.Make("fakesink", null);
-
- Bin bin = (Bin) pipeline;
- bin.Add(src, sink);
- src.Link(sink);
-
- Bus bus = pipeline.Bus;
-
- Assert.AreEqual(((Element) pipeline).SetState(State.Playing), StateChangeReturn.Async);
-
- while(!done) {
- State old, newState, pending;
- Message message = bus.Poll(MessageType.StateChanged, -1);
- if(message != null) {
- message.ParseStateChanged(out old, out newState, out pending);
- //Console.WriteLine("state change from {0} to {1}", old, newState);
- if(message.Src == (Gst.Object) pipeline && newState == State.Playing)
- done = true;
- }
- }
-
- Assert.AreEqual(((Element)pipeline).SetState(State.Null), StateChangeReturn.Success);
- }
-
- Element pipeline;
- GLib.MainLoop loop;
-
- bool MessageReceived(Bus bus, Message message) {
- MessageType type = message.Type;
-
- switch(type)
- {
- case MessageType.StateChanged:
- {
- State old, newState, pending;
- message.ParseStateChanged(out old, out newState, out pending);
- if(message.Src == (Gst.Object) pipeline && newState == State.Playing) {
- loop.Quit();
- }
- break;
- }
- case MessageType.Error:
- break;
- default: break;
- }
- return true;
- }
- [Test]
- [Ignore("This test does not terminate")]
- public void TestBus()
- {
- pipeline = new Pipeline(String.Empty);
- Assert.IsNotNull(pipeline, "Could not create pipeline");
-
- Element src = ElementFactory.Make("fakesrc", null);
- Assert.IsNotNull(src, "Could not create fakesrc");
- Element sink = ElementFactory.Make("fakesink", null);
- Assert.IsNotNull(sink, "Could not create fakesink");
-
- Bin bin = (Bin) pipeline;
- bin.Add(src, sink);
- Assert.IsTrue(src.Link(sink), "Could not link between src and sink");
-
- Assert.AreEqual(pipeline.SetState(State.Playing), StateChangeReturn.Async);
-
- loop = new GLib.MainLoop();
- loop.Run();
-
- Assert.AreEqual(pipeline.SetState(State.Null), StateChangeReturn.Success);
- State current, pending;
- Assert.AreEqual(pipeline.GetState(out current, out pending, Clock.TimeNone), StateChangeReturn.Success);
- Assert.AreEqual(current, State.Null, "state is not NULL but " + current);
- }
-
- [Test]
- public void TestBaseTime() {
- Element pipeline = ElementFactory.Make("pipeline", "pipeline");
- 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.IsLive = true;
-
- Bin bin = (Bin) pipeline;
- bin.Add(fakesrc, fakesink);
- Assert.IsTrue(fakesrc.Link(fakesink));
-
- Pad sink = fakesink.GetPad("sink");
- }
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ Application.Init();
+ }
+
+ [Test]
+ public void TestAsyncStateChangeEmpty()
+ {
+ Pipeline pipeline = new Pipeline(String.Empty);
+ Assert.IsNotNull(pipeline, "Could not create pipeline");
+
+ Assert.AreEqual(((Element)pipeline).SetState(State.Playing), StateChangeReturn.Success);
+ }
+
+ [Test]
+ public void TestAsyncStateChangeFakeReady()
+ {
+ Pipeline pipeline = new Pipeline(String.Empty);
+ Element src = ElementFactory.Make("fakesrc", null);
+ Element sink = ElementFactory.Make("fakesink", null);
+
+ Bin bin = (Bin) pipeline;
+ bin.Add(src, sink);
+ src.Link(sink);
+
+ Assert.AreEqual(((Element)pipeline).SetState(State.Ready), StateChangeReturn.Success);
+ }
+
+ [Test]
+ public void TestAsyncStateChangeFake()
+ {
+ bool done = false;
+ Pipeline pipeline = new Pipeline(String.Empty);
+ Assert.IsNotNull(pipeline, "Could not create pipeline");
+
+ Element src = ElementFactory.Make("fakesrc", null);
+ Element sink = ElementFactory.Make("fakesink", null);
+
+ Bin bin = (Bin) pipeline;
+ bin.Add(src, sink);
+ src.Link(sink);
+
+ Bus bus = pipeline.Bus;
+
+ Assert.AreEqual(((Element) pipeline).SetState(State.Playing), StateChangeReturn.Async);
+
+ while(!done) {
+ State old, newState, pending;
+ Message message = bus.Poll(MessageType.StateChanged, -1);
+ if(message != null) {
+ message.ParseStateChanged(out old, out newState, out pending);
+ //Console.WriteLine("state change from {0} to {1}", old, newState);
+ if(message.Src == (Gst.Object) pipeline && newState == State.Playing)
+ done = true;
+ }
+ }
+
+ Assert.AreEqual(((Element)pipeline).SetState(State.Null), StateChangeReturn.Success);
+ }
+
+ Element pipeline;
+ GLib.MainLoop loop;
+
+ bool MessageReceived(Bus bus, Message message) {
+ MessageType type = message.Type;
+
+ switch(type)
+ {
+ case MessageType.StateChanged:
+ {
+ State old, newState, pending;
+ message.ParseStateChanged(out old, out newState, out pending);
+ if(message.Src == (Gst.Object) pipeline && newState == State.Playing) {
+ loop.Quit();
+ }
+ break;
+ }
+ case MessageType.Error:
+ break;
+ default: break;
+ }
+ return true;
+ }
+ [Test]
+ [Ignore("This test does not terminate")]
+ public void TestBus()
+ {
+ pipeline = new Pipeline(String.Empty);
+ Assert.IsNotNull(pipeline, "Could not create pipeline");
+
+ Element src = ElementFactory.Make("fakesrc", null);
+ Assert.IsNotNull(src, "Could not create fakesrc");
+ Element sink = ElementFactory.Make("fakesink", null);
+ Assert.IsNotNull(sink, "Could not create fakesink");
+
+ Bin bin = (Bin) pipeline;
+ bin.Add(src, sink);
+ Assert.IsTrue(src.Link(sink), "Could not link between src and sink");
+
+ Assert.AreEqual(pipeline.SetState(State.Playing), StateChangeReturn.Async);
+
+ loop = new GLib.MainLoop();
+ loop.Run();
+
+ Assert.AreEqual(pipeline.SetState(State.Null), StateChangeReturn.Success);
+ State current, pending;
+ Assert.AreEqual(pipeline.GetState(out current, out pending, Clock.TimeNone), StateChangeReturn.Success);
+ Assert.AreEqual(current, State.Null, "state is not NULL but " + current);
+ }
+
+ [Test]
+ public void TestBaseTime() {
+ Element pipeline = ElementFactory.Make("pipeline", "pipeline");
+ 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.IsLive = true;
+
+ Bin bin = (Bin) pipeline;
+ bin.Add(fakesrc, fakesink);
+ Assert.IsTrue(fakesrc.Link(fakesink));
+
+ Pad sink = fakesink.GetStaticPad("sink");
+ }
}