mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
tests: Update for new GstIterator API
This commit is contained in:
parent
3d807c228c
commit
8ce0fea199
3 changed files with 76 additions and 60 deletions
|
@ -337,7 +337,9 @@ GST_START_TEST (test_internal_links)
|
||||||
GstPad *sinkpad, *srcpad1, *srcpad2;
|
GstPad *sinkpad, *srcpad1, *srcpad2;
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
GstIteratorResult res;
|
GstIteratorResult res;
|
||||||
gpointer val1, val2;
|
GValue val1 = { 0, }
|
||||||
|
, val2 = {
|
||||||
|
0,};
|
||||||
|
|
||||||
tee = gst_check_setup_element ("tee");
|
tee = gst_check_setup_element ("tee");
|
||||||
|
|
||||||
|
@ -347,10 +349,9 @@ GST_START_TEST (test_internal_links)
|
||||||
fail_unless (it != NULL);
|
fail_unless (it != NULL);
|
||||||
|
|
||||||
/* iterator should not return anything */
|
/* iterator should not return anything */
|
||||||
val1 = NULL;
|
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_DONE);
|
fail_unless (res == GST_ITERATOR_DONE);
|
||||||
fail_unless (val1 == NULL);
|
fail_unless (g_value_get_object (&val1) == NULL);
|
||||||
|
|
||||||
srcpad1 = gst_element_get_request_pad (tee, "src%d");
|
srcpad1 = gst_element_get_request_pad (tee, "src%d");
|
||||||
fail_unless (srcpad1 != NULL);
|
fail_unless (srcpad1 != NULL);
|
||||||
|
@ -358,20 +359,19 @@ GST_START_TEST (test_internal_links)
|
||||||
/* iterator should resync */
|
/* iterator should resync */
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_RESYNC);
|
fail_unless (res == GST_ITERATOR_RESYNC);
|
||||||
fail_unless (val1 == NULL);
|
fail_unless (g_value_get_object (&val1) == NULL);
|
||||||
gst_iterator_resync (it);
|
gst_iterator_resync (it);
|
||||||
|
|
||||||
/* we should get something now */
|
/* we should get something now */
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GST_PAD_CAST (val1) == srcpad1);
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == srcpad1);
|
||||||
|
|
||||||
gst_object_unref (val1);
|
g_value_reset (&val1);
|
||||||
|
|
||||||
val1 = NULL;
|
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_DONE);
|
fail_unless (res == GST_ITERATOR_DONE);
|
||||||
fail_unless (val1 == NULL);
|
fail_unless (g_value_get_object (&val1) == NULL);
|
||||||
|
|
||||||
srcpad2 = gst_element_get_request_pad (tee, "src%d");
|
srcpad2 = gst_element_get_request_pad (tee, "src%d");
|
||||||
fail_unless (srcpad2 != NULL);
|
fail_unless (srcpad2 != NULL);
|
||||||
|
@ -379,28 +379,27 @@ GST_START_TEST (test_internal_links)
|
||||||
/* iterator should resync */
|
/* iterator should resync */
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_RESYNC);
|
fail_unless (res == GST_ITERATOR_RESYNC);
|
||||||
fail_unless (val1 == NULL);
|
fail_unless (g_value_get_object (&val1) == NULL);
|
||||||
gst_iterator_resync (it);
|
gst_iterator_resync (it);
|
||||||
|
|
||||||
/* we should get one of the 2 pads now */
|
/* we should get one of the 2 pads now */
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GST_PAD_CAST (val1) == srcpad1
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == srcpad1
|
||||||
|| GST_PAD_CAST (val1) == srcpad2);
|
|| GST_PAD_CAST (g_value_get_object (&val1)) == srcpad2);
|
||||||
|
|
||||||
/* and the other */
|
/* and the other */
|
||||||
res = gst_iterator_next (it, &val2);
|
res = gst_iterator_next (it, &val2);
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GST_PAD_CAST (val2) == srcpad1
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val2)) == srcpad1
|
||||||
|| GST_PAD_CAST (val2) == srcpad2);
|
|| GST_PAD_CAST (g_value_get_object (&val2)) == srcpad2);
|
||||||
fail_unless (val1 != val2);
|
fail_unless (g_value_get_object (&val1) != g_value_get_object (&val2));
|
||||||
gst_object_unref (val1);
|
g_value_reset (&val1);
|
||||||
gst_object_unref (val2);
|
g_value_reset (&val2);
|
||||||
|
|
||||||
val1 = NULL;
|
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_DONE);
|
fail_unless (res == GST_ITERATOR_DONE);
|
||||||
fail_unless (val1 == NULL);
|
fail_unless (g_value_get_object (&val1) == NULL);
|
||||||
|
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
|
@ -410,8 +409,8 @@ GST_START_TEST (test_internal_links)
|
||||||
|
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GST_PAD_CAST (val1) == sinkpad);
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == sinkpad);
|
||||||
gst_object_unref (val1);
|
g_value_reset (&val1);
|
||||||
|
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_DONE);
|
fail_unless (res == GST_ITERATOR_DONE);
|
||||||
|
@ -422,12 +421,14 @@ GST_START_TEST (test_internal_links)
|
||||||
|
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GST_PAD_CAST (val1) == sinkpad);
|
fail_unless (GST_PAD_CAST (g_value_get_object (&val1)) == sinkpad);
|
||||||
gst_object_unref (val1);
|
g_value_reset (&val1);
|
||||||
|
|
||||||
res = gst_iterator_next (it, &val1);
|
res = gst_iterator_next (it, &val1);
|
||||||
fail_unless (res == GST_ITERATOR_DONE);
|
fail_unless (res == GST_ITERATOR_DONE);
|
||||||
|
|
||||||
|
g_value_unset (&val1);
|
||||||
|
g_value_unset (&val2);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
gst_object_unref (srcpad1);
|
gst_object_unref (srcpad1);
|
||||||
gst_object_unref (srcpad2);
|
gst_object_unref (srcpad2);
|
||||||
|
|
|
@ -61,7 +61,7 @@ GST_START_TEST (test_interface)
|
||||||
GstBin *bin, *bin2;
|
GstBin *bin, *bin2;
|
||||||
GstElement *filesrc;
|
GstElement *filesrc;
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
gpointer item;
|
GValue item = { 0, };
|
||||||
|
|
||||||
bin = GST_BIN (gst_bin_new (NULL));
|
bin = GST_BIN (gst_bin_new (NULL));
|
||||||
fail_unless (bin != NULL, "Could not create bin");
|
fail_unless (bin != NULL, "Could not create bin");
|
||||||
|
@ -77,8 +77,8 @@ GST_START_TEST (test_interface)
|
||||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||||
fail_unless (it != NULL);
|
fail_unless (it != NULL);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||||
fail_unless (item == (gpointer) filesrc);
|
fail_unless (g_value_get_object (&item) == (gpointer) filesrc);
|
||||||
gst_object_unref (GST_OBJECT (item));
|
g_value_reset (&item);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ GST_START_TEST (test_interface)
|
||||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||||
fail_unless (it != NULL);
|
fail_unless (it != NULL);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||||
fail_unless (item == (gpointer) filesrc);
|
fail_unless (g_value_get_object (&item) == (gpointer) filesrc);
|
||||||
gst_object_unref (GST_OBJECT (item));
|
g_value_reset (&item);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
|
@ -103,8 +103,8 @@ GST_START_TEST (test_interface)
|
||||||
GST_ELEMENT (bin2), gst_element_factory_make ("identity", NULL), NULL);
|
GST_ELEMENT (bin2), gst_element_factory_make ("identity", NULL), NULL);
|
||||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||||
fail_unless (item == (gpointer) filesrc);
|
fail_unless (g_value_get_object (&item) == (gpointer) filesrc);
|
||||||
gst_object_unref (GST_OBJECT (item));
|
g_value_reset (&item);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
|
@ -112,12 +112,13 @@ GST_START_TEST (test_interface)
|
||||||
gst_bin_add (bin2, gst_element_factory_make ("filesrc", NULL));
|
gst_bin_add (bin2, gst_element_factory_make ("filesrc", NULL));
|
||||||
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||||
gst_object_unref (GST_OBJECT (item));
|
g_value_reset (&item);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||||
gst_object_unref (GST_OBJECT (item));
|
g_value_reset (&item);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK);
|
||||||
gst_object_unref (GST_OBJECT (item));
|
g_value_reset (&item);
|
||||||
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
gst_object_unref (bin);
|
gst_object_unref (bin);
|
||||||
|
@ -887,7 +888,7 @@ GST_START_TEST (test_iterate_sorted)
|
||||||
{
|
{
|
||||||
GstElement *src, *tee, *identity, *sink1, *sink2, *pipeline, *bin;
|
GstElement *src, *tee, *identity, *sink1, *sink2, *pipeline, *bin;
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
gpointer elem;
|
GValue elem = { 0, };
|
||||||
|
|
||||||
pipeline = gst_pipeline_new (NULL);
|
pipeline = gst_pipeline_new (NULL);
|
||||||
fail_unless (pipeline != NULL, "Could not create pipeline");
|
fail_unless (pipeline != NULL, "Could not create pipeline");
|
||||||
|
@ -922,19 +923,21 @@ GST_START_TEST (test_iterate_sorted)
|
||||||
|
|
||||||
it = gst_bin_iterate_sorted (GST_BIN (pipeline));
|
it = gst_bin_iterate_sorted (GST_BIN (pipeline));
|
||||||
fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK);
|
||||||
fail_unless (elem == sink2);
|
fail_unless (g_value_get_object (&elem) == (gpointer) sink2);
|
||||||
gst_object_unref (elem);
|
g_value_reset (&elem);
|
||||||
|
|
||||||
fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK);
|
||||||
fail_unless (elem == identity);
|
fail_unless (g_value_get_object (&elem) == (gpointer) identity);
|
||||||
gst_object_unref (elem);
|
g_value_reset (&elem);
|
||||||
|
|
||||||
fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &elem) == GST_ITERATOR_OK);
|
||||||
fail_unless (elem == bin);
|
fail_unless (g_value_get_object (&elem) == (gpointer) bin);
|
||||||
gst_object_unref (elem);
|
g_value_reset (&elem);
|
||||||
|
|
||||||
|
g_value_unset (&elem);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
|
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
|
||||||
gst_object_unref (pipeline);
|
gst_object_unref (pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,13 @@ GST_START_TEST (test_manual_iteration)
|
||||||
GMutex *m;
|
GMutex *m;
|
||||||
GstIterator *iter;
|
GstIterator *iter;
|
||||||
GstIteratorResult res;
|
GstIteratorResult res;
|
||||||
gpointer item;
|
GValue item = { 0, };
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
|
||||||
l = make_list_of_ints (NUM_ELEMENTS);
|
l = make_list_of_ints (NUM_ELEMENTS);
|
||||||
m = g_mutex_new ();
|
m = g_mutex_new ();
|
||||||
|
|
||||||
iter = gst_iterator_new_list (G_TYPE_INT, m, &cookie, &l, NULL, NULL, NULL);
|
iter = gst_iterator_new_list (G_TYPE_POINTER, m, &cookie, &l, NULL, NULL);
|
||||||
|
|
||||||
fail_unless (iter != NULL);
|
fail_unless (iter != NULL);
|
||||||
|
|
||||||
|
@ -58,7 +58,8 @@ GST_START_TEST (test_manual_iteration)
|
||||||
res = gst_iterator_next (iter, &item);
|
res = gst_iterator_next (iter, &item);
|
||||||
if (i < NUM_ELEMENTS) {
|
if (i < NUM_ELEMENTS) {
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GPOINTER_TO_INT (item) == i);
|
fail_unless (GPOINTER_TO_INT (g_value_get_pointer (&item)) == i);
|
||||||
|
g_value_reset (&item);
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -66,8 +67,8 @@ GST_START_TEST (test_manual_iteration)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (iter);
|
gst_iterator_free (iter);
|
||||||
g_mutex_free (m);
|
g_mutex_free (m);
|
||||||
g_list_free (l);
|
g_list_free (l);
|
||||||
|
@ -82,14 +83,14 @@ GST_START_TEST (test_resync)
|
||||||
GMutex *m;
|
GMutex *m;
|
||||||
GstIterator *iter;
|
GstIterator *iter;
|
||||||
GstIteratorResult res;
|
GstIteratorResult res;
|
||||||
gpointer item;
|
GValue item = { 0, };
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
gboolean hacked_list = FALSE;
|
gboolean hacked_list = FALSE;
|
||||||
|
|
||||||
l = make_list_of_ints (NUM_ELEMENTS);
|
l = make_list_of_ints (NUM_ELEMENTS);
|
||||||
m = g_mutex_new ();
|
m = g_mutex_new ();
|
||||||
|
|
||||||
iter = gst_iterator_new_list (G_TYPE_INT, m, &cookie, &l, NULL, NULL, NULL);
|
iter = gst_iterator_new_list (G_TYPE_POINTER, m, &cookie, &l, NULL, NULL);
|
||||||
|
|
||||||
fail_unless (iter != NULL);
|
fail_unless (iter != NULL);
|
||||||
|
|
||||||
|
@ -97,12 +98,14 @@ GST_START_TEST (test_resync)
|
||||||
res = gst_iterator_next (iter, &item);
|
res = gst_iterator_next (iter, &item);
|
||||||
if (i < NUM_ELEMENTS / 2) {
|
if (i < NUM_ELEMENTS / 2) {
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GPOINTER_TO_INT (item) == i);
|
fail_unless (GPOINTER_TO_INT (g_value_get_pointer (&item)) == i);
|
||||||
|
g_value_reset (&item);
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
} else if (!hacked_list) {
|
} else if (!hacked_list) {
|
||||||
/* here's where we test resync */
|
/* here's where we test resync */
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
|
g_value_reset (&item);
|
||||||
l = g_list_prepend (l, GINT_TO_POINTER (-1));
|
l = g_list_prepend (l, GINT_TO_POINTER (-1));
|
||||||
cookie++;
|
cookie++;
|
||||||
hacked_list = TRUE;
|
hacked_list = TRUE;
|
||||||
|
@ -112,12 +115,14 @@ GST_START_TEST (test_resync)
|
||||||
gst_iterator_resync (iter);
|
gst_iterator_resync (iter);
|
||||||
res = gst_iterator_next (iter, &item);
|
res = gst_iterator_next (iter, &item);
|
||||||
fail_unless (res == GST_ITERATOR_OK);
|
fail_unless (res == GST_ITERATOR_OK);
|
||||||
fail_unless (GPOINTER_TO_INT (item) == -1);
|
fail_unless (GPOINTER_TO_INT (g_value_get_pointer (&item)) == -1);
|
||||||
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (iter);
|
gst_iterator_free (iter);
|
||||||
g_mutex_free (m);
|
g_mutex_free (m);
|
||||||
g_list_free (l);
|
g_list_free (l);
|
||||||
|
@ -126,9 +131,10 @@ GST_START_TEST (test_resync)
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
add_fold_func (gpointer item, GValue * ret, gpointer user_data)
|
add_fold_func (const GValue * item, GValue * ret, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_value_set_int (ret, g_value_get_int (ret) + GPOINTER_TO_INT (item));
|
g_value_set_int (ret,
|
||||||
|
g_value_get_int (ret) + GPOINTER_TO_INT (g_value_get_pointer (item)));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +150,7 @@ GST_START_TEST (test_fold)
|
||||||
|
|
||||||
l = make_list_of_ints (NUM_ELEMENTS);
|
l = make_list_of_ints (NUM_ELEMENTS);
|
||||||
m = g_mutex_new ();
|
m = g_mutex_new ();
|
||||||
iter = gst_iterator_new_list (G_TYPE_INT, m, &cookie, &l, NULL, NULL, NULL);
|
iter = gst_iterator_new_list (G_TYPE_POINTER, m, &cookie, &l, NULL, NULL);
|
||||||
fail_unless (iter != NULL);
|
fail_unless (iter != NULL);
|
||||||
|
|
||||||
expected = 0;
|
expected = 0;
|
||||||
|
@ -171,27 +177,33 @@ GST_START_TEST (test_single)
|
||||||
{
|
{
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
GstStructure *s = gst_structure_new ("test", NULL);
|
GstStructure *s = gst_structure_new ("test", NULL);
|
||||||
|
GValue v = { 0, };
|
||||||
GstStructure *i;
|
GstStructure *i;
|
||||||
|
|
||||||
it = gst_iterator_new_single (GST_TYPE_STRUCTURE, s,
|
g_value_init (&v, GST_TYPE_STRUCTURE);
|
||||||
(GstCopyFunction) gst_structure_copy, (GFreeFunc) gst_structure_free);
|
g_value_set_boxed (&v, s);
|
||||||
|
it = gst_iterator_new_single (GST_TYPE_STRUCTURE, &v);
|
||||||
|
g_value_reset (&v);
|
||||||
|
|
||||||
fail_unless (gst_iterator_next (it, (gpointer) & i) == GST_ITERATOR_OK);
|
fail_unless (gst_iterator_next (it, &v) == GST_ITERATOR_OK);
|
||||||
|
i = g_value_get_boxed (&v);
|
||||||
fail_unless (strcmp (gst_structure_get_name (s),
|
fail_unless (strcmp (gst_structure_get_name (s),
|
||||||
gst_structure_get_name (i)) == 0);
|
gst_structure_get_name (i)) == 0);
|
||||||
gst_structure_free (i);
|
|
||||||
i = NULL;
|
i = NULL;
|
||||||
fail_unless (gst_iterator_next (it, (gpointer) & i) == GST_ITERATOR_DONE);
|
g_value_reset (&v);
|
||||||
fail_unless (i == NULL);
|
|
||||||
|
fail_unless (gst_iterator_next (it, &v) == GST_ITERATOR_DONE);
|
||||||
|
fail_unless (g_value_get_boxed (&v) == NULL);
|
||||||
|
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
gst_structure_free (s);
|
gst_structure_free (s);
|
||||||
|
|
||||||
it = gst_iterator_new_single (GST_TYPE_STRUCTURE, NULL,
|
it = gst_iterator_new_single (GST_TYPE_STRUCTURE, NULL);
|
||||||
(GstCopyFunction) gst_structure_copy, (GFreeFunc) gst_structure_free);
|
|
||||||
|
|
||||||
fail_unless (gst_iterator_next (it, (gpointer) & i) == GST_ITERATOR_DONE);
|
fail_unless (gst_iterator_next (it, &v) == GST_ITERATOR_DONE);
|
||||||
fail_unless (i == NULL);
|
fail_unless (g_value_get_boxed (&v) == NULL);
|
||||||
|
|
||||||
|
g_value_reset (&v);
|
||||||
|
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue