diff options
author | Lauro Neto <lauro.neto@openbossa.org> | 2009-11-26 15:49:49 -0300 |
---|---|---|
committer | Lauro Neto <lauro.neto@openbossa.org> | 2009-11-27 16:58:02 -0300 |
commit | 4521af39d3ba97bb206f3bf321f77d0c84f5f303 (patch) | |
tree | 9a6b97b64b8a93251ba29ea847de01d1c836101c /tests/samplebinding/ownership_delete_child_in_cpp_test.py | |
parent | 104eb1dd5d662e75f39badbcb689d8137cf2f5b9 (diff) |
Add test for deleting child in cpp
Diffstat (limited to 'tests/samplebinding/ownership_delete_child_in_cpp_test.py')
-rwxr-xr-x | tests/samplebinding/ownership_delete_child_in_cpp_test.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/samplebinding/ownership_delete_child_in_cpp_test.py b/tests/samplebinding/ownership_delete_child_in_cpp_test.py new file mode 100755 index 000000000..90ef2caff --- /dev/null +++ b/tests/samplebinding/ownership_delete_child_in_cpp_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) 2009 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 + +'''Tests for destroy a child object in C++''' + +import unittest + +from sample import ObjectType + + +class DeleteChildInPython(unittest.TestCase): + '''Test case for destroying a child in c++''' + + def testDeleteChild(self): + '''Delete child in C++ should invalidate child - using C++ wrapper''' + parent = ObjectType() + parent.setObjectName('parent') + child = ObjectType(parent) + child.setObjectName('child') + + parent.killChild('child') + parent.assertRaises(RuntimeError, child.objectName) + self.assertEqual(parent.objectName(), 'parent') + +if __name__ == '__main__': + unittest.main() |