diff --git a/ChangeLog b/ChangeLog index 7e8bb40468..3eb3b2ef71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-06-04 Khaled Mohammed + + * 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. * doc/gst-sharp-docs.zip: diff --git a/gstreamer-sharp/Bin.custom b/gstreamer-sharp/Bin.custom index db16a34cbf..ab006f00c1 100644 --- a/gstreamer-sharp/Bin.custom +++ b/gstreamer-sharp/Bin.custom @@ -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; } diff --git a/gstreamer-sharp/Message.custom b/gstreamer-sharp/Message.custom index 269ceb881a..8e69a4fba4 100644 --- a/gstreamer-sharp/Message.custom +++ b/gstreamer-sharp/Message.custom @@ -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) diff --git a/gstreamer-sharp/glue/Makefile.am b/gstreamer-sharp/glue/Makefile.am index 3d8379c482..e8b6cc4d22 100644 --- a/gstreamer-sharp/glue/Makefile.am +++ b/gstreamer-sharp/glue/Makefile.am @@ -3,9 +3,10 @@ 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 +nodist_libgstreamersharpglue_0_10_la_SOURCES = generated.c libgstreamersharpglue_0_10_la_LIBADD = $(GST_LIBS) diff --git a/gstreamer-sharp/glue/bin.c b/gstreamer-sharp/glue/bin.c new file mode 100644 index 0000000000..e05be38937 --- /dev/null +++ b/gstreamer-sharp/glue/bin.c @@ -0,0 +1,10 @@ +#include +#include +#include + +guint +gstsharp_gst_bin_get_children_offset (void); + +guint gstsharp_gst_bin_get_children_offset (void) { + return (guint)G_STRUCT_OFFSET (GstBin, children); +} diff --git a/tests/BinTest.cs b/tests/BinTest.cs index 8a0d76a4b3..0f5fbf4396 100644 --- a/tests/BinTest.cs +++ b/tests/BinTest.cs @@ -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(); diff --git a/tests/ElementTest.cs b/tests/ElementTest.cs new file mode 100644 index 0000000000..4ae39298b0 --- /dev/null +++ b/tests/ElementTest.cs @@ -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)); + } + + } +} + diff --git a/tests/Makefile.am b/tests/Makefile.am index 427e2eb833..d368b16af6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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