diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-10-11 18:04:08 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:18:28 -0300 |
commit | 836ebb910f0dec27ae20f25dab4e9041780fccd7 (patch) | |
tree | 8076256a574fc82d319392a15ebe94509c843d30 /tests | |
parent | f6128fb64a591afaa22ed82cc1419ffbbd991583 (diff) |
Added unit test for bug 969.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libsample/objecttypebyvalue.h | 36 | ||||
-rw-r--r-- | tests/samplebinding/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/samplebinding/global.h | 1 | ||||
-rw-r--r-- | tests/samplebinding/objecttypebyvalue_test.py | 14 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 3 |
5 files changed, 55 insertions, 0 deletions
diff --git a/tests/libsample/objecttypebyvalue.h b/tests/libsample/objecttypebyvalue.h new file mode 100644 index 000000000..0eb3bdd70 --- /dev/null +++ b/tests/libsample/objecttypebyvalue.h @@ -0,0 +1,36 @@ +/* + * This file is part of the Shiboken Python Binding Generator project. + * + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team <contact@pyside.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OBJECTTYPEBYVALUE_H +#define OBJECTTYPEBYVALUE_H +#include "protected.h" + +class ObjectTypeByValue +{ +public: + ObjectTypeByValue returnSomeKindOfMe() { return ObjectTypeByValue(); } + + // prop used to check for segfaults + ProtectedProperty prop; +}; + +#endif diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt index 4322c3dd9..671a4a043 100644 --- a/tests/samplebinding/CMakeLists.txt +++ b/tests/samplebinding/CMakeLists.txt @@ -48,6 +48,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/objecttypebyvalue_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 diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h index 5f9179138..37e00b372 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 "objecttypebyvalue.h" #include "objecttypeholder.h" #include "objecttypelayout.h" #include "objecttypereference.h" diff --git a/tests/samplebinding/objecttypebyvalue_test.py b/tests/samplebinding/objecttypebyvalue_test.py new file mode 100644 index 000000000..a9c6bb302 --- /dev/null +++ b/tests/samplebinding/objecttypebyvalue_test.py @@ -0,0 +1,14 @@ +from sample import * +import unittest + +class ObjectTypeByValueTest (unittest.TestCase): + def testIt(self): + factory = ObjectTypeByValue() + obj = factory.returnSomeKindOfMe() + # This should crash! + obj.prop.protectedValueTypeProperty.setX(1.0) + # just to make sure it will segfault + obj.prop.protectedValueTypeProperty.setY(2.0) + +if __name__ == "__main__": + unittest.main() diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index 22848c4b3..3fdeabdef 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -2133,6 +2133,9 @@ <rejection class="ListUser" function-name="sumList(std::list<double>)"/> <value-type name="ValueAndVirtual" /> + + <object-type name="ObjectTypeByValue" /> + <suppress-warning text="horribly broken type '__off64_t'" /> <suppress-warning text="enum '__codecvt_result' does not have a type entry or is not an enum" /> <suppress-warning text="Pure virtual method "Abstract::hideFunction(HideType*)" must be implement but was completely removed on typesystem." /> |