mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
2006-06-04 Khaled Mohammed <khaled.mohammed@gmail.com>
* 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
This commit is contained in:
parent
cd21cd308d
commit
5c14766d47
8 changed files with 102 additions and 6 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2006-06-04 Khaled Mohammed <khaled.mohammed@gmail.com>
|
||||
|
||||
* gstreamer/glue/Bin.c: added this file to the source. It has only one
|
||||
function which gives offset of *children in the C struct.
|
||||
|
||||
* gstreamer/glue/Makefile.am: added Bin.c to the list of C source that
|
||||
must be compiled.
|
||||
|
||||
* tests/ElementTest.cs: added NUnit tests for Element class.
|
||||
|
||||
* tests/Makefile.am: added ElementTest.cs to the list of TestSuite
|
||||
|
||||
* tests/BinTest.cs: fixed the test for Bin.Children
|
||||
|
||||
2006-06-04 Michael Dominic K. <michaldominik@gmail.com>
|
||||
|
||||
* doc/gst-sharp-docs.zip:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
Element [] result = new Element[list.Count];
|
||||
|
||||
for(int i = 0; i < list.Count; i++) {
|
||||
for(int i = list.Count - 1; i >= 0; i--) {
|
||||
result[i] = list[i] as Element;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
[DllImport("gstsharpglue-0.10")]
|
||||
[DllImport("gstreamersharpglue-0.10")]
|
||||
private extern static IntPtr gstsharp_message_parse_error(IntPtr raw);
|
||||
|
||||
public void ParseError(out string error)
|
||||
|
|
|
@ -3,7 +3,8 @@ lib_LTLIBRARIES = libgstreamersharpglue-0.10.la
|
|||
libgstreamersharpglue_0_10_la_SOURCES = \
|
||||
clock.c \
|
||||
message.c \
|
||||
miniobject.c
|
||||
miniobject.c \
|
||||
bin.c
|
||||
|
||||
nodist_libgstreamersharpglue_0_10_la_SOURCES = generated.c
|
||||
|
||||
|
|
10
gstreamer-sharp/glue/bin.c
Normal file
10
gstreamer-sharp/glue/bin.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <gst/gstbin.h>
|
||||
#include <gst/gstpipeline.h>
|
||||
#include <gst/gstsegment.h>
|
||||
|
||||
guint
|
||||
gstsharp_gst_bin_get_children_offset (void);
|
||||
|
||||
guint gstsharp_gst_bin_get_children_offset (void) {
|
||||
return (guint)G_STRUCT_OFFSET (GstBin, children);
|
||||
}
|
|
@ -78,7 +78,7 @@ public class BinTest
|
|||
Element [] children = bin.Children;
|
||||
|
||||
for(int i = 0; i < elements.Length; i++) {
|
||||
Assert.AreEqual(elements[i], children[i]);
|
||||
Assert.AreEqual(elements[elements.Length - i - 1], children[i]);
|
||||
}
|
||||
|
||||
bin.Dispose();
|
||||
|
|
70
tests/ElementTest.cs
Normal file
70
tests/ElementTest.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
//
|
||||
// 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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,8 @@ NUNIT_FLAGS = @MONO_NUNIT_LIBS@
|
|||
|
||||
ASSEMBLY_NAME = gstreamer-tests
|
||||
ASSEMBLY = $(ASSEMBLY_NAME).dll
|
||||
ASSEMBLY_CSFILES = $(srcdir)/ApplicationTest.cs $(srcdir)/BinTest.cs $(srcdir)/CapsTest.cs $(srcdir)/PadTest.cs
|
||||
ASSEMBLY_CSFILES = $(srcdir)/ApplicationTest.cs $(srcdir)/BinTest.cs $(srcdir)/CapsTest.cs $(srcdir)/PadTest.cs $(srcdir)/ElementTest.cs
|
||||
|
||||
|
||||
NUNIT_TESTER_NAME = ConsoleUi
|
||||
NUNIT_TESTER = $(NUNIT_TESTER_NAME).exe
|
||||
|
|
Loading…
Reference in a new issue