[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r61327 - in branches/abock/gstreamer-sharp: . tests
From: "Michal Dominik (michaldominik () gmail ! com)"
Date: 2006-05-31 13:54:56
Message-ID: 20060531135456.9EA309472C () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: mdk
Date: 2006-05-31 09:54:56 -0400 (Wed, 31 May 2006)
New Revision: 61327
Added:
branches/abock/gstreamer-sharp/tests/PadTest.cs
Modified:
branches/abock/gstreamer-sharp/ChangeLog
branches/abock/gstreamer-sharp/tests/CapsTest.cs
branches/abock/gstreamer-sharp/tests/Makefile.am
Log:
2006-05-31 Michael Dominic K. <michaldominik@gmail.com>
* tests/PadTest.cs:
* tests/Makefile.am:
Introducing a new test for Gst.Pad. All fixtures pass.
* tests/CapsTest.cs:
Adding a new fixture for caps union testing (passes).
Fixing some code-style errors.
Modified: branches/abock/gstreamer-sharp/ChangeLog
===================================================================
--- branches/abock/gstreamer-sharp/ChangeLog 2006-05-31 13:39:02 UTC (rev 61326)
+++ branches/abock/gstreamer-sharp/ChangeLog 2006-05-31 13:54:56 UTC (rev 61327)
@@ -1,3 +1,13 @@
+2006-05-31 Michael Dominic K. <michaldominik@gmail.com>
+
+ * tests/PadTest.cs:
+ * tests/Makefile.am:
+ Introducing a new test for Gst.Pad. All fixtures pass.
+
+ * tests/CapsTest.cs:
+ Adding a new fixture for caps union testing (passes).
+ Fixing some code-style errors.
+
2006-05-30 Michael Dominic K. <michaldominik@gmail.com>
* README:
Modified: branches/abock/gstreamer-sharp/tests/CapsTest.cs
===================================================================
--- branches/abock/gstreamer-sharp/tests/CapsTest.cs 2006-05-31 13:39:02 UTC (rev \
61326)
+++ branches/abock/gstreamer-sharp/tests/CapsTest.cs 2006-05-31 13:54:56 UTC (rev \
61327) @@ -78,11 +78,43 @@
Assert.IsFalse(caps3.IsFixed, "How come caps are FIXED?!");
Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
- Assert.AreEqual(caps2.ToString () + ", framerate=(fraction)[ 0/1, 100/1 ]", \
caps3.ToString ()); + Assert.AreEqual(caps2.ToString() + ", \
framerate=(fraction)[ 0/1, 100/1 ]", caps3.ToString());
caps1.Dispose();
caps2.Dispose();
caps3.Dispose();
}
+ [Test]
+ public void TestUnion()
+ {
+ Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)640");
+ Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "height=(int)480");
+ Assert.IsNotNull(caps1);
+ Assert.IsNotNull(caps2);
+
+ Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
+ Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
+
+ Caps caps3 = caps1.Union(caps2);
+
+ Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
+
+ Assert.AreEqual("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)640; " +
+ "video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "height=(int)480",
+ caps3.ToString());
+
+ caps1.Dispose();
+ caps2.Dispose();
+ caps3.Dispose();
+ }
+
}
Modified: branches/abock/gstreamer-sharp/tests/Makefile.am
===================================================================
--- branches/abock/gstreamer-sharp/tests/Makefile.am 2006-05-31 13:39:02 UTC (rev \
61326)
+++ branches/abock/gstreamer-sharp/tests/Makefile.am 2006-05-31 13:54:56 UTC (rev \
61327) @@ -3,7 +3,7 @@
ASSEMBLY_NAME = gstreamer-tests
ASSEMBLY = $(ASSEMBLY_NAME).dll
-ASSEMBLY_CSFILES = $(srcdir)/ApplicationTest.cs $(srcdir)/BinTest.cs \
$(srcdir)/CapsTest.cs +ASSEMBLY_CSFILES = $(srcdir)/ApplicationTest.cs \
$(srcdir)/BinTest.cs $(srcdir)/CapsTest.cs $(srcdir)/PadTest.cs
NUNIT_TESTER_NAME = ConsoleUi
NUNIT_TESTER = $(NUNIT_TESTER_NAME).exe
Added: branches/abock/gstreamer-sharp/tests/PadTest.cs
===================================================================
--- branches/abock/gstreamer-sharp/tests/PadTest.cs 2006-05-31 13:39:02 UTC (rev \
61326)
+++ branches/abock/gstreamer-sharp/tests/PadTest.cs 2006-05-31 13:54:56 UTC (rev \
61327) @@ -0,0 +1,126 @@
+//
+// PadTest.cs: NUnit Test Suite for gstreamer-sharp
+//
+// Authors:
+// Michael Dominic K. (michaldominik@gmail.com)
+//
+// (C) 2006 Novell, Inc.
+//
+
+using System;
+using NUnit.Framework;
+
+using Gst;
+
+[TestFixture]
+public class PadTest
+{
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ Application.Init();
+ }
+
+ [TestFixtureTearDown]
+ public void Deinit()
+ {
+ Application.Deinit();
+ }
+
+ [Test]
+ public void TestPlainCreation()
+ {
+ Pad src = new Pad("src", PadDirection.Src);
+ Pad sink = new Pad("sink", PadDirection.Sink);
+
+ Assert.IsNotNull(src);
+ Assert.IsNotNull(sink);
+
+ Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
+ Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null \
handle"); +
+ Assert.AreEqual(PadDirection.Src, src.Direction);
+ Assert.AreEqual(PadDirection.Sink, sink.Direction);
+
+ src.Dispose();
+ sink.Dispose();
+ }
+
+ public static Caps PadGetCapsStub(Pad pad)
+ {
+ return Caps.FromString("video/x-raw-yuv");
+ }
+
+ [Test]
+ public void TestFuncAssigning()
+ {
+ Pad src = new Pad("src", PadDirection.Src);
+ src.GetcapsFunction = new PadGetCapsFunction(PadGetCapsStub);
+
+ Caps caps = src.Caps;
+
+ Assert.IsNotNull(caps, "Ooops, returned caps is null");
+ Assert.IsFalse(caps.IsEmpty == true, "Ooops, returned caps are empty");
+ Assert.AreEqual("video/x-raw-yuv", caps.ToString ());
+
+ caps.Dispose();
+ src.Dispose();
+ }
+
+ [Test]
+ public void TestElementPadAccessByName()
+ {
+ Element element = ElementFactory.Make("identity", null);
+ Assert.IsNotNull(element);
+ Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has \
null handle"); +
+ Pad src = element.GetPad("src");
+ Pad sink = element.GetPad("sink");
+
+ Assert.IsNotNull(src, "Ooops, src pad is null");
+ Assert.IsNotNull(sink, "Ooops, sink pad is null");
+
+ Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
+ Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null \
handle"); +
+ Caps srccaps = src.Caps;
+ Assert.IsTrue(srccaps.IsAny, "How come src pad caps is not ANY?");
+
+ Caps sinkcaps = sink.Caps;
+ Assert.IsTrue(sinkcaps.IsAny, "How come sink pad caps is not ANY?");
+
+ src.Dispose();
+ sink.Dispose();
+ srccaps.Dispose();
+ sinkcaps.Dispose();
+ element.Dispose();
+ }
+
+ [Test]
+ public void TestElementPadAccessByList()
+ {
+ Element element = ElementFactory.Make("identity", null);
+ Assert.IsNotNull(element);
+ Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has \
null handle"); +
+ Assert.AreEqual(2, element.Numpads);
+ Pad [] pads = new Pad [element.Numpads];
+ element.Pads.CopyTo (pads, 0);
+
+ bool hassink = false;
+ bool hassrc = false;
+
+ for(int i = 0; i < element.Numpads; i++) {
+ if (pads [i].Name == "src")
+ hassrc = true;
+ else if (pads [i].Name == "sink")
+ hassink = true;
+ }
+
+ Assert.IsTrue(hassink, "Sink pad not found in the list");
+ Assert.IsTrue(hassrc, "Src pad not found in the list");
+
+ element.Dispose();
+ }
+
+}
_______________________________________________
Mono-patches maillist - Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic