From 6bb62a810a33751a591465a80b5ff56748ca987a Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 27 May 2008 18:31:39 +0000 Subject: [PATCH] tests/check/gst/gstpipeline.c: Extending the test a little to verify that we also get the NULL state- change message. Original commit message from CVS: * tests/check/gst/gstpipeline.c: Extending the test a little to verify that we also get the NULL state- change message. --- ChangeLog | 6 ++++++ tests/check/gst/gstpipeline.c | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06a0d9ea69..d3313a2cab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-27 Stefan Kost + + * tests/check/gst/gstpipeline.c: + Extending the test a little to verify that we also get the NULL state- + change message. + 2008-05-27 Tim-Philipp Müller * gst/gstpreset.c: (gst_preset_default_get_meta), diff --git a/tests/check/gst/gstpipeline.c b/tests/check/gst/gstpipeline.c index ac767f71c9..e1bfd495fa 100644 --- a/tests/check/gst/gstpipeline.c +++ b/tests/check/gst/gstpipeline.c @@ -65,13 +65,12 @@ GST_START_TEST (test_async_state_change_fake_ready) GST_END_TEST; - GST_START_TEST (test_async_state_change_fake) { GstPipeline *pipeline; GstElement *src, *sink; GstBus *bus; - gboolean done = FALSE; + gboolean done; pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); fail_unless (pipeline != NULL, "Could not create pipeline"); @@ -87,6 +86,7 @@ GST_START_TEST (test_async_state_change_fake) fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING), GST_STATE_CHANGE_ASYNC); + done = FALSE; while (!done) { GstMessage *message; GstState old, new, pending; @@ -104,6 +104,21 @@ GST_START_TEST (test_async_state_change_fake) fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL), GST_STATE_CHANGE_SUCCESS); + done = FALSE; + while (!done) { + GstMessage *message; + GstState old, new, pending; + + message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); + if (message) { + gst_message_parse_state_changed (message, &old, &new, &pending); + GST_DEBUG_OBJECT (message->src, "state change from %d to %d", old, new); + if (message->src == GST_OBJECT (pipeline) && new == GST_STATE_NULL) + done = TRUE; + gst_message_unref (message); + } + } + gst_object_unref (bus); gst_object_unref (pipeline); }