diff options
author | Edward Hervey <bilboed@bilboed.com> | 2008-12-06 15:41:41 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2008-12-06 15:41:41 +0000 |
commit | 7a2babed30a2511fe153e3e20c35c1bf674d2dcc (patch) | |
tree | 0b9f05f939cadac962f5fb258e90bb3de61aee6e /testsuite | |
parent | d658b7b2225e22bb9daedd0281f8d510779b15c8 (diff) |
codegen/argtypes.py: Add handling of 'keep-refcount' for GBoxed arguments.
Original commit message from CVS:
* codegen/argtypes.py:
Add handling of 'keep-refcount' for GBoxed arguments.
* gst/gst.defs:
Mark the appropriate 'gst_message_new_*' arguments when the method
takes the ownership of the passed gst.Structure/gst.TagList
* testsuite/test_message.py:
Test for creating messages that take a gst.Structure/gst.TagList as
argument and make sure they're properly created.
Fixes #556054
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/test_message.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/testsuite/test_message.py b/testsuite/test_message.py index 505e9c1..3d7dbf4 100644 --- a/testsuite/test_message.py +++ b/testsuite/test_message.py @@ -55,5 +55,56 @@ class NewTest(TestCase): self.failUnless(self.got_message == True) self.gccollect() +class TestCreateMessages(TestCase): + + def setUp(self): + TestCase.setUp(self) + self.element = gst.Bin() + + def tearDown(self): + del self.element + + def testCustomMessage(self): + # create two custom messages using the same structure + s = gst.Structure("something") + assert s != None + e1 = gst.message_new_custom(gst.MESSAGE_APPLICATION, self.element, s) + assert e1 + e2 = gst.message_new_custom(gst.MESSAGE_APPLICATION, self.element, s) + assert e2 + + # make sure the two structures are equal + self.assertEquals(e1.structure.to_string(), + e2.structure.to_string()) + + def testTagMessage(self): + # Create a taglist + t = gst.TagList() + t['something'] = "else" + t['another'] = 42 + + # Create two messages using that same taglist + m1 = gst.message_new_tag(self.element, t) + assert m1 + m2 = gst.message_new_tag(self.element, t) + assert m2 + + # make sure the two messages have the same taglist + t1 = m1.parse_tag() + assert t1 + keys = t1.keys() + keys.sort() + self.assertEquals(keys, ['another', 'something']) + self.assertEquals(t1['something'], "else") + self.assertEquals(t1['another'], 42) + t2 = m2.parse_tag() + assert t2 + keys = t2.keys() + keys.sort() + self.assertEquals(keys, ['another', 'something']) + self.assertEquals(t2['something'], "else") + self.assertEquals(t2['another'], 42) + + if __name__ == "__main__": unittest.main() |