aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml31
-rw-r--r--tests/QtGui/qmatrix_test.py9
2 files changed, 36 insertions, 4 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 01cd45dc5..749e66ffc 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -840,10 +840,33 @@
</insert-template>
</inject-code>
</add-function>
- <!-- ### See bug 760 -->
- <modify-function signature="map(int,int,int*,int*)const" remove="all"/>
- <!-- ### See bug 761 -->
- <modify-function signature="map(qreal,qreal,qreal*,qreal*)const" remove="all"/>
+ <template name="qmatrix_map">
+ %ARG1_TYPE a, b;
+ %CPPSELF.%FUNCTION_NAME(%1, %2, &amp;a, &amp;b);
+ %PYARG_0 = Shiboken::makeTuple(a, b);
+ </template>
+ <modify-function signature="map(int,int,int*,int*)const">
+ <modify-argument index="3">
+ <remove-argument />
+ </modify-argument>
+ <modify-argument index="4">
+ <remove-argument />
+ </modify-argument>
+ <inject-code>
+ <insert-template name="qmatrix_map" />
+ </inject-code>
+ </modify-function>
+ <modify-function signature="map(qreal,qreal,qreal*,qreal*)const">
+ <modify-argument index="3">
+ <remove-argument />
+ </modify-argument>
+ <modify-argument index="4">
+ <remove-argument />
+ </modify-argument>
+ <inject-code>
+ <insert-template name="qmatrix_map" />
+ </inject-code>
+ </modify-function>
<modify-function signature="inverted(bool*)const">
<modify-argument index="1">
<remove-argument/>
diff --git a/tests/QtGui/qmatrix_test.py b/tests/QtGui/qmatrix_test.py
index 7c87e23a4..d1fa91ec6 100644
--- a/tests/QtGui/qmatrix_test.py
+++ b/tests/QtGui/qmatrix_test.py
@@ -44,6 +44,15 @@ class QMatrixTest(unittest.TestCase):
d = m.copyDataTo()
self.assert_(my_data == list(d))
+ def testMatrixMapping(self):
+ m = QMatrix(1.0, 2.0, 1.0, 3.0, 100.0, 200.0)
+ res = m.map(5, 5)
+ self.assertAlmostEqual(res[0], 5 * 1.0 + 5 * 1.0 + 100.0)
+ self.assertAlmostEqual(res[1], 5 * 2.0 + 5 * 3.0 + 200.0)
+ res = m.map(5.0, 5.0)
+ self.assertAlmostEqual(res[0], 5.0 * 1.0 + 5.0 * 1.0 + 100.0)
+ self.assertAlmostEqual(res[1], 5.0 * 2.0 + 5.0 * 3.0 + 200.0)
+
if __name__ == '__main__':
unittest.main()