aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/voidholder_test.py
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-01-28 15:53:40 -0300
committerHugo Lima <hugo.lima@openbossa.org>2010-01-28 19:04:58 -0200
commit6daffa0a3452ee36ca8c39cf90fb0cefcbb5c205 (patch)
tree12faa27dcb6251f9b5ddd9b5ad458c66b371cc96 /tests/samplebinding/voidholder_test.py
parent22eb430cecf6ddc10eed04dd67c81485aba84ab6 (diff)
Adds support for void pointer conversions.
A new converter specialization was added to deal with 'void*' conversions. In the case of C++ generating a unknown void pointer a BaseWrapper is used to hold the said pointer. There is a new test for this situation. Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'tests/samplebinding/voidholder_test.py')
-rwxr-xr-xtests/samplebinding/voidholder_test.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/samplebinding/voidholder_test.py b/tests/samplebinding/voidholder_test.py
new file mode 100755
index 000000000..8d08d1fdf
--- /dev/null
+++ b/tests/samplebinding/voidholder_test.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# This file is part of the Shiboken Python Bindings Generator project.
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+#
+# Contact: PySide team <contact@pyside.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# version 2.1 as published by the Free Software Foundation. Please
+# review the following information to ensure the GNU Lesser General
+# Public License version 2.1 requirements will be met:
+# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+# #
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+'''Test case for a class that holds a void pointer.'''
+
+import unittest
+
+from sample import VoidHolder, Point
+
+class VoidHolderTest(unittest.TestCase):
+ '''Test case for void pointer manipulation.'''
+
+ def testGetVoidPointerFromCppAndPutsOnVoidHolder(self):
+ '''Passes a void pointer created in C++ and to kept by VoidHolder.'''
+ voidptr = VoidHolder.gimmeMeSomeVoidPointer()
+ voidholder = VoidHolder(voidptr)
+ self.assertEquals(voidptr, voidholder.voidPointer())
+
+ def testPutRandomObjectInsideVoidHolder(self):
+ '''Passes a C++ pointer for an object created in Python to be kept VoidHolder.'''
+ obj = Point(1, 2)
+ voidholder = VoidHolder(obj)
+ self.assertEquals(obj, voidholder.voidPointer())
+
+if __name__ == '__main__':
+ unittest.main()
+