diff options
Diffstat (limited to 'sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py')
-rw-r--r-- | sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py b/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py index f21466302..9c7ef2f01 100644 --- a/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py +++ b/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py @@ -2,7 +2,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -import gc import os import sys import unittest @@ -11,7 +10,7 @@ from pathlib import Path sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from shiboken_paths import init_paths init_paths() -from smart import Integer, StdUniquePtrTestBench, StdUniquePtrVirtualMethodTester, std +from smart import Integer, Integer2, StdUniquePtrTestBench, StdUniquePtrVirtualMethodTester, std def call_func_on_ptr(ptr): @@ -54,6 +53,17 @@ class StdUniquePtrTests(unittest.TestCase): np = std.unique_ptr_Integer(iv) self.assertEqual(np.value(), 42) + def test_derived(self): + iv2 = Integer2() # Construct from pointee + iv2.setValue(42) + p = std.unique_ptr_Smart_Integer2(iv2) + self.assertEqual(p.value(), 42) + StdUniquePtrTestBench.printInteger2(p) # unique_ptr by ref + self.assertTrue(p) + StdUniquePtrTestBench.printInteger(p) # conversion + # FIXME: This fails, pointer is moved in value conversion + # self.assertTrue(p) + def testInt(self): p = StdUniquePtrTestBench.createInt() # unique_ptr by ref StdUniquePtrTestBench.printInt(p) |