diff --git a/ChangeLog b/ChangeLog index a84db62183..a0c8cee646 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-12-19 Wim Taymans + + * tests/check/gst/gstghostpad.c: (ghost_notify_caps), + (GST_START_TEST): + Add some more unit-tests for the ghostpad notify signal, one of which + currently fails. + 2008-12-19 Sebastian Dröge * win32/common/libgstreamer.def: diff --git a/tests/check/gst/gstghostpad.c b/tests/check/gst/gstghostpad.c index ed39268e0a..258b54cda8 100644 --- a/tests/check/gst/gstghostpad.c +++ b/tests/check/gst/gstghostpad.c @@ -671,6 +671,7 @@ GST_END_TEST; static void ghost_notify_caps (GObject * object, GParamSpec * pspec, gpointer * user_data) { + GST_DEBUG ("caps notify called"); (*(gint *) user_data)++; } @@ -691,7 +692,8 @@ GST_START_TEST (test_ghost_pads_forward_setcaps) src = gst_pad_new_from_template (src_template, "src"); sink = gst_pad_new_from_template (sink_template, "sink"); - /* ghost source pad */ + /* ghost source pad, setting caps on the source influences the caps of the + * ghostpad. */ ghost = gst_ghost_pad_new ("ghostsrc", src); g_signal_connect (ghost, "notify::caps", G_CALLBACK (ghost_notify_caps), ¬ify_counter); @@ -706,7 +708,28 @@ GST_START_TEST (test_ghost_pads_forward_setcaps) gst_object_unref (ghost); gst_caps_unref (caps1); - /* ghost sink pad */ + fail_unless (gst_pad_set_caps (src, NULL)); + + /* source 2, setting the caps on the ghostpad does not influence the caps of + * the target */ + notify_counter = 0; + ghost = gst_ghost_pad_new ("ghostsrc", src); + g_signal_connect (ghost, "notify::caps", + G_CALLBACK (ghost_notify_caps), ¬ify_counter); + fail_unless (gst_pad_link (ghost, sink) == GST_PAD_LINK_OK); + + caps1 = gst_caps_from_string ("meh"); + fail_unless (gst_pad_set_caps (ghost, caps1)); + caps2 = GST_PAD_CAPS (src); + fail_unless (gst_caps_is_equal (caps1, caps2)); + fail_unless_equals_int (notify_counter, 1); + + gst_object_unref (ghost); + gst_caps_unref (caps1); + + + /* ghost sink pad. Setting caps on the ghostpad will also set those caps on + * the target pad. */ notify_counter = 0; ghost = gst_ghost_pad_new ("ghostsink", sink); g_signal_connect (ghost, "notify::caps", @@ -719,6 +742,26 @@ GST_START_TEST (test_ghost_pads_forward_setcaps) fail_unless (gst_caps_is_equal (caps1, caps2)); fail_unless_equals_int (notify_counter, 1); + gst_object_unref (ghost); + gst_caps_unref (caps1); + + /* sink pad 2, setting caps just on the target pad should not influence the caps + * on the ghostpad. */ + notify_counter = 0; + ghost = gst_ghost_pad_new ("ghostsink", sink); + g_signal_connect (ghost, "notify::caps", + G_CALLBACK (ghost_notify_caps), ¬ify_counter); + fail_unless (gst_pad_link (src, ghost) == GST_PAD_LINK_OK); + + caps1 = gst_caps_from_string ("muh"); + fail_unless (gst_pad_set_caps (sink, caps1)); + caps2 = GST_PAD_CAPS (ghost); + fail_unless (caps2 == NULL); + fail_unless_equals_int (notify_counter, 0); + + gst_object_unref (ghost); + gst_caps_unref (caps1); + gst_object_unref (src); gst_object_unref (sink); gst_object_unref (src_template);