mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-30 02:58:24 +00:00
tests: gstbuffer: extend buffer copy test
... to check for independence of copied buffer.
This commit is contained in:
parent
36b051f02e
commit
0f69f9e44a
1 changed files with 27 additions and 0 deletions
|
@ -335,6 +335,33 @@ GST_START_TEST (test_copy)
|
|||
|
||||
gst_buffer_unref (copy);
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
/* check if copy is an independent copy when written to */
|
||||
buffer = gst_buffer_new_and_alloc (4);
|
||||
gst_buffer_memset (buffer, 0, 0, 4);
|
||||
copy = gst_buffer_copy (buffer);
|
||||
fail_unless (gst_buffer_is_writable (copy));
|
||||
gst_buffer_memset (copy, 0, 0x80, 4);
|
||||
gst_buffer_map (buffer, &info, GST_MAP_READ);
|
||||
fail_if (gst_buffer_memcmp (copy, 0, info.data, info.size) == 0);
|
||||
gst_buffer_unmap (buffer, &info);
|
||||
|
||||
gst_buffer_unref (copy);
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
/* check if a writable clone of a buffer is independent when written to */
|
||||
buffer = gst_buffer_new_and_alloc (4);
|
||||
gst_buffer_memset (buffer, 0, 0, 4);
|
||||
copy = gst_buffer_ref (buffer);
|
||||
copy = gst_buffer_make_writable (copy);
|
||||
fail_unless (gst_buffer_is_writable (copy));
|
||||
gst_buffer_memset (copy, 0, 0x80, 4);
|
||||
gst_buffer_map (buffer, &info, GST_MAP_READ);
|
||||
fail_if (gst_buffer_memcmp (copy, 0, info.data, info.size) == 0);
|
||||
gst_buffer_unmap (buffer, &info);
|
||||
|
||||
gst_buffer_unref (copy);
|
||||
gst_buffer_unref (buffer);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
Loading…
Reference in a new issue