mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
tests: Add buffer map/unmap tests
This commit is contained in:
parent
fecfe451a7
commit
6d53d0ae0e
1 changed files with 19 additions and 0 deletions
|
@ -93,5 +93,24 @@ class TestBin(TestCase):
|
|||
Gst.init(None)
|
||||
self.assertEqual(Gst.ElementFactory.make("bin", None).sinkpads, [])
|
||||
|
||||
class TestBufferMap(TestCase):
|
||||
|
||||
def test_map_unmap_manual(self):
|
||||
Gst.init(None)
|
||||
buf = Gst.Buffer.new_wrapped([42])
|
||||
info = buf.map(Gst.MapFlags.READ | Gst.MapFlags.WRITE)
|
||||
self.assertEqual(info.data[0], 42)
|
||||
buf.unmap(info)
|
||||
with self.assertRaises(ValueError):
|
||||
info.data[0]
|
||||
|
||||
def test_map_unmap_context(self):
|
||||
Gst.init(None)
|
||||
buf = Gst.Buffer.new_wrapped([42])
|
||||
with buf.map(Gst.MapFlags.READ | Gst.MapFlags.WRITE) as info:
|
||||
self.assertEqual(info.data[0], 42)
|
||||
with self.assertRaises(ValueError):
|
||||
info.data[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue