diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-08-04 09:14:17 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-04 09:14:17 +0200 |
commit | 673160b9fd7b9a75336ba293dda7e64f3d732a80 (patch) | |
tree | b37e0216a090fbc9ac19dd55ca5e2ba1af1ef7cb /tests/auto/qtextedit | |
parent | 9a652ed802d5ec1114ba97ad86eca8d2f25c53d9 (diff) | |
parent | 92c998afb66a2ec900d50cab57929c0a97ad46ac (diff) |
Merge "Merge remote branch 'gerrit/master' into refactor" into refactor
Diffstat (limited to 'tests/auto/qtextedit')
-rw-r--r-- | tests/auto/qtextedit/tst_qtextedit.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index 67c610b21a..f10879d284 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -207,6 +207,8 @@ private slots: void bidiLogicalMovement_data(); void bidiLogicalMovement(); + void inputMethodSelection(); + private: void createSelection(); int blockCount() const; @@ -2365,5 +2367,30 @@ void tst_QTextEdit::bidiLogicalMovement() } while (moved && i >= 0); } +void tst_QTextEdit::inputMethodSelection() +{ + ed->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); + + QSignalSpy selectionSpy(ed, SIGNAL(selectionChanged())); + QTextCursor cursor = ed->textCursor(); + cursor.setPosition(0); + cursor.setPosition(5, QTextCursor::KeepAnchor); + ed->setTextCursor(cursor); + + QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(ed->textCursor().selectionStart(), 0); + QCOMPARE(ed->textCursor().selectionEnd(), 5); + + QList<QInputMethodEvent::Attribute> attributes; + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant()); + QInputMethodEvent event("", attributes); + QApplication::sendEvent(ed, &event); + + QCOMPARE(selectionSpy.count(), 2); + QCOMPARE(ed->textCursor().selectionStart(), 12); + QCOMPARE(ed->textCursor().selectionEnd(), 17); +} + + QTEST_MAIN(tst_QTextEdit) #include "tst_qtextedit.moc" |