summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextedit
diff options
context:
space:
mode:
authorSamuel Nevala <samuel.nevala@digia.com>2009-11-20 11:48:48 +0100
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-24 14:53:53 +0100
commit7db46e32124ad902eb08baaa146f84403b1fbcbd (patch)
tree332d5c0967ad7cbe1fd6af2d6b454694ef0a23f2 /tests/auto/qtextedit
parent0d833e51a1917433a9fb77080632a5803ab6deb8 (diff)
Softkeys: Text disappears from textbox when predictive text is active.
If two QInputMethodEvent("preedittext", attributes) or more are send in a row, textedit is drawn empty. Event creates lines based on isGettingInput flag and clears line every time there is preedit text. On 2nd event lines are cleared but not created since e->preeditString() != cursor.block().layout()->preeditAreaText() set isGettingInput to zero. When draw begins line count is checked. If no lines return. Moved layout->setPreeditArea() under if (isGettingInput) so pre-edit text is set only when text really changes. http://bugreports.qt.nokia.com/browse/QTBUG-4696 Task-number:QTBUG-4696 Reviewed-by:Markku Luukkainen Merge-request: 2132 Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Diffstat (limited to 'tests/auto/qtextedit')
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp
index fee030c9ef..bebc4bd528 100644
--- a/tests/auto/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/qtextedit/tst_qtextedit.cpp
@@ -200,6 +200,7 @@ private slots:
void pasteFromQt3RichText();
void noWrapBackgrounds();
void preserveCharFormatAfterUnchangingSetPosition();
+ void twoSameInputMethodEvents();
private:
void createSelection();
@@ -2183,5 +2184,23 @@ void tst_QTextEdit::preserveCharFormatAfterUnchangingSetPosition()
QCOMPARE(edit.textColor(), color);
}
+// Regression test for QTBUG-4696
+void tst_QTextEdit::twoSameInputMethodEvents()
+{
+ ed->setText("testLine");
+ ed->show();
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
+ ed->textCursor().position(),
+ 0,
+ QVariant()));
+
+ QInputMethodEvent event("PreEditText", attributes);
+ QApplication::sendEvent(ed, &event);
+ QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1);
+ QApplication::sendEvent(ed, &event);
+ QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1);
+}
+
QTEST_MAIN(tst_QTextEdit)
#include "tst_qtextedit.moc"