summaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/typesystem_sample.xml
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-10-15 17:17:35 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-10-15 18:10:04 -0300
commitb548f03130cdd2aa7bdcb4bf00f5da8240fc78ee (patch)
tree7955652380b54fbcc2ddfcc906b18ff0bcba3cf3 /tests/samplebinding/typesystem_sample.xml
parentd874d137b5062735bbd0fa33b0824d476c0fc127 (diff)
downloadshiboken-b548f03130cdd2aa7bdcb4bf00f5da8240fc78ee.tar.gz
shiboken-b548f03130cdd2aa7bdcb4bf00f5da8240fc78ee.tar.xz
shiboken-b548f03130cdd2aa7bdcb4bf00f5da8240fc78ee.zip
Added test for overload decisor handling container dependencies.
Explaining with an example. Consider a function called "function" with two signatures accepting a list of Point and a list of PointF, respectively. Consider also that Point is implicitly convertible to PointF. void function(list<Point>&) void function(list<PointF>&) A list of Point should be checked before a list of PointF. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/samplebinding/typesystem_sample.xml')
-rw-r--r--tests/samplebinding/typesystem_sample.xml36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 82684fe8..319cc658 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -969,6 +969,38 @@
</add-function>
</value-type>
+ <value-type name="PointF">
+ <add-function signature="__str__" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ int x1 = (int) %CPPSELF.x();
+ int x2 = ((int) (%CPPSELF.x() * 100)) - (x1 * 100);
+ int y1 = (int) %CPPSELF.y();
+ int y2 = ((int) (%CPPSELF.y() * 100)) - (y1 * 100);
+ %PYARG_0 = PyString_FromFormat("PointF(%d.%d, %d.%d)", x1, x2, y1, y2);
+ </inject-code>
+ </add-function>
+ <add-function signature="__repr__" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ int x1 = (int) %CPPSELF.x();
+ int x2 = ((int) (%CPPSELF.x() * 10)) - (x1 * 10);
+ int y1 = (int) %CPPSELF.y();
+ int y2 = ((int) (%CPPSELF.y() * 10)) - (y1 * 10);
+ %PYARG_0 = PyString_FromFormat("&lt;PointF object at %p: (%d.%d, %d.%d)&gt;", %CPPSELF, x1, x2, y1, y2);
+ </inject-code>
+ </add-function>
+
+ <add-function signature="__reduce__" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ PyObject *type = PyObject_Type(%PYSELF);
+ PyObject *args = NULL;
+
+ args = Py_BuildValue("(dd)", %CPPSELF.x(), %CPPSELF.y());
+
+ %PYARG_0 = Py_BuildValue("(OO)", type, args);
+ </inject-code>
+ </add-function>
+ </value-type>
+
<value-type name="Polygon">
<modify-function signature="stealOwnershipFromPython(Point*)">
<modify-argument index="1">
@@ -997,7 +1029,9 @@
</value-type>
<value-type name="MapUser"/>
<value-type name="PairUser"/>
- <value-type name="ListUser"/>
+ <value-type name="ListUser">
+ <enum-type name="ListOfSomething"/>
+ </value-type>
<value-type name="NoImplicitConversion" />
<value-type name="NonDefaultCtor" />
<value-type name="OddBoolUser" />