diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2015-04-01 16:45:00 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2015-04-08 09:52:01 +0300 |
commit | 700177a1c743a39bc738c950995a0fae346e5de8 (patch) | |
tree | 04db4e2ca5da1b08eabaa0a6ebb436c2dfaaea6e /src/virtualkeyboard/hunspellinputmethod.cpp | |
parent | d92f2e38fc9fbe89c85528c5fa70d56228165672 (diff) |
Fix random fail that occurs in the spell correction tests
This issue occurs randomly when the tests are run in release mode.
This is an actual issue, but may not occur so easily in the real life.
When the input sequence is entered quickly (like in the automated
test script) the candidate list built in the background may override
the last input character. This happens only if the candidate list
build is finished right after the new character is added to the
input word. In this case the old candidate list overrides the exact
match. It is also required that the user selects the outdated result,
for example, by entering a space key, before the latest candidate
list is built.
Change-Id: Ia2d5eb65ea92dc0f159e2b3f822857e63c0f1ec6
Task-number: QTRD-3562
Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
Diffstat (limited to 'src/virtualkeyboard/hunspellinputmethod.cpp')
-rw-r--r-- | src/virtualkeyboard/hunspellinputmethod.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/virtualkeyboard/hunspellinputmethod.cpp b/src/virtualkeyboard/hunspellinputmethod.cpp index 06a5d4d3..2504a0b0 100644 --- a/src/virtualkeyboard/hunspellinputmethod.cpp +++ b/src/virtualkeyboard/hunspellinputmethod.cpp @@ -385,6 +385,9 @@ void HunspellInputMethod::updateSuggestions(const QStringList &wordList, int act Q_D(HunspellInputMethod); d->wordCandidates.clear(); d->wordCandidates.append(wordList); + // Make sure the exact match is up-to-date + if (!d->word.isEmpty() && !d->wordCandidates.isEmpty() && d->wordCandidates.at(0) != d->word) + d->wordCandidates.replace(0, d->word); d->activeWordIndex = activeWordIndex; emit selectionListChanged(DeclarativeSelectionListModel::WordCandidateList); emit selectionListActiveItemChanged(DeclarativeSelectionListModel::WordCandidateList, d->activeWordIndex); |