diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-04-13 19:38:07 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:11 -0300 |
commit | accbee8ae8c76f93f97635a3a28fa8d7f1adac84 (patch) | |
tree | 26fb27e96ae622700df727658e05ac69a5fcdd2c | |
parent | eed7193f32218465381ddb5c0310585006674add (diff) |
Fixes bug #741 - Method "qreal QTextLine::cursorToX(int*,Edge) const" missing.
Also added unit tests.
http://bugs.pyside.org/show_bug.cgi?id=741
-rw-r--r-- | PySide/QtGui/typesystem_gui_common.xml | 12 | ||||
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtGui/qtextline_test.py | 23 |
3 files changed, 35 insertions, 1 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index f455d64b0..90525c7aa 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -407,8 +407,18 @@ <value-type name="QTextLine" > <enum-type name="CursorPosition"/> <enum-type name="Edge"/> - <!-- ### See bug 741 --> <modify-function signature="cursorToX(int*,QTextLine::Edge)const" remove="all" /> + <modify-function signature="cursorToX(int,QTextLine::Edge)const"> + <modify-argument index="0"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <inject-code class="target" position="beginning"> + %BEGIN_ALLOW_THREADS + %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2); + %END_ALLOW_THREADS + %PYARG_0 = Shiboken::makeTuple(%0, %1); + </inject-code> + </modify-function> <modify-function signature="xToCursor(qreal,QTextLine::CursorPosition)const"> <modify-argument index="2"> <rename to="edge"/> diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 5b4b02bce..91236afe8 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -109,6 +109,7 @@ PYSIDE_TEST(qtableview_test.py) PYSIDE_TEST(qtabwidget_test.py) PYSIDE_TEST(qtextedit_test.py) PYSIDE_TEST(qtextedit_signal_test.py) +PYSIDE_TEST(qtextline_test.py) PYSIDE_TEST(qtoolbar_test.py) PYSIDE_TEST(qtoolbox_test.py) PYSIDE_TEST(qtransform_test.py) diff --git a/tests/QtGui/qtextline_test.py b/tests/QtGui/qtextline_test.py new file mode 100644 index 000000000..76a711e32 --- /dev/null +++ b/tests/QtGui/qtextline_test.py @@ -0,0 +1,23 @@ + +import unittest + +from PySide.QtGui import QTextLayout +from helper import UsesQApplication + +class QTextLineTest(UsesQApplication): + + def testCursorToX(self): + textLayout = QTextLayout() + textLayout.beginLayout() + line = textLayout.createLine() + self.assert_(line.isValid()) + x, cursorPos = line.cursorToX(0) + self.assertEqual(type(x), float) + self.assertEqual(type(cursorPos), int) + x, cursorPos = line.cursorToX(1) + self.assertEqual(type(x), float) + self.assertEqual(type(cursorPos), int) + +if __name__ == '__main__': + unittest.main() + |