aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp2
-rw-r--r--sources/shiboken2/tests/libsmart/smart.cpp16
-rw-r--r--sources/shiboken2/tests/libsmart/smart.h10
-rw-r--r--sources/shiboken2/tests/smartbinding/CMakeLists.txt2
-rw-r--r--sources/shiboken2/tests/smartbinding/smart_pointer_test.py13
-rw-r--r--sources/shiboken2/tests/smartbinding/typesystem_smart.xml4
6 files changed, 45 insertions, 2 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 7fea87c1b..3ce07cf93 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -515,7 +515,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
// Replace the return type of the raw pointer getter method with the actual
// return type.
QString innerTypeName =
- classContext.preciseType()->getSmartPointerInnerType()->name();
+ classContext.preciseType()->getSmartPointerInnerType()->cppSignature();
QString pointerToInnerTypeName = innerTypeName + QLatin1Char('*');
// @TODO: This possibly leaks, but there are a bunch of other places where this
// is done, so this will be fixed in bulk with all the other cases, because the
diff --git a/sources/shiboken2/tests/libsmart/smart.cpp b/sources/shiboken2/tests/libsmart/smart.cpp
index dbe8efa66..4132c2fc8 100644
--- a/sources/shiboken2/tests/libsmart/smart.cpp
+++ b/sources/shiboken2/tests/libsmart/smart.cpp
@@ -68,6 +68,12 @@ SharedPtr<Integer> Obj::giveSharedPtrToInteger()
return o;
}
+SharedPtr<Smart::Integer2> Obj::giveSharedPtrToInteger2()
+{
+ SharedPtr<Smart::Integer2> o(new Smart::Integer2);
+ return o;
+}
+
int Obj::takeSharedPtrToObj(SharedPtr<Obj> pObj)
{
pObj->printObj();
@@ -172,3 +178,13 @@ void Registry::setShouldPrint(bool flag)
{
m_printStuff = flag;
}
+
+Smart::Integer2::Integer2()
+ : Integer ()
+{
+}
+
+Smart::Integer2::Integer2(const Smart::Integer2 &other)
+ : Integer (other)
+{
+}
diff --git a/sources/shiboken2/tests/libsmart/smart.h b/sources/shiboken2/tests/libsmart/smart.h
index ea64b4439..502187a11 100644
--- a/sources/shiboken2/tests/libsmart/smart.h
+++ b/sources/shiboken2/tests/libsmart/smart.h
@@ -189,6 +189,15 @@ public:
int m_int;
};
+namespace Smart {
+class LIB_SMART_API Integer2 : public Integer {
+public:
+ Integer2();
+ Integer2(const Integer2 &other);
+};
+}
+
+
// Couldn't name it Object because it caused some namespace clashes.
class LIB_SMART_API Obj {
public:
@@ -199,6 +208,7 @@ public:
Integer takeInteger(Integer val);
SharedPtr<Obj> giveSharedPtrToObj();
SharedPtr<Integer> giveSharedPtrToInteger();
+ SharedPtr<Smart::Integer2> giveSharedPtrToInteger2();
int takeSharedPtrToObj(SharedPtr<Obj> pObj);
int takeSharedPtrToInteger(SharedPtr<Integer> pInt);
diff --git a/sources/shiboken2/tests/smartbinding/CMakeLists.txt b/sources/shiboken2/tests/smartbinding/CMakeLists.txt
index 0fb7de825..ed6bcef0a 100644
--- a/sources/shiboken2/tests/smartbinding/CMakeLists.txt
+++ b/sources/shiboken2/tests/smartbinding/CMakeLists.txt
@@ -11,6 +11,8 @@ ${CMAKE_CURRENT_BINARY_DIR}/smart/integer_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/smart/sharedptr_obj_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/smart/sharedptr_integer_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/smart/registry_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/smart/smart_integer2_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/smart/sharedptr_integer2_wrapper.cpp
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/smart-binding.txt.in"
diff --git a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py
index 730b4a0da..62bfc0500 100644
--- a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py
+++ b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py
@@ -143,5 +143,18 @@ class SmartPointerTests(unittest.TestCase):
self.assertEqual(objCount(), 0)
self.assertEqual(integerCount(), 0)
+ def testSmartPointersWithNamespace(self):
+ # Create the main object
+ o = Obj()
+ self.assertEqual(objCount(), 1)
+
+ # Create a shared pointer to an Integer together with an Integer.
+ ptrToInteger = o.giveSharedPtrToInteger2()
+ self.assertEqual(objCount(), 1)
+ self.assertEqual(integerCount(), 2)
+
+ integer = ptrToInteger.data()
+ self.assertTrue(integer)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/shiboken2/tests/smartbinding/typesystem_smart.xml b/sources/shiboken2/tests/smartbinding/typesystem_smart.xml
index a2654730d..b2deb18cb 100644
--- a/sources/shiboken2/tests/smartbinding/typesystem_smart.xml
+++ b/sources/shiboken2/tests/smartbinding/typesystem_smart.xml
@@ -17,7 +17,9 @@
<object-type name="Obj" />
<value-type name="Integer" />
-
+ <namespace-type name="Smart" generate="no">
+ <value-type name="Integer2" />
+ </namespace-type>
<!-- Just used to silence the warnings that shiboken doens't know what to do with this type -->
<custom-type name="RefData" />
</typesystem>