From: <bi...@ke...> - 2006-06-12 12:43:57
|
CVS Root: /cvs/gstreamer Module: gnonlin Changes by: bilboed Date: Mon Jun 12 2006 12:43:55 UTC Log message: * tests/check/complex.c: (GST_START_TEST), (gnonlin_suite): Added unit-test for the previous fixes to gnlcomposition with default sources. Modified files: . : ChangeLog tests/check : complex.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gnonlin/ChangeLog.diff?r1=1.128&r2=1.129 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gnonlin/tests/check/complex.c.diff?r1=1.3&r2=1.4 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gnonlin/ChangeLog,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- ChangeLog 12 Jun 2006 11:33:05 -0000 1.128 +++ ChangeLog 12 Jun 2006 12:43:43 -0000 1.129 @@ -1,5 +1,11 @@ 2006-06-12 Edward Hervey <ed...@fl...> + * tests/check/complex.c: (GST_START_TEST), (gnonlin_suite): + Added unit-test for the previous fixes to gnlcomposition with default + sources. + +2006-06-12 Edward Hervey <ed...@fl...> * gnl/gnlcomposition.c: (next_stop_in_region_above_priority), (get_stack_list): Fixed wrong get_stack_list(), stop at the correct place. Index: complex.c RCS file: /cvs/gstreamer/gnonlin/tests/check/complex.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- complex.c 8 Jun 2006 15:44:59 -0000 1.3 +++ complex.c 12 Jun 2006 12:43:43 -0000 1.4 @@ -368,6 +368,245 @@ GST_END_TEST; +GST_START_TEST (test_one_default_another) +{ + GstElement *pipeline; + GstElement *comp, *sink, *source1, *source2, *source3, *defaultsrc; + CollectStructure *collect; + GstBus *bus; + GstMessage *message; + gboolean carry_on = TRUE; + guint64 start, stop; + gint64 duration; + GstPad *sinkpad; + pipeline = gst_pipeline_new ("test_pipeline"); + comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + fail_if (comp == NULL); + /* + defaultsrc source + Start : 0s + Duration : 5s + Priority : 2 + */ + + defaultsrc = videotest_gnl_src ("defaultsrc", 0, 5 * GST_SECOND, 2, 2); + fail_if (defaultsrc == NULL); + check_start_stop_duration(defaultsrc, 0, 5 * GST_SECOND, 5 * GST_SECOND); + + Source 1 + Duration : 1s + Priority : 1 + source1 = videotest_gnl_src ("source1", 0, 1 * GST_SECOND, 1, 1); + fail_if (source1 == NULL); + check_start_stop_duration(source1, 0, 1 * GST_SECOND, 1 * GST_SECOND); + Source 2 + Start : 2s + source2 = videotest_gnl_src ("source2", 2 * GST_SECOND, 1 * GST_SECOND, 2, 1); + fail_if (source2 == NULL); + check_start_stop_duration(source2, 2 * GST_SECOND, 3 * GST_SECOND, 1 * GST_SECOND); + Source 3 + Start : 3s + source3 = videotest_gnl_src ("source3", 3 * GST_SECOND, 1 * GST_SECOND, 2, 1); + fail_if (source3 == NULL); + check_start_stop_duration(source3, 3 * GST_SECOND, 4 * GST_SECOND, 1 * GST_SECOND); + /* Add one source */ + gst_bin_add (GST_BIN (comp), source1); + check_start_stop_duration(comp, 0, 1 * GST_SECOND, 1 * GST_SECOND); + ASSERT_OBJECT_REFCOUNT(source1, "source1", 1); + /* Second source */ + gst_bin_add (GST_BIN (comp), source2); + check_start_stop_duration(comp, 0, 3 * GST_SECOND, 3 * GST_SECOND); + ASSERT_OBJECT_REFCOUNT(source2, "source2", 1); + /* Third source */ + gst_bin_add (GST_BIN (comp), source3); + check_start_stop_duration(comp, 0, 4 * GST_SECOND, 4 * GST_SECOND); + ASSERT_OBJECT_REFCOUNT(source3, "source3", 1); + /* defaultsrc source */ + gst_bin_add (GST_BIN (comp), defaultsrc); + check_start_stop_duration(comp, 0, 5 * GST_SECOND, 5 * GST_SECOND); + ASSERT_OBJECT_REFCOUNT(defaultsrc, "defaultsrc", 1); + sink = gst_element_factory_make_or_warn ("fakesink", "sink"); + fail_if (sink == NULL); + gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL); + /* Shared data */ + collect = g_new0 (CollectStructure, 1); + collect->comp = comp; + collect->sink = sink; + /* Expected segments */ + collect->expected_segments = g_list_append (collect->expected_segments, + segment_new (1.0, GST_FORMAT_TIME, + 0, 1 * GST_SECOND, 0)); + 1 * GST_SECOND, 2 * GST_SECOND, + 1 * GST_SECOND)); + 2 * GST_SECOND, 3 * GST_SECOND, + 2 * GST_SECOND)); + 3 * GST_SECOND, 4 * GST_SECOND, + 3 * GST_SECOND)); + 4 * GST_SECOND, 5 * GST_SECOND, + 4 * GST_SECOND)); + g_signal_connect (G_OBJECT (comp), "pad-added", + G_CALLBACK (composition_pad_added_cb), collect); + sinkpad = gst_element_get_pad (sink, "sink"); + gst_pad_add_event_probe (sinkpad, G_CALLBACK (sinkpad_event_probe), collect); + gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (sinkpad_buffer_probe), collect); + bus = gst_element_get_bus (GST_ELEMENT (pipeline)); + GST_DEBUG ("Setting pipeline to PLAYING"); + fail_if (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE); + GST_DEBUG ("Let's poll the bus"); + while (carry_on) { + message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2); + if (message) { + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_EOS: + /* we should check if we really finished here */ + GST_WARNING ("Got an EOS"); + carry_on = FALSE; + break; + case GST_MESSAGE_SEGMENT_START: + case GST_MESSAGE_SEGMENT_DONE: + /* We shouldn't see any segement messages, since we didn't do a segment seek */ + GST_WARNING ("Saw a Segment start/stop"); + fail_if (TRUE); + case GST_MESSAGE_ERROR: + GST_WARNING ("Saw an ERROR"); + default: + } + gst_mini_object_unref (GST_MINI_OBJECT (message)); + } + } + GST_DEBUG ("Setting pipeline to NULL"); + fail_if (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY) == GST_STATE_CHANGE_FAILURE); + fail_if (collect->expected_segments != NULL); + GST_DEBUG ("Resetted pipeline to READY"); + collect->gotsegment = FALSE; + GST_DEBUG ("Setting pipeline to PLAYING again"); + carry_on = TRUE; + GST_ERROR ("Saw an ERROR"); + } else { + GST_DEBUG ("bus_poll responded, but there wasn't any message..."); + fail_if (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE); + gst_object_unref (GST_OBJECT (sinkpad)); + ASSERT_OBJECT_REFCOUNT_BETWEEN(pipeline, "main pipeline", 1, 2); + gst_object_unref (pipeline); + ASSERT_OBJECT_REFCOUNT_BETWEEN(bus, "main bus", 1, 2); + gst_object_unref (bus); +} +GST_END_TEST; GST_START_TEST (test_one_bin_space_another) { GstElement *pipeline; @@ -630,6 +869,7 @@ gst_version (&major, &minor, µ, &nano); if ((micro > 4) || (micro == 4 && nano > 0)) { tcase_add_test (tc_chain, test_one_space_another); + tcase_add_test (tc_chain, test_one_default_another); tcase_add_test (tc_chain, test_one_bin_space_another); tcase_add_test (tc_chain, test_one_above_another); } |