diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-04-06 21:25:50 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:07 -0300 |
commit | 77be0fc1a7927022347104162b4bd42f0cbb01a8 (patch) | |
tree | 21ba54d8df53b25d6089dadd5702e9442764f0f5 | |
parent | f1b3580d577a20a3b317dae42583652248141f6a (diff) |
Fixes bugs 739 and 752.
Bug #739 - Method "QTransform::map(qreal x, qreal y, qreal* tx, qreal* ty) const" missing
Bug #752 - Method "void QSplitter::getRange(int index, int* min, int* max) const" missing
Also added unit tests.
-rw-r--r-- | PySide/QtGui/typesystem_gui_common.xml | 36 | ||||
-rw-r--r-- | PySide/typesystem_templates.xml | 8 | ||||
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/QtGui/qsplitter_test.py | 16 | ||||
-rw-r--r-- | tests/QtGui/qtransform_test.py | 16 |
5 files changed, 74 insertions, 4 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index f928d5ee5..a5089bc75 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -193,8 +193,22 @@ </inject-code> </add-function> - <!-- ### See bug 739 --> - <modify-function signature="map(qreal,qreal,qreal*,qreal*)const" remove="all"/> + <modify-function signature="map(qreal,qreal,qreal*,qreal*)const"> + <modify-argument index="0"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <modify-argument index="3"> + <remove-argument/> + </modify-argument> + <modify-argument index="4"> + <remove-argument/> + </modify-argument> + <inject-code class="target" position="beginning"> + <insert-template name="fix_args,number*,number*"> + <replace from="$TYPE" to="qreal" /> + </insert-template> + </inject-code> + </modify-function> <!-- ### This is just an overload to "map(qreal,qreal,qreal*,qreal*)const" and can be discarded in Python --> <modify-function signature="map(int,int,int*,int*)const" remove="all"/> <!-- ### --> @@ -4550,8 +4564,22 @@ <modify-function signature="print(QPrinter*)const" rename="print_" /> </object-type> <object-type name="QSplitter"> - <!-- ### See bug 752 --> - <modify-function signature="getRange(int,int*,int*)const" remove="all" /> + <modify-function signature="getRange(int,int*,int*)const"> + <modify-argument index="0"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <modify-argument index="2"> + <remove-argument/> + </modify-argument> + <modify-argument index="3"> + <remove-argument/> + </modify-argument> + <inject-code class="target" position="beginning"> + <insert-template name="fix_args,number*,number*"> + <replace from="$TYPE" to="int" /> + </insert-template> + </inject-code> + </modify-function> <modify-function signature="addWidget(QWidget *)"> <modify-argument index="1"> <parent index="this" action="add"/> diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 51ba3742e..ed0d6bdc9 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -196,6 +196,14 @@ %PYARG_0 = Shiboken::makeTuple(_ret, _arg); </template> + <template name="fix_args,number*,number*"> + $TYPE a, b; + PyThreadState* _save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &a, &b); + PyEval_RestoreThread(_save); // Py_END_ALLOW_THREADS + %PYARG_0 = Shiboken::makeTuple(a, b); + </template> + <template name="fix_virtual_method_return_value_and_bool*"> Shiboken::AutoDecRef _py_ret_(PySequence_GetItem(%PYARG_0, 0)); Shiboken::AutoDecRef _py_ok_(PySequence_GetItem(%PYARG_0, 1)); diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index ef62638fc..515c2e235 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -95,6 +95,7 @@ PYSIDE_TEST(qpushbutton_test.py) PYSIDE_TEST(qradialgradient_test.py) PYSIDE_TEST(qregion_test.py) PYSIDE_TEST(qshortcut_test.py) +PYSIDE_TEST(qsplitter_test.py) PYSIDE_TEST(qstandarditemmodel_test.py) PYSIDE_TEST(qstring_qkeysequence_test.py) PYSIDE_TEST(qstyle_test.py) @@ -104,6 +105,7 @@ PYSIDE_TEST(qtextedit_test.py) PYSIDE_TEST(qtextedit_signal_test.py) PYSIDE_TEST(qtoolbar_test.py) PYSIDE_TEST(qtoolbox_test.py) +PYSIDE_TEST(qtransform_test.py) PYSIDE_TEST(qvariant_test.py) PYSIDE_TEST(qvalidator_test.py) PYSIDE_TEST(qwidget_setlayout_test.py) diff --git a/tests/QtGui/qsplitter_test.py b/tests/QtGui/qsplitter_test.py new file mode 100644 index 000000000..a438b6949 --- /dev/null +++ b/tests/QtGui/qsplitter_test.py @@ -0,0 +1,16 @@ +import unittest +from PySide.QtGui import QSplitter + +from helper import UsesQApplication + +class QSplitterTest(UsesQApplication): + + def testGetRange(self): + splitter = QSplitter() + _min, _max = splitter.getRange(0) + self.assert_(isinstance(_min, int)) + self.assert_(isinstance(_max, int)) + +if __name__ == "__main__": + unittest.main() + diff --git a/tests/QtGui/qtransform_test.py b/tests/QtGui/qtransform_test.py new file mode 100644 index 000000000..450bf3292 --- /dev/null +++ b/tests/QtGui/qtransform_test.py @@ -0,0 +1,16 @@ +import unittest +from PySide.QtGui import QTransform + +class QTransformTest(unittest.TestCase): + + def testMap(self): + transform = QTransform() + values = (10.0, 20.0) + tx, ty = transform.map(*values) + self.assert_(isinstance(tx, float)) + self.assert_(isinstance(ty, float)) + self.assertEqual((tx, ty), values) + +if __name__ == "__main__": + unittest.main() + |