mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 14:36:41 +00:00
5c14766d47
* gstreamer-sharp/glue/Bin.c: Newly added. Added a function to return the offset of *children. * tests/ElementTest.cs: Newly added. Added two NUnit tests for Element class - one to test creation of elements and the other to test addition and deletion of Pads from elements. git-svn-id: svn://anonsvn.mono-project.com/source/branches/abock/gstreamer-sharp@61443 e3ebcda4-bce8-0310-ba0a-eca2169e7518
70 lines
1.3 KiB
C#
70 lines
1.3 KiB
C#
//
|
|
// ElementTest.cs: NUnit Test Suite for gstreamer-sharp
|
|
//
|
|
// Authors:
|
|
// Khaled Mohammed (khaled.mohammed@gmail.com)
|
|
//
|
|
// (C) 2006 Novell, Inc.
|
|
//
|
|
|
|
using System;
|
|
using NUnit.Framework;
|
|
|
|
using Gst;
|
|
|
|
[TestFixture]
|
|
public class ElementTest
|
|
{
|
|
[TestFixtureSetUp]
|
|
public void Init()
|
|
{
|
|
Application.Init();
|
|
}
|
|
|
|
[TestFixtureTearDown]
|
|
public void Deinit()
|
|
{
|
|
Application.Deinit();
|
|
}
|
|
|
|
[Test]
|
|
public void TestGoodConstructor()
|
|
{
|
|
Element sink = ElementFactory.Make("fakesink", "fake-sink");
|
|
|
|
Assert.IsNotNull(sink, "fakesink plugin is not installed?");
|
|
Assert.IsFalse(sink.Handle == IntPtr.Zero, "sink Element has null handle");
|
|
//Assert.IsInstanceOfType(typeof(Element), sink, "sink is not an Element?");
|
|
Assert.AreEqual(sink.Name, "fake-sink");
|
|
|
|
sink.Dispose();
|
|
}
|
|
|
|
[Test]
|
|
public void TestAddingAndRemovingPads()
|
|
{
|
|
Element src = ElementFactory.Make("fakesrc", "fake-src");
|
|
|
|
Assert.IsNotNull(src, "fakesrc plugin is not installed?");
|
|
|
|
Pad [] pads = new Pad[2];
|
|
|
|
pads[0] = new Pad("src1", PadDirection.Src);
|
|
pads[1] = new Pad("src2", PadDirection.Sink);
|
|
|
|
foreach(Pad P in pads) {
|
|
src.AddPad(P);
|
|
}
|
|
|
|
|
|
foreach(Pad P in pads) {
|
|
//Assert.IsTrue(src.Pads.IndexOf(P) >= 0);
|
|
}
|
|
|
|
foreach(Pad P in pads) {
|
|
Assert.IsTrue(src.RemovePad(P));
|
|
}
|
|
|
|
}
|
|
}
|
|
|