diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-03-30 10:48:47 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-03-30 10:52:36 +0200 |
commit | 8db570f48cf129ae28e36bab58729017d7577a78 (patch) | |
tree | 10c1a77394d2491c1e0b3be95dc36e8b0842fb86 /tests | |
parent | 5368406a57bbc8e2a72768797a16302aa888907f (diff) |
multiqueue: Make assignment of queue IDs and pad names threadsafe
Also add a test for naming pads by the caller and return NULL
when requesting an already existing pad.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/elements/multiqueue.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/check/elements/multiqueue.c b/tests/check/elements/multiqueue.c index e885ff368..467df9cfa 100644 --- a/tests/check/elements/multiqueue.c +++ b/tests/check/elements/multiqueue.c @@ -243,6 +243,50 @@ mq_sinkpad_to_srcpad (GstElement * mq, GstPad * sink) return srcpad; } +GST_START_TEST (test_request_pads_named) +{ + GstElement *mq; + GstPad *sink1, *sink2, *sink3, *sink4; + + mq = gst_element_factory_make ("multiqueue", NULL); + + sink1 = gst_element_get_request_pad (mq, "sink1"); + fail_unless (sink1 != NULL); + fail_unless (GST_IS_PAD (sink1)); + fail_unless (GST_PAD_IS_SINK (sink1)); + fail_unless_equals_string (GST_PAD_NAME (sink1), "sink1"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink1)); + + sink3 = gst_element_get_request_pad (mq, "sink3"); + fail_unless (sink3 != NULL); + fail_unless (GST_IS_PAD (sink3)); + fail_unless (GST_PAD_IS_SINK (sink3)); + fail_unless_equals_string (GST_PAD_NAME (sink3), "sink3"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink3)); + + sink2 = gst_element_get_request_pad (mq, "sink2"); + fail_unless (sink2 != NULL); + fail_unless (GST_IS_PAD (sink2)); + fail_unless (GST_PAD_IS_SINK (sink2)); + fail_unless_equals_string (GST_PAD_NAME (sink2), "sink2"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink2)); + + /* This gets us the first unused id, sink0 */ + sink4 = gst_element_get_request_pad (mq, "sink%d"); + fail_unless (sink4 != NULL); + fail_unless (GST_IS_PAD (sink4)); + fail_unless (GST_PAD_IS_SINK (sink4)); + fail_unless_equals_string (GST_PAD_NAME (sink4), "sink0"); + GST_LOG ("Got pad %s:%s", GST_DEBUG_PAD_NAME (sink4)); + + GST_LOG ("Cleaning up"); + gst_object_unref (sink1); + gst_object_unref (sink2); + gst_object_unref (mq); +} + +GST_END_TEST; + static GstCaps * mq_dummypad_getcaps (GstPad * sinkpad) { @@ -652,6 +696,7 @@ multiqueue_suite (void) tcase_add_test (tc_chain, test_simple_shutdown_while_running); tcase_add_test (tc_chain, test_request_pads); + tcase_add_test (tc_chain, test_request_pads_named); tcase_add_test (tc_chain, test_output_order); |