From 08a71b98a9302754cf04661d4c676f13a7d4ca0c Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 10 Jan 2011 14:37:41 -0300 Subject: [PATCH] test: outputselector: Add another negotiation test Adds an unit test to check that the output-selector works when negotiating before srcpads are requested --- tests/check/elements/selector.c | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/check/elements/selector.c b/tests/check/elements/selector.c index 0f91166..e210a11 100644 --- a/tests/check/elements/selector.c +++ b/tests/check/elements/selector.c @@ -372,6 +372,49 @@ GST_START_TEST (test_input_selector_buffer_count); GST_END_TEST; + +GST_START_TEST (test_output_selector_no_srcpad_negotiation); +{ + GstElement *sel; + GstCaps *caps; + GstPad *pad; + gint i; + + sel = gst_element_factory_make ("output-selector", NULL); + fail_unless (sel != NULL); + + pad = gst_element_get_static_pad (sel, "sink"); + fail_unless (pad != NULL); + + fail_unless (gst_element_set_state (sel, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + for (i = 0; i <= 2; i++) { + + /* regardless of pad-negotiation-mode, getcaps should return ANY and + * setcaps should accept any caps when there are no srcpads */ + g_object_set (sel, "pad-negotiation-mode", i, NULL); + + caps = gst_pad_get_caps (pad); + fail_unless (gst_caps_is_any (caps)); + + gst_caps_unref (caps); + + caps = gst_caps_new_simple ("mymedia/mycaps", NULL); + fail_unless (gst_pad_set_caps (pad, caps)); + gst_caps_unref (caps); + } + + fail_unless (gst_element_set_state (sel, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); + gst_object_unref (pad); + gst_object_unref (sel); +} + +GST_END_TEST; + + GstElement *sel; GstPad *input_pad; GList *output_pads = NULL; /* list of sinkpads linked to output-selector */ @@ -535,6 +578,7 @@ selector_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_output_selector_buffer_count); tcase_add_test (tc_chain, test_input_selector_buffer_count); + tcase_add_test (tc_chain, test_output_selector_no_srcpad_negotiation); tc_chain = tcase_create ("output-selector-negotiation"); tcase_add_checked_fixture (tc_chain, setup_output_selector, -- 2.7.4