[0.11] gstreamer: tests: improve memory test

Wim Taymans wtay at kemper.freedesktop.org
Mon Jan 16 03:25:11 PST 2012


Module: gstreamer
Branch: 0.11
Commit: 4eb0c8ae07affe59157b04959a497c8c9f83a771
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=4eb0c8ae07affe59157b04959a497c8c9f83a771

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Mon Jan 16 12:24:48 2012 +0100

tests: improve memory test

---

 tests/check/gst/gstmemory.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/tests/check/gst/gstmemory.c b/tests/check/gst/gstmemory.c
index 1f9363f..f3c8962 100644
--- a/tests/check/gst/gstmemory.c
+++ b/tests/check/gst/gstmemory.c
@@ -158,6 +158,15 @@ GST_START_TEST (test_writable)
   data = gst_memory_map (mem2, &size, NULL, GST_MAP_WRITE);
   data[4] = 'a';
   gst_memory_unmap (mem2, data, size);
+
+  gst_memory_ref (mem2);
+  ASSERT_CRITICAL (gst_memory_map (mem, &size, NULL, GST_MAP_WRITE));
+  gst_memory_unref (mem2);
+
+  data = gst_memory_map (mem2, &size, NULL, GST_MAP_WRITE);
+  data[4] = 'a';
+  gst_memory_unmap (mem2, data, size);
+
   gst_memory_unref (mem2);
 
   gst_memory_unref (mem);
@@ -170,12 +179,13 @@ GST_START_TEST (test_submemory_writable)
   GstMemory *mem, *sub_mem;
   gsize size;
 
-  /* create sub-memory of read-only memory and make it writable */
+  /* create sub-memory of read-only memory and try to write */
   mem = create_read_only_memory ();
 
   sub_mem = gst_memory_share (mem, 0, 8);
   fail_if (GST_MEMORY_IS_WRITABLE (sub_mem));
 
+  ASSERT_CRITICAL (gst_memory_map (mem, &size, NULL, GST_MAP_WRITE));
   ASSERT_CRITICAL (gst_memory_map (sub_mem, &size, NULL, GST_MAP_WRITE));
 
   gst_memory_unref (sub_mem);



More information about the gstreamer-commits mailing list