mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 06:08:14 +00:00
MessageTest and BufferTest
git-svn-id: svn://anonsvn.mono-project.com/source/branches/abock/gstreamer-sharp@63659 e3ebcda4-bce8-0310-ba0a-eca2169e7518
This commit is contained in:
parent
13873a6559
commit
3df192045a
2 changed files with 132 additions and 0 deletions
92
tests/BufferTest.cs
Normal file
92
tests/BufferTest.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// Authors
|
||||
// Khaled Mohammed (khaled.mohammed@gmail.com)
|
||||
//
|
||||
// (C) 2006
|
||||
//
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Gst;
|
||||
|
||||
[TestFixture]
|
||||
public class BufferTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Deinit()
|
||||
{
|
||||
Application.Deinit();
|
||||
}
|
||||
/*
|
||||
[Test]
|
||||
public void TestCaps()
|
||||
{
|
||||
Gst.Buffer buffer = new Gst.Buffer(4);
|
||||
Caps caps = Caps.FromString("audio/x-raw-int");
|
||||
Assert.AreEqual(caps.Refcount, 1, "caps");
|
||||
Assert.IsNull(buffer.Caps);
|
||||
|
||||
buffer.Caps = caps;
|
||||
Assert.AreEqual(caps.Refcount, 2, "caps");
|
||||
|
||||
Assert.AreEqual(caps, buffer.Caps);
|
||||
Assert.AreEqual(caps.Refcount, 2, "caps");
|
||||
|
||||
Caps caps2 = Caps.FromString("audio/x-raw-float");
|
||||
Assert.AreEqual(caps2.Refcount, 1, "caps2");
|
||||
|
||||
buffer.Caps = caps2;
|
||||
Assert.AreEqual(caps.Refcount, 1, "caps");
|
||||
Assert.AreEqual(caps2.Refcount, 1, "caps2");
|
||||
|
||||
buffer.Caps = null;
|
||||
Assert.AreEqual(caps.Refcount, 1, "caps");
|
||||
Assert.AreEqual(caps2.Refcount, 1, "caps2");
|
||||
|
||||
buffer.Caps = caps2;
|
||||
Assert.AreEqual(caps2.Refcount, 2, "caps2");
|
||||
buffer.Dispose();
|
||||
Assert.AreEqual(caps2.Refcount, 1, "caps2");
|
||||
caps.Dispose();
|
||||
caps2.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSubbuffer()
|
||||
{
|
||||
Gst.Buffer buffer = new Gst.Buffer(4);
|
||||
Gst.Buffer sub = buffer.CreateSub(1, 2);
|
||||
Assert.IsNotNull(sub);
|
||||
Assert.AreEqual(sub.Size, 2, "subbuffer has wrong size");
|
||||
//Assert.AreEqual(buffer.Refcount, 2, "parent");
|
||||
//Assert.AreEqual(sub.Refcount, 1, "subbuffer");
|
||||
|
||||
//sub.Dispose();
|
||||
buffer.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsSpanFast()
|
||||
{
|
||||
Gst.Buffer buffer = new Gst.Buffer(4);
|
||||
|
||||
Gst.Buffer sub1 = buffer.CreateSub(0, 2);
|
||||
Assert.IsNotNull(sub1, "CreateSub of buffer returned null");
|
||||
|
||||
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");
|
||||
|
||||
buffer.Dispose();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
40
tests/MessageTest.cs
Normal file
40
tests/MessageTest.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// Authors
|
||||
// Khaled Mohammed (khaled.mohammed@gmail.com)
|
||||
//
|
||||
// (C) 2006
|
||||
//
|
||||
|
||||
using Gst;
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
public class MessageTest {
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
Application.Init();
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Deinit()
|
||||
{
|
||||
Application.Deinit();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestParsing()
|
||||
{
|
||||
Message message = new Message(null);
|
||||
Assert.IsNotNull(message);
|
||||
Assert.AreEqual(message.Type, MessageType.Eos);
|
||||
Assert.IsNull(message.Src);
|
||||
message.Dispose();
|
||||
|
||||
message = new Message(null, "error string");
|
||||
Assert.IsNotNull(message);
|
||||
Assert.AreEqual(message.Type, MessageType.Error);
|
||||
Assert.IsNull(message.Src);
|
||||
message.Dispose();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue