Khaled Mohammed 8ad1c333e7 Fix of Refcount property in Gst.Object
git-svn-id: svn://anonsvn.mono-project.com/source/branches/abock/gstreamer-sharp@63396 e3ebcda4-bce8-0310-ba0a-eca2169e7518
2006-08-05 21:07:11 +00:00

55 lines
1.0 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 TestAddRemovePad()
{
Element e = ElementFactory.Make("fakesrc", "source");
/* create a new floating pad with refcount 1 */
Pad p = new Pad("source", PadDirection.Src);
Assert.AreEqual(p.Refcount, 1, "pad");
/* ref it for ourselves */
Gst.Object.Ref(p.Handle);
Assert.AreEqual(p.Refcount, 2, "pad");
/* adding it sinks the pad -> not floating, same refcount */
e.AddPad(p);
Assert.AreEqual(p.Refcount, 2, "pad");
/* removing it reduces the refcount */
e.RemovePad(p);
Assert.AreEqual(p.Refcount, 1, "pad");
/* clean up our own reference */
p.Dispose();
e.Dispose();
}
}