From 18682a36043bcca0fc7277a8852511d1665c66e5 Mon Sep 17 00:00:00 2001 From: Maarten Bosmans Date: Sat, 13 Jun 2009 11:42:15 +0200 Subject: [PATCH] Remove all the Refcount tests The refcount of GstObjects isn't public anymore and shouldn't be tested for anyway. --- tests/BufferTest.cs | 32 ------------- tests/ElementTest.cs | 122 -------------------------------------------------- tests/PipelineTest.cs | 30 ------------- 3 files changed, 184 deletions(-) diff --git a/tests/BufferTest.cs b/tests/BufferTest.cs index 5abcab4..4f2b60d 100644 --- a/tests/BufferTest.cs +++ b/tests/BufferTest.cs @@ -22,37 +22,7 @@ public class BufferTest { { Application.Deinit(); } -/* - [Test] - public void TestCaps() - { - Gst.Buffer buffer = new Gst.Buffer(4); - Caps caps = Caps.FromString("audio/x-raw-int"); - Assert.AreEqual(caps.Refcount, 1, "caps"); - Assert.IsNull(buffer.Caps, "buffer.Caps is null???"); - - buffer.Caps = caps; - Assert.AreEqual(caps.Refcount, 2, "caps"); - - Caps caps2 = Caps.FromString("audio/x-raw-float"); - Assert.AreEqual(caps2.Refcount, 1, "caps2"); - buffer.Caps = caps2; - Assert.AreEqual(caps.Refcount, 1, "caps"); - Assert.AreEqual(caps2.Refcount, 1, "caps2"); - - buffer.Caps = null; - Assert.AreEqual(caps.Refcount, 1, "caps"); - Assert.AreEqual(caps2.Refcount, 1, "caps2"); - - buffer.Caps = caps2; - Assert.AreEqual(caps2.Refcount, 2, "caps2"); - buffer.Dispose(); - Assert.AreEqual(caps2.Refcount, 1, "caps2"); - caps.Dispose(); - caps2.Dispose(); - } -*/ [Test] public void TestSubbuffer() { @@ -60,8 +30,6 @@ public class BufferTest { Gst.Buffer sub = buffer.CreateSub(1, 2); Assert.IsNotNull(sub); Assert.AreEqual(sub.Size, 2, "subbuffer has wrong size"); - //Assert.AreEqual(buffer.Refcount, 2, "parent"); - //Assert.AreEqual(sub.Refcount, 1, "subbuffer"); //sub.Dispose(); buffer.Dispose(); diff --git a/tests/ElementTest.cs b/tests/ElementTest.cs index 0451827..7f812b3 100644 --- a/tests/ElementTest.cs +++ b/tests/ElementTest.cs @@ -28,134 +28,12 @@ public class ElementTest } [Test] - public void TestBinAdd() - { - Element src = ElementFactory.Make("fakesrc", null); - Element sink = ElementFactory.Make("fakesink", null); - - Assert.AreEqual(src.Refcount, 1, "fakesrc"); - Assert.AreEqual(sink.Refcount, 1, "fakesink"); - - Element pipeline = new Pipeline(String.Empty); - - Assert.AreEqual(pipeline.Refcount, 1, "pipeline"); - - Bin bin = (Bin) pipeline; - Assert.AreEqual(bin.Refcount, 1, "bin"); - Assert.AreEqual(pipeline.Refcount, 1, "pipeline"); - - bin.AddMany(src, sink); - Assert.AreEqual(src.Refcount, 2, "src"); - Assert.AreEqual(sink.Refcount, 2, "sink"); - Assert.AreEqual(bin.Refcount, 1, "bin"); - Assert.AreEqual(pipeline.Refcount, 1, "pipeline"); - - src.Link(sink); - - src.Dispose(); - sink.Dispose(); - pipeline.Dispose(); - } - - [Test] - public void TestAddRemovePad() - { - Element e = ElementFactory.Make("fakesrc", "source"); - Pad p = new Pad("source", PadDirection.Src); - Assert.AreEqual(p.Refcount, 1, "pad"); - - e.AddPad(p); - Assert.AreEqual(p.Refcount, 2, "pad"); - - e.RemovePad(p); - - p.Dispose(); - e.Dispose(); - } - - [Test] - public void TestAddPadUnrefElement () - { - Element e = ElementFactory.Make("fakesrc", "source"); - Assert.IsNotNull(e, "Could not create fakesrc"); - Assert.IsTrue(e.GetType() == typeof(Gst.Element)); - Assert.AreEqual(e.Refcount, 1); - - Pad p = new Pad("source", PadDirection.Src); - Assert.AreEqual(p.Refcount, 1, "pad"); - - Gst.Object.Ref(p.Handle); - Assert.AreEqual(p.Refcount, 2, "pad"); - - e.AddPad(p); - Assert.AreEqual(p.Refcount, 3, "pad"); - - Gst.Object.Unref(p.Handle); - Assert.AreEqual(p.Refcount, 2, "pad"); - - Assert.AreEqual(e.Refcount, 1); - - e.Dispose(); - Assert.AreEqual(p.Refcount, 1, "pad"); - - p.Dispose(); - } - - [Test] public void TestErrorNoBus() { Element e = ElementFactory.Make("fakesrc", "source"); e.Dispose(); } -/* - [Test] - public void TestLink() - { - State state, pending; - - Element source = ElementFactory.Make("fakesrc", "source"); - Assert.IsNotNull(source); - - Element sink = ElementFactory.Make("fakesink", "sink"); - Assert.IsNotNull(sink); - - Assert.AreEqual(source.Refcount, 1, source.Name); - Assert.AreEqual(sink.Refcount, 1, "sink"); - Assert.IsTrue(source.LinkPads("src", sink, "sink")); - - sink.SetState(State.Paused); - source.SetState(State.Paused); - - Assert.AreEqual(source.Refcount, 1, "src"); - Assert.AreEqual(sink.Refcount, 1, "sink"); - - sink.GetState(out state, out pending, Clock.TimeNone); - - sink.SetState(State.Playing); - source.SetState(State.Playing); - - // Sleep - System.Threading.Thread.Sleep(500); - - sink.SetState(State.Paused); - source.SetState(State.Paused); - - sink.GetState(out state, out pending, Clock.TimeNone); - - Assert.AreEqual(sink.Refcount, 1, "sink"); - Assert.AreEqual(source.Refcount, 1, "src"); - - source.UnlinkPads("src", sink, "sink"); - - Assert.AreEqual(sink.Refcount, 1, "sink"); - Assert.AreEqual(source.Refcount, 1, "src"); - - source.Dispose(); - sink.Dispose(); - } -*/ - [Test] public void TestLinkNoPads() { diff --git a/tests/PipelineTest.cs b/tests/PipelineTest.cs index ebe4764..c3bf186 100644 --- a/tests/PipelineTest.cs +++ b/tests/PipelineTest.cs @@ -91,24 +91,6 @@ public class PipelineTest pipeline.Dispose(); } - [Test] - public void TestGetBus() - { - Pipeline pipeline = new Pipeline(String.Empty); - Assert.IsNotNull(pipeline, "Could not create pipeline"); - - Assert.AreEqual(pipeline.Refcount, 1, "Refcount is not 1, it is " + pipeline.Refcount); - - Bus bus = pipeline.Bus; - Assert.AreEqual(pipeline.Refcount, 1, "Refcount after .Bus"); - Assert.AreEqual(bus.Refcount, 2, "bus.Refcount != 2, it is " + bus.Refcount); - - pipeline.Dispose(); - - Assert.AreEqual(bus.Refcount, 1, "bus after unref pipeline"); - bus.Dispose(); - } - Element pipeline; GLib.MainLoop loop; @@ -148,14 +130,6 @@ public class PipelineTest bin.AddMany(src, sink); Assert.IsTrue(src.Link(sink), "Could not link between src and sink"); - Bus bus = ((Pipeline)pipeline).Bus; - Assert.AreEqual(pipeline.Refcount, 1, "pipeline's refcount after .Bus"); - Assert.AreEqual(bus.Refcount, 2, "bus"); - - uint id = bus.AddWatch(new BusFunc(MessageReceived)); - Assert.AreEqual(pipeline.Refcount, 1, "pipeline after AddWatch"); - Assert.AreEqual(bus.Refcount, 3, "bus after add_watch"); - Assert.AreEqual(pipeline.SetState(State.Playing), StateChangeReturn.Async); loop = new GLib.MainLoop(); @@ -166,11 +140,7 @@ public class PipelineTest Assert.AreEqual(pipeline.GetState(out current, out pending, Clock.TimeNone), StateChangeReturn.Success); Assert.AreEqual(current, State.Null, "state is not NULL but " + current); - Assert.AreEqual(pipeline.Refcount, 1, "pipeline at start of cleanup"); - Assert.AreEqual(bus.Refcount, 3, "bus at start of cleanup"); - pipeline.Dispose(); - bus.Dispose(); } [Test] -- 2.7.4