summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2014-07-02 08:41:18 +0100
committerTim-Philipp Müller <tim@centricular.com>2014-07-02 08:41:44 +0100
commit14ae3cf56c1de1dcbb5a9083f886e5346c043e80 (patch)
tree197a6ca3b7e9377cb8b2aa6987d9cbbec38d9452
parentd0a808cdc87c60f3dea4ac8d458324fd9e458ae7 (diff)
tests: don't use post-GLib 2.32 API in bufferlist test
g_ptr_array_insert() is GLib >= 2.40
-rw-r--r--tests/check/gst/gstbufferlist.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/check/gst/gstbufferlist.c b/tests/check/gst/gstbufferlist.c
index f20599b52..9d5c2dff9 100644
--- a/tests/check/gst/gstbufferlist.c
+++ b/tests/check/gst/gstbufferlist.c
@@ -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;