summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Dominic K <michaldominik@gmail.com>2006-05-30 20:10:57 +0000
committerMichael Dominic K <michaldominik@gmail.com>2006-05-30 20:10:57 +0000
commitce927fccaef7ea37cb0cb9daed54470095d50de8 (patch)
tree8bf4aed78815d7bb528e30a88102860aa50b5556 /tests
parent8c72b3b63134dd9b82c789a4eeaa81d20883315c (diff)
2006-05-30 Michael Dominic K. <michaldominik@gmail.com>
* README: Fixing a broken svn link to gtk-sharp sources. * tests/CapsTest.cs: * tests/Makefile.am: Introducing a new test for Gst.Caps. All fixtures pass. git-svn-id: svn://anonsvn.mono-project.com/source/branches/abock/gstreamer-sharp@61284 e3ebcda4-bce8-0310-ba0a-eca2169e7518
Diffstat (limited to 'tests')
-rw-r--r--tests/CapsTest.cs88
-rw-r--r--tests/Makefile.am2
2 files changed, 89 insertions, 1 deletions
diff --git a/tests/CapsTest.cs b/tests/CapsTest.cs
new file mode 100644
index 0000000..66d67ae
--- /dev/null
+++ b/tests/CapsTest.cs
@@ -0,0 +1,88 @@
+//
+// CapsTest.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 CapsTest
+{
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ Application.Init();
+ }
+
+ [TestFixtureTearDown]
+ public void Deinit()
+ {
+ Application.Deinit();
+ }
+
+ [Test]
+ public void TestPlainCreation()
+ {
+ Caps caps = new Caps();
+ Assert.IsNotNull(caps);
+ Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
+
+ caps.Dispose();
+ }
+
+ [Test]
+ public void TestFromString()
+ {
+ Caps caps = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)384, " +
+ "height=(int)288, " +
+ "framerate=(fraction)25/1");
+ Assert.IsNotNull(caps);
+
+ Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
+ Assert.IsTrue(caps.IsFixed, "Caps should be FIXED!");
+ Assert.IsFalse(caps.IsEmpty, "Caps shouldn't be EMPTY!");
+ Assert.IsFalse(caps.IsAny, "Caps shouldn't be ANY!");
+
+ caps.Dispose();
+ }
+
+ [Test]
+ public void TestIntersecting()
+ {
+ Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)[ 1,1000 ], " +
+ "height=(int)[ 1, 1000 ], " +
+ "framerate=(fraction)[ 0/1, 100/1 ]");
+ Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
+ "format=(fourcc)I420, " +
+ "width=(int)640, " +
+ "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.Intersect(caps2);
+
+ 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 ());
+
+ caps1.Dispose();
+ caps2.Dispose();
+ caps3.Dispose();
+ }
+
+}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d6909ce..f92f358 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,7 @@ NUNIT_FLAGS = @MONO_NUNIT_LIBS@
ASSEMBLY_NAME = gstreamer-tests
ASSEMBLY = $(ASSEMBLY_NAME).dll
-ASSEMBLY_CSFILES = $(srcdir)/ApplicationTest.cs $(srcdir)/BinTest.cs
+ASSEMBLY_CSFILES = $(srcdir)/ApplicationTest.cs $(srcdir)/BinTest.cs $(srcdir)/CapsTest.cs
NUNIT_TESTER_NAME = ConsoleUi
NUNIT_TESTER = $(NUNIT_TESTER_NAME).exe