mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
tests: don't use post-GLib 2.32 API in bufferlist test
g_ptr_array_insert() is GLib >= 2.40
This commit is contained in:
parent
d0a808cdc8
commit
14ae3cf56c
1 changed files with 11 additions and 11 deletions
|
@ -302,13 +302,13 @@ GST_END_TEST;
|
|||
/* make sure everything is fine if we exceed the pre-allocated size */
|
||||
GST_START_TEST (test_expand_and_remove)
|
||||
{
|
||||
GPtrArray *arr;
|
||||
GArray *arr;
|
||||
GstBuffer *buf;
|
||||
guint i, idx, num, counter = 0;
|
||||
|
||||
gst_buffer_list_unref (list);
|
||||
|
||||
arr = g_ptr_array_new ();
|
||||
arr = g_array_new (FALSE, FALSE, sizeof (guint));
|
||||
|
||||
list = gst_buffer_list_new_sized (1);
|
||||
|
||||
|
@ -316,7 +316,7 @@ GST_START_TEST (test_expand_and_remove)
|
|||
num = ++counter;
|
||||
buf = gst_buffer_new_allocate (NULL, num, NULL);
|
||||
gst_buffer_list_add (list, buf);
|
||||
g_ptr_array_add (arr, GINT_TO_POINTER (num));
|
||||
g_array_append_val (arr, num);
|
||||
}
|
||||
|
||||
for (i = 0; i < 250; ++i) {
|
||||
|
@ -324,7 +324,7 @@ GST_START_TEST (test_expand_and_remove)
|
|||
buf = gst_buffer_new_allocate (NULL, num, NULL);
|
||||
idx = g_random_int_range (0, gst_buffer_list_length (list));
|
||||
gst_buffer_list_insert (list, idx, buf);
|
||||
g_ptr_array_insert (arr, idx, GINT_TO_POINTER (num));
|
||||
g_array_insert_val (arr, idx, num);
|
||||
}
|
||||
|
||||
/* make sure the list looks like it should */
|
||||
|
@ -332,14 +332,14 @@ GST_START_TEST (test_expand_and_remove)
|
|||
for (i = 0; i < arr->len; ++i) {
|
||||
buf = gst_buffer_list_get (list, i);
|
||||
num = gst_buffer_get_size (buf);
|
||||
fail_unless_equals_int (num, GPOINTER_TO_INT (g_ptr_array_index (arr, i)));
|
||||
fail_unless_equals_int (num, g_array_index (arr, guint, i));
|
||||
}
|
||||
|
||||
for (i = 0; i < 44; ++i) {
|
||||
num = g_random_int_range (1, 5);
|
||||
idx = g_random_int_range (0, gst_buffer_list_length (list) - num);
|
||||
gst_buffer_list_remove (list, idx, num);
|
||||
g_ptr_array_remove_range (arr, idx, num);
|
||||
g_array_remove_range (arr, idx, num);
|
||||
}
|
||||
|
||||
/* make sure the list still looks like it should */
|
||||
|
@ -347,14 +347,14 @@ GST_START_TEST (test_expand_and_remove)
|
|||
for (i = 0; i < arr->len; ++i) {
|
||||
buf = gst_buffer_list_get (list, i);
|
||||
num = gst_buffer_get_size (buf);
|
||||
fail_unless_equals_int (num, GPOINTER_TO_INT (g_ptr_array_index (arr, i)));
|
||||
fail_unless_equals_int (num, g_array_index (arr, guint, i));
|
||||
}
|
||||
|
||||
for (i = 0; i < 500; ++i) {
|
||||
num = ++counter;
|
||||
buf = gst_buffer_new_allocate (NULL, num, NULL);
|
||||
gst_buffer_list_add (list, buf);
|
||||
g_ptr_array_add (arr, GINT_TO_POINTER (num));
|
||||
g_array_append_val (arr, num);
|
||||
}
|
||||
|
||||
for (i = 0; i < 500; ++i) {
|
||||
|
@ -362,7 +362,7 @@ GST_START_TEST (test_expand_and_remove)
|
|||
buf = gst_buffer_new_allocate (NULL, num, NULL);
|
||||
idx = g_random_int_range (0, gst_buffer_list_length (list));
|
||||
gst_buffer_list_insert (list, idx, buf);
|
||||
g_ptr_array_insert (arr, idx, GINT_TO_POINTER (num));
|
||||
g_array_insert_val (arr, idx, num);
|
||||
}
|
||||
|
||||
/* make sure the list still looks like it should */
|
||||
|
@ -370,10 +370,10 @@ GST_START_TEST (test_expand_and_remove)
|
|||
for (i = 0; i < arr->len; ++i) {
|
||||
buf = gst_buffer_list_get (list, i);
|
||||
num = gst_buffer_get_size (buf);
|
||||
fail_unless_equals_int (num, GPOINTER_TO_INT (g_ptr_array_index (arr, i)));
|
||||
fail_unless_equals_int (num, g_array_index (arr, guint, i));
|
||||
}
|
||||
|
||||
g_ptr_array_unref (arr);
|
||||
g_array_unref (arr);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
Loading…
Reference in a new issue