diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2017-10-30 13:03:42 +0100 |
---|---|---|
committer | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2017-11-27 10:07:41 +0000 |
commit | 942e5a8b85d1b40b8fa859ef11b011cc5bccae6d (patch) | |
tree | 8c52ed0bd25df4e21bd1e41acdec5e4d1ccea8ee /tests/auto | |
parent | 88a485467551d126cef26de002b146dfc15775c2 (diff) |
Speculative stabilization of tst_QWebEngineView::emptyInputMethodEvent
Avoid false positive results by waiting for a value change when it is not
expected to be changed and make sure the event is processed before check
for unexpected change. Moreover, verify that the composition events are
sent.
Change-Id: Ie7a53237b90cda433502e7f376fbe2ae1964385d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 530b71129..48b12e18b 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1944,10 +1944,9 @@ void tst_QWebEngineView::emptyInputMethodEvent() // 1. Empty input method event does not clear text QInputMethodEvent emptyEvent; - QApplication::sendEvent(view.focusProxy(), &emptyEvent); - - QString inputValue = evaluateJavaScriptSync(view.page(), "document.getElementById('input1').value").toString(); - QTRY_COMPARE(inputValue, QStringLiteral("QtWebEngine")); + QVERIFY(QApplication::sendEvent(view.focusProxy(), &emptyEvent)); + qApp->processEvents(); + QCOMPARE(evaluateJavaScriptSync(view.page(), "document.getElementById('input1').value").toString(), QStringLiteral("QtWebEngine")); QTRY_COMPARE(view.focusProxy()->inputMethodQuery(Qt::ImSurroundingText).toString(), QStringLiteral("QtWebEngine")); // Reset: clear input field @@ -1959,12 +1958,12 @@ void tst_QWebEngineView::emptyInputMethodEvent() // Start IME composition QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent eventComposition("a", attributes); - QApplication::sendEvent(view.focusProxy(), &eventComposition); + QVERIFY(QApplication::sendEvent(view.focusProxy(), &eventComposition)); QTRY_COMPARE(evaluateJavaScriptSync(view.page(), "document.getElementById('input1').value").toString(), QStringLiteral("a")); QTRY_VERIFY(view.focusProxy()->inputMethodQuery(Qt::ImSurroundingText).toString().isEmpty()); // Cancel IME composition - QApplication::sendEvent(view.focusProxy(), &emptyEvent); + QVERIFY(QApplication::sendEvent(view.focusProxy(), &emptyEvent)); QTRY_VERIFY(evaluateJavaScriptSync(view.page(), "document.getElementById('input1').value").toString().isEmpty()); QTRY_VERIFY(view.focusProxy()->inputMethodQuery(Qt::ImSurroundingText).toString().isEmpty()); |