summaryrefslogtreecommitdiff
path: root/tests/check/gst/gstghostpad.c
diff options
context:
space:
mode:
authorAlessandro Decina <alessandro.d@gmail.com>2008-12-17 16:16:45 +0000
committerAlessandro Decina <alessandro.d@gmail.com>2008-12-17 16:16:45 +0000
commitc0a2c5839e9325d8343b56ff73bd4ba9e63bbeae (patch)
tree2850fe8d012fc28db6ae6d2728e0f81aa4ef1df9 /tests/check/gst/gstghostpad.c
parent33239dded79d623aa0712a244f71c9e5baaab890 (diff)
downloadgstreamer-c0a2c5839e9325d8343b56ff73bd4ba9e63bbeae.tar.gz
In a source ghostpad, when caps are changed in the target pad, the change needs to be reflected in the ghostpad.
Original commit message from CVS: * gst/gstghostpad.c: * tests/check/gst/gstghostpad.c: In a source ghostpad, when caps are changed in the target pad, the change needs to be reflected in the ghostpad. Fixes #564863.
Diffstat (limited to 'tests/check/gst/gstghostpad.c')
-rw-r--r--tests/check/gst/gstghostpad.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/check/gst/gstghostpad.c b/tests/check/gst/gstghostpad.c
index 577cc49954..ed39268e0a 100644
--- a/tests/check/gst/gstghostpad.c
+++ b/tests/check/gst/gstghostpad.c
@@ -668,6 +668,65 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template)
GST_END_TEST;
+static void
+ghost_notify_caps (GObject * object, GParamSpec * pspec, gpointer * user_data)
+{
+ (*(gint *) user_data)++;
+}
+
+GST_START_TEST (test_ghost_pads_forward_setcaps)
+{
+ GstCaps *templ_caps, *caps1, *caps2;
+ GstPadTemplate *src_template, *sink_template;
+ GstPad *src, *ghost, *sink;
+ gint notify_counter = 0;
+
+ templ_caps = gst_caps_from_string ("meh; muh");
+ src_template = gst_pad_template_new ("src", GST_PAD_SRC,
+ GST_PAD_ALWAYS, templ_caps);
+ sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
+ GST_PAD_ALWAYS, templ_caps);
+ gst_caps_unref (templ_caps);
+
+ src = gst_pad_new_from_template (src_template, "src");
+ sink = gst_pad_new_from_template (sink_template, "sink");
+
+ /* ghost source pad */
+ ghost = gst_ghost_pad_new ("ghostsrc", src);
+ g_signal_connect (ghost, "notify::caps",
+ G_CALLBACK (ghost_notify_caps), &notify_counter);
+ fail_unless (gst_pad_link (ghost, sink) == GST_PAD_LINK_OK);
+
+ caps1 = gst_caps_from_string ("meh");
+ fail_unless (gst_pad_set_caps (src, caps1));
+ caps2 = GST_PAD_CAPS (ghost);
+ 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 */
+ notify_counter = 0;
+ ghost = gst_ghost_pad_new ("ghostsink", sink);
+ g_signal_connect (ghost, "notify::caps",
+ G_CALLBACK (ghost_notify_caps), &notify_counter);
+ fail_unless (gst_pad_link (src, ghost) == GST_PAD_LINK_OK);
+
+ caps1 = gst_caps_from_string ("muh");
+ fail_unless (gst_pad_set_caps (ghost, caps1));
+ caps2 = GST_PAD_CAPS (sink);
+ fail_unless (gst_caps_is_equal (caps1, caps2));
+ fail_unless_equals_int (notify_counter, 1);
+
+ gst_object_unref (src);
+ gst_object_unref (sink);
+ gst_object_unref (src_template);
+ gst_object_unref (sink_template);
+}
+
+GST_END_TEST;
+
static Suite *
gst_ghost_pad_suite (void)
{
@@ -686,6 +745,7 @@ gst_ghost_pad_suite (void)
tcase_add_test (tc_chain, test_ghost_pads_probes);
tcase_add_test (tc_chain, test_ghost_pads_new_from_template);
tcase_add_test (tc_chain, test_ghost_pads_new_no_target_from_template);
+ tcase_add_test (tc_chain, test_ghost_pads_forward_setcaps);
return s;
}