diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2019-10-17 17:31:41 +0200 |
---|---|---|
committer | Philipp Zabel <philipp.zabel@gmail.com> | 2019-12-09 21:03:19 +0100 |
commit | 6d53d0ae0e99fe47e04a7fd6962093934cbbb6b8 (patch) | |
tree | 43b925313ff9216ea96b4de14ce0fd86dbb810f9 | |
parent | fecfe451a7566740960d87da8a177f8a776f6137 (diff) |
tests: Add buffer map/unmap tests
-rw-r--r-- | testsuite/test_gst.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/test_gst.py b/testsuite/test_gst.py index d63f4e2..e788489 100644 --- a/testsuite/test_gst.py +++ b/testsuite/test_gst.py @@ -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() |