mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 13:36:39 +00:00
ghostpad: add some tests for activation
https://bugzilla.gnome.org/show_bug.cgi?id=761913
This commit is contained in:
parent
ab55ad7eaa
commit
87c2254b1d
1 changed files with 65 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/check/gstharness.h>
|
||||||
|
|
||||||
/* test if removing a bin also cleans up the ghostpads
|
/* test if removing a bin also cleans up the ghostpads
|
||||||
*/
|
*/
|
||||||
|
@ -1167,6 +1168,67 @@ GST_START_TEST (test_ghost_pads_remove_while_playing)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
|
||||||
|
GST_START_TEST (test_activate_src)
|
||||||
|
{
|
||||||
|
GstHarness *h;
|
||||||
|
GstElement *b;
|
||||||
|
GstElement *src;
|
||||||
|
GstPad *srcpad;
|
||||||
|
|
||||||
|
b = gst_bin_new (NULL);
|
||||||
|
src = gst_element_factory_make ("fakesrc", NULL);
|
||||||
|
g_object_set (src, "sync", TRUE, NULL);
|
||||||
|
gst_bin_add (GST_BIN (b), src);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (src, "src");
|
||||||
|
gst_element_add_pad (b, gst_ghost_pad_new ("src", srcpad));
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
|
h = gst_harness_new_with_element (b, NULL, "src");
|
||||||
|
gst_harness_play (h);
|
||||||
|
|
||||||
|
gst_harness_crank_single_clock_wait (h);
|
||||||
|
gst_buffer_unref (gst_harness_pull (h));
|
||||||
|
|
||||||
|
gst_object_unref (b);
|
||||||
|
gst_harness_teardown (h);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_activate_sink_and_src)
|
||||||
|
{
|
||||||
|
GstHarness *h;
|
||||||
|
GstElement *b;
|
||||||
|
GstElement *element;
|
||||||
|
GstPad *sinkpad;
|
||||||
|
GstPad *srcpad;
|
||||||
|
|
||||||
|
b = gst_bin_new (NULL);
|
||||||
|
element = gst_element_factory_make ("identity", NULL);
|
||||||
|
gst_bin_add (GST_BIN (b), element);
|
||||||
|
|
||||||
|
sinkpad = gst_element_get_static_pad (element, "sink");
|
||||||
|
gst_element_add_pad (b, gst_ghost_pad_new ("sink", sinkpad));
|
||||||
|
gst_object_unref (sinkpad);
|
||||||
|
|
||||||
|
srcpad = gst_element_get_static_pad (element, "src");
|
||||||
|
gst_element_add_pad (b, gst_ghost_pad_new ("src", srcpad));
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
|
h = gst_harness_new_with_element (b, "sink", "src");
|
||||||
|
gst_harness_set_src_caps_str (h, "mycaps");
|
||||||
|
|
||||||
|
gst_harness_push (h, gst_buffer_new());
|
||||||
|
gst_buffer_unref (gst_harness_pull (h));
|
||||||
|
|
||||||
|
gst_object_unref (b);
|
||||||
|
gst_harness_teardown (h);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
gst_ghost_pad_suite (void)
|
gst_ghost_pad_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -1193,6 +1255,9 @@ gst_ghost_pad_suite (void)
|
||||||
tcase_add_test (tc_chain, test_ghost_pads_internal_link);
|
tcase_add_test (tc_chain, test_ghost_pads_internal_link);
|
||||||
tcase_add_test (tc_chain, test_ghost_pads_remove_while_playing);
|
tcase_add_test (tc_chain, test_ghost_pads_remove_while_playing);
|
||||||
|
|
||||||
|
tcase_add_test (tc_chain, test_activate_src);
|
||||||
|
tcase_add_test (tc_chain, test_activate_sink_and_src);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue