aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-08-02 13:06:58 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:07 -0300
commit6bb2780c978d93b6ebe7b423adda27e4292467f2 (patch)
tree975bb03485f15e28e514a5333fdced6f8a2c246f /tests/samplebinding
parentf3b6eeccd43fc8b81bb7fe48424b6f4c6e4e454d (diff)
Added test for removed pointer out argument.
Diffstat (limited to 'tests/samplebinding')
-rw-r--r--tests/samplebinding/point_test.py7
-rw-r--r--tests/samplebinding/pointf_test.py7
-rw-r--r--tests/samplebinding/typesystem_sample.xml31
3 files changed, 43 insertions, 2 deletions
diff --git a/tests/samplebinding/point_test.py b/tests/samplebinding/point_test.py
index 3b45db4ad..6d9fc8fca 100644
--- a/tests/samplebinding/point_test.py
+++ b/tests/samplebinding/point_test.py
@@ -93,6 +93,11 @@ class PointTest(unittest.TestCase):
r = u'Hi' - p
self.assertEqual(r, u'Hi')
+ def testModifiedMethod(self):
+ pt1 = Point(0.0, 0.0)
+ pt2 = Point(10.0, 10.0)
+ expected = Point((pt1.x() + pt2.x()) / 2.0, (pt1.y() + pt2.y()) / 2.0)
+ self.assertEqual(pt1.midpoint(pt2), expected)
+
if __name__ == '__main__':
unittest.main()
-
diff --git a/tests/samplebinding/pointf_test.py b/tests/samplebinding/pointf_test.py
index f9aac9f20..5cb84800a 100644
--- a/tests/samplebinding/pointf_test.py
+++ b/tests/samplebinding/pointf_test.py
@@ -54,6 +54,11 @@ class PointFTest(unittest.TestCase):
self.assertTrue(pt1 == pt2)
self.assertFalse(pt1 == pt3)
+ def testModifiedMethod(self):
+ pt1 = PointF(0.0, 0.0)
+ pt2 = PointF(10.0, 10.0)
+ expected = PointF((pt1.x() + pt2.x()) / 2.0, (pt1.y() + pt2.y()) / 2.0)
+ self.assertEqual(pt1.midpoint(pt2), expected)
+
if __name__ == '__main__':
unittest.main()
-
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 25301973e..5184526e4 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -1135,6 +1135,22 @@
%PYARG_0 = Py_BuildValue("(OO)", type, args);
</inject-code>
</add-function>
+
+ <modify-function signature="midpoint(const Point&amp;, Point*)const">
+ <modify-argument index="2">
+ <remove-argument />
+ </modify-argument>
+ <modify-argument index="return">
+ <replace-type modified-type="Point" />
+ </modify-argument>
+ <inject-code class="target" position="beginning">
+ Point _midpoint;
+ // The test consists in *NOT* using the ARGUMENT_NAMES type system variable.
+ %CPPSELF.%FUNCTION_NAME(%1, &amp;_midpoint);
+ %PYARG_0 = %CONVERTTOPYTHON[Point](_midpoint);
+ </inject-code>
+ </modify-function>
+
<template name="return_self">
%PYARG_0 = %PYARG_1;
Py_INCREF(%PYARG_1);
@@ -1182,6 +1198,21 @@
%PYARG_0 = Py_BuildValue("(OO)", type, args);
</inject-code>
</add-function>
+
+ <modify-function signature="midpoint(const PointF&amp;, PointF*)const">
+ <modify-argument index="2">
+ <remove-argument />
+ </modify-argument>
+ <modify-argument index="return">
+ <replace-type modified-type="PointF" />
+ </modify-argument>
+ <inject-code class="target" position="beginning">
+ PointF _midpoint;
+ // The test consists in using the ARGUMENT_NAMES type system variable.
+ %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;_midpoint);
+ %PYARG_0 = %CONVERTTOPYTHON[PointF](_midpoint);
+ </inject-code>
+ </modify-function>
</value-type>
<value-type name="Rect" />