Commit 2aaf72d2 authored by Wim Taymans's avatar Wim Taymans Committed by Wim Taymans
Browse files

tests: add a unit-test for the stream-status

Add a unit test for the STREAM_STATUS messages.
parent b59045aa
......@@ -186,6 +186,60 @@ GST_START_TEST (test_parsing)
void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);
GstStreamStatusType type;
GstTask *task, *task2;
GValue value = { 0 };
const GValue *val;
message =
gst_message_new_stream_status (NULL, GST_STREAM_STATUS_TYPE_ENTER,
fail_if (message == NULL);
fail_unless (GST_MESSAGE_SRC (message) == NULL);
/* set some wrong values to check if the parse method overwrites them
* with the good values */
gst_message_parse_stream_status (message, &type, NULL);
fail_unless (type == GST_STREAM_STATUS_TYPE_ENTER);
/* create a task with some dummy function, we're not actually going to run
* the task here */
task = gst_task_create ((GstTaskFunction) gst_object_unref, NULL);
ASSERT_OBJECT_REFCOUNT (task, "task", 1);
/* set the task */
g_value_init (&value, GST_TYPE_TASK);
g_value_set_object (&value, task);
ASSERT_OBJECT_REFCOUNT (task, "task", 2);
gst_message_set_stream_status_object (message, &value);
ASSERT_OBJECT_REFCOUNT (task, "task", 3);
g_value_unset (&value);
ASSERT_OBJECT_REFCOUNT (task, "task", 2);
gst_object_unref (task);
ASSERT_OBJECT_REFCOUNT (task, "task", 1);
/* get the object back, no refcount is changed */
val = gst_message_get_stream_status_object (message);
ASSERT_OBJECT_REFCOUNT (task, "task", 1);
task2 = g_value_get_object (val);
fail_unless (GST_IS_TASK (task2));
fail_unless (task2 == task);
ASSERT_OBJECT_REFCOUNT (task, "task", 1);
ASSERT_OBJECT_REFCOUNT (task2, "task", 1);
gst_message_unref (message);
GstState state;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment