diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2013-09-24 13:10:36 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-09-24 13:11:47 +0200 |
commit | 8f0c9c705567818fc0d4e01bcf4784bb87e48afb (patch) | |
tree | d38230b189fd549c3560d1c0079a9e2d57e80d50 | |
parent | 02a4830096cd07532a8e7a913c2c54ac57f08aa7 (diff) |
context: Add test for the context caching in GstBin
https://bugzilla.gnome.org/show_bug.cgi?id=708668
-rw-r--r-- | tests/check/gst/gstcontext.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/check/gst/gstcontext.c b/tests/check/gst/gstcontext.c index efdf45fb1..5ba0cd2a3 100644 --- a/tests/check/gst/gstcontext.c +++ b/tests/check/gst/gstcontext.c @@ -285,6 +285,42 @@ GST_START_TEST (test_element_create_self) GST_END_TEST; +GST_START_TEST (test_element_bin_caching) +{ + GstBus *bus; + GstElement *bin; + GstElement *element, *element2; + + bin = gst_bin_new (NULL); + element = g_object_new (gst_context_element_get_type (), NULL); + element2 = g_object_new (gst_context_element_get_type (), NULL); + gst_bin_add_many (GST_BIN (bin), element, element2, NULL); + + /* FIXME: This assumes (as currently is true) the GstBin activates + * the last added element first if none of them is a sink or has pads + */ + ((GstContextElement *) element2)->create_self = TRUE; + ((GstContextElement *) element)->set_from_need_context = TRUE; + + bus = gst_bus_new (); + gst_element_set_bus (bin, bus); + + fail_unless (gst_element_set_state (bin, + GST_STATE_READY) == GST_STATE_CHANGE_SUCCESS); + + fail_unless (((GstContextElement *) element)->have_foobar); + fail_unless (((GstContextElement *) element2)->have_foobar); + + gst_element_set_bus (bin, NULL); + fail_unless (gst_element_set_state (bin, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (bus); + gst_object_unref (bin); +} + +GST_END_TEST; + static Suite * gst_context_suite (void) { @@ -298,6 +334,7 @@ gst_context_suite (void) tcase_add_test (tc_chain, test_element_set_before_ready); tcase_add_test (tc_chain, test_element_set_from_need_context); tcase_add_test (tc_chain, test_element_create_self); + tcase_add_test (tc_chain, test_element_bin_caching); return s; } |