diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-05-13 08:56:39 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:15:22 -0300 |
commit | 77066fe1d61446fc711d8ca234c915a46e767801 (patch) | |
tree | c0f23965bde237e2f473239a68ccab2cec88aa7b /tests/samplebinding | |
parent | c2d2ed94548d0e42c3dcc949b1b4f4990684f735 (diff) | |
parent | 485288fb1888814f641b2df56860171783d326fb (diff) |
Merge branch 'casttoreference' into havegcflag-hell
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'tests/samplebinding')
-rw-r--r-- | tests/samplebinding/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/samplebinding/global.h | 1 | ||||
-rw-r--r-- | tests/samplebinding/modelindex_test.py | 49 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 10 |
4 files changed, 63 insertions, 0 deletions
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt index b62f2d049..04ee3b398 100644 --- a/tests/samplebinding/CMakeLists.txt +++ b/tests/samplebinding/CMakeLists.txt @@ -39,6 +39,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/mderived2_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/mderived3_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/mderived4_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/mderived5_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/modelindex_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/modifications_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/modifiedconstructor_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/noimplicitconversion_wrapper.cpp @@ -54,6 +55,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/overload_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/overload2_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/pairuser_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/pen_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/persistentmodelindex_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/point_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/pointf_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/pointerholder_wrapper.cpp @@ -70,6 +72,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/protectedvirtualdestructor_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/rect_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/rectf_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/reference_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/sample/referentmodelindex_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/sample_module_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/samplenamespace_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/sample/samplenamespace_someclass_someinnerclass_okthisisrecursiveenough_wrapper.cpp diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h index 98738a38a..850518494 100644 --- a/tests/samplebinding/global.h +++ b/tests/samplebinding/global.h @@ -15,6 +15,7 @@ #include "list.h" #include "listuser.h" #include "mapuser.h" +#include "modelindex.h" #include "modifications.h" #include "modified_constructor.h" #include "multiple_derived.h" diff --git a/tests/samplebinding/modelindex_test.py b/tests/samplebinding/modelindex_test.py new file mode 100644 index 000000000..31503b97d --- /dev/null +++ b/tests/samplebinding/modelindex_test.py @@ -0,0 +1,49 @@ +#!/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 ModelIndex, ReferentModelIndex, PersistentModelIndex + +class TestCastOperator(unittest.TestCase): + + def testCastOperatorReturningValue(self): + index = PersistentModelIndex() + index.setValue(123) + self.assertEqual(index.value(), 123) + self.assertEqual(index.value(), ModelIndex.getValue(index)) + + def testCastOperatorReturningReference(self): + index = ReferentModelIndex() + index.setValue(123) + self.assertEqual(index.value(), 123) + self.assertEqual(index.value(), ModelIndex.getValue(index)) + + +if __name__ == '__main__': + unittest.main() + diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index eeaf3c218..338719372 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -1473,6 +1473,16 @@ <value-type name="Expression" /> + <value-type name="ModelIndex" /> + <value-type name="ReferentModelIndex"> + <modify-function signature="operator const ModelIndex&()const"> + <modify-argument index="return"> + <define-ownership owner="c++"/> + </modify-argument> + </modify-function> + </value-type> + <value-type name="PersistentModelIndex" /> + <rejection class="ListUser" function-name="createList()"/> <rejection class="ListUser" function-name="callCreateList()"/> <rejection class="ListUser" function-name="createComplexList(Complex, Complex)"/> |