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
87 lines
1.9 KiB
C#
87 lines
1.9 KiB
C#
//
|
|
// BinTest.cs: NUnit Test Suite for gstreamer-sharp
|
|
//
|
|
// Authors:
|
|
// Aaron Bockover (abockover@novell.com)
|
|
//
|
|
// (C) 2006 Novell, Inc.
|
|
//
|
|
|
|
using System;
|
|
using NUnit.Framework;
|
|
|
|
using Gst;
|
|
|
|
[TestFixture]
|
|
public class BinTest
|
|
{
|
|
[TestFixtureSetUp]
|
|
public void Init()
|
|
{
|
|
Application.Init();
|
|
}
|
|
|
|
[TestFixtureTearDown]
|
|
public void Deinit()
|
|
{
|
|
Application.Deinit();
|
|
}
|
|
|
|
[Test]
|
|
public void TestAddMany()
|
|
{
|
|
Bin bin = new Bin("test-bin");
|
|
Element e1 = ElementFactory.Make("fakesrc", "fakesrc");
|
|
Element e2 = ElementFactory.Make("fakesink", "fakesink");
|
|
bin.AddMany(e1, e2);
|
|
|
|
Assert.AreEqual(bin.ChildrenCount, 2);
|
|
|
|
e1.Dispose();
|
|
e2.Dispose();
|
|
bin.Dispose();
|
|
}
|
|
|
|
[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");
|
|
|
|
e1.Dispose();
|
|
bin.Dispose();
|
|
}
|
|
|
|
[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);
|
|
Element [] children = bin.Children;
|
|
|
|
for(int i = 0; i < elements.Length; i++) {
|
|
Assert.AreEqual(elements[elements.Length - i - 1], children[i]);
|
|
}
|
|
|
|
bin.Dispose();
|
|
}
|
|
}
|
|
|