diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-04-19 02:01:17 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-04-19 02:39:51 (GMT) |
commit | 708e090aef81c59904c483a2ea46b275ef21c7e4 (patch) | |
tree | f465ae7f063e3884e975dfc4f449cc4142aae9b1 /tests/auto/declarative | |
parent | 81044282befaa5af7247804c7875df83c89c6459 (diff) | |
download | Qt-708e090aef81c59904c483a2ea46b275ef21c7e4.zip Qt-708e090aef81c59904c483a2ea46b275ef21c7e4.tar.gz Qt-708e090aef81c59904c483a2ea46b275ef21c7e4.tar.bz2 |
Fix excessive scrolling in TextInput with mid string pre-edit text.
Don't emit text or cursor position changed signals until all the state
changes from the input method event are made. Otherwise properties
like horizontal scroll are updated based on invalid intermediate data.
Change-Id: If543dbe58dc571aeda495152d99be95645eea140
Task-number: QTBUG-18789
Reviewed-by: Martin Jones
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index ef32ee3..943b1fa 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -2285,6 +2285,20 @@ void tst_qdeclarativetextinput::preeditAutoScroll() ic.sendPreeditText(preeditText.mid(0, 3), 1); QCOMPARE(input.positionAt(0), 0); QCOMPARE(input.positionAt(input.width()), 5); + + ic.sendEvent(QInputMethodEvent()); + input.setAutoScroll(true); + // Test committing pre-edit text at the start of the string. QTBUG-18789 + input.setCursorPosition(0); + ic.sendPreeditText(input.text(), 5); + QCOMPARE(input.positionAt(0), 0); + + QInputMethodEvent event; + event.setCommitString(input.text()); + ic.sendEvent(event); + + QCOMPARE(input.positionAt(0), 0); + QCOMPARE(input.positionAt(input.width()), 5); } void tst_qdeclarativetextinput::preeditMicroFocus() |