diff options
Diffstat (limited to 'tests/samplebinding')
-rw-r--r-- | tests/samplebinding/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/samplebinding/global.h | 1 | ||||
-rw-r--r-- | tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py | 44 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 2 |
4 files changed, 48 insertions, 0 deletions
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt index f63ecf981..382b9d13e 100644 --- a/tests/samplebinding/CMakeLists.txt +++ b/tests/samplebinding/CMakeLists.txt @@ -47,6 +47,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/noimplicitconversion_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/nondefaultctor_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/objectmodel_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/objecttype_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/objecttypeholder_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/objecttypelayout_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/objecttypeoperators_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/objectview_wrapper.cpp diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h index 164e992a9..8b9b44ec4 100644 --- a/tests/samplebinding/global.h +++ b/tests/samplebinding/global.h @@ -24,6 +24,7 @@ #include "nondefaultctor.h" #include "objectmodel.h" #include "objecttype.h" +#include "objecttypeholder.h" #include "objecttypelayout.h" #include "objecttypereference.h" #include "objecttypeoperators.h" diff --git a/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py b/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py new file mode 100644 index 000000000..5a48a5d2a --- /dev/null +++ b/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# This file is part of the Shiboken Python Bindings Generator project. +# +# Copyright (C) 2011 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 + +import unittest +from sample import ObjectTypeHolder + +class TestObjectTypeReferenceAsVirtualMethodArgument(unittest.TestCase): + + def testBasic(self): + holder = ObjectTypeHolder('TheObjectFromC++') + self.assertEqual(holder.callPassObjectTypeAsReference(), 'TheObjectFromC++') + + def testExtended(self): + class Holder(ObjectTypeHolder): + def passObjectTypeAsReference(self, objectType): + return objectType.objectName().prepend(('ThisIs')) + holder = Holder('TheObjectFromC++') + self.assertEqual(holder.callPassObjectTypeAsReference(), 'ThisIsTheObjectFromC++') + +if __name__ == '__main__': + unittest.main() diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index 27c265f3f..add18c289 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -298,6 +298,8 @@ </modify-function> </object-type> + <value-type name="ObjectTypeHolder"/> + <object-type name="ObjectModel"> <enum-type name="MethodCalled" /> <modify-function signature="data() const"> |