QLineEdit: Clear input context commit string after test functions

Since the PlatformInputContext is shared between test cases, the set commit
string from inputMethod() was otherwise saved and could pollute other tests.

For example on Windows PlatformInputContext::commit() was called when the
QLineEdit was first clicked onto in tst_QLineEdit::testQuickSelectionWithMouse()
and inserted "text" in the middle of the text, rather than starting selection as
intended.

This led to tst_QLineEdit::testQuickSelectionWithMouse() failing on Windows at
first in CI, but then always passing the repeats when it was tested alone.

Task-number: QTBUG-66499
Task-number: QTBUG-66216
Change-Id: Id6bdd263d57fd6d08fb48f013542b55b132907ea
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
bb10
Kari Oikarinen 2018-02-19 14:53:04 +02:00
parent 0d4ce766ae
commit 13e51ea487
1 changed files with 1 additions and 0 deletions

View File

@ -411,6 +411,7 @@ void tst_QLineEdit::cleanup()
{
delete m_testWidget;
m_testWidget = 0;
m_platformInputContext.m_commitString.clear();
}
void tst_QLineEdit::experimental()