aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/minimalbinding
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-02-27 10:54:01 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-20 09:37:04 +0100
commit667cb4a4ee3fac1cd818b9689886470c1dffdac9 (patch)
treeb7a152d307d74c356f9fe327259c146a3cd6a782 /sources/shiboken6/tests/minimalbinding
parent58a7066609938c04f5d5214a326d6220e8c062e0 (diff)
shiboken6: Test opaque container for span
Task-number: PYSIDE-2174 Change-Id: I812bef400ef2a006eb6aaca749d8961dc3aa7330 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/shiboken6/tests/minimalbinding')
-rw-r--r--sources/shiboken6/tests/minimalbinding/spanuser_test.py9
-rw-r--r--sources/shiboken6/tests/minimalbinding/typesystem_minimal.xml15
2 files changed, 23 insertions, 1 deletions
diff --git a/sources/shiboken6/tests/minimalbinding/spanuser_test.py b/sources/shiboken6/tests/minimalbinding/spanuser_test.py
index 8473ad6af..6db6aa616 100644
--- a/sources/shiboken6/tests/minimalbinding/spanuser_test.py
+++ b/sources/shiboken6/tests/minimalbinding/spanuser_test.py
@@ -28,6 +28,15 @@ class IntSpanTest(unittest.TestCase):
self.assertEqual(SpanUser.sumIntSpan(expected), 6)
self.assertEqual(SpanUser.sumConstIntSpan3(expected), 6)
+ def testSpanOpaqueContainer(self):
+ if not SpanUser.enabled():
+ return
+ oc = SpanUser.getIntSpan3_OpaqueContainer() # 1,2,3
+ oc[1] = 10
+ oc = SpanUser.getIntSpan3_OpaqueContainer()
+ # note: This converts to std::vector
+ self.assertEqual(SpanUser.sumIntSpan3(oc), 14)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/shiboken6/tests/minimalbinding/typesystem_minimal.xml b/sources/shiboken6/tests/minimalbinding/typesystem_minimal.xml
index ef317f415..e18bf8686 100644
--- a/sources/shiboken6/tests/minimalbinding/typesystem_minimal.xml
+++ b/sources/shiboken6/tests/minimalbinding/typesystem_minimal.xml
@@ -21,6 +21,10 @@
<opaque-container name="std::array" opaque-containers="int,3:StdIntArray"/>
+ <?if c++20?> <!-- FIXME PYSIDE 7: Remove "if" -->
+ <opaque-container name="std::span" opaque-containers="int,3:StdIntSpan3"/>
+ <?endif?>
+
<object-type name="Obj"/>
<value-type name="Val">
<enum-type name="ValEnum"/>
@@ -38,7 +42,16 @@
</modify-argument>
</modify-function>
</value-type>
- <value-type name="SpanUser"/>
+
+ <value-type name="SpanUser">
+ <?if c++20?> <!-- FIXME PYSIDE 7: Remove "if" -->
+ <modify-function signature="getIntSpan3_OpaqueContainer()">
+ <modify-argument index="return">
+ <replace-type modified-type="StdIntSpan3"/>
+ </modify-argument>
+ </modify-function>
+ <?endif?>
+ </value-type>
<value-type name="MinBoolUser"/>