From: Thiago Santos Date: Mon, 10 Jan 2011 17:37:41 +0000 (-0300) Subject: test: outputselector: Add another negotiation test X-Git-Tag: RELEASE-0.10.32~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08a71b98a9302754cf04661d4c676f13a7d4ca0c;p=platform%2Fupstream%2Fgstreamer.git test: outputselector: Add another negotiation test Adds an unit test to check that the output-selector works when negotiating before srcpads are requested --- 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,