diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-07-19 12:08:56 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-07-23 13:52:46 +0200 |
commit | c18c51acf8d0eb9426ce998d6e09f20a4a481c40 (patch) | |
tree | 3f314634c361f6ccb4e43d596370167003ec210a /tests/auto/widgets/spellchecking/tst_spellchecking.cpp | |
parent | f43d9dc448f0fd2073f44ea696205969ffd0d9c8 (diff) | |
parent | 662de14ceecee701b31478849ae147c70f3fe00f (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
src/core/config/common.pri
src/core/configure.json
src/core/net/url_request_qrc_job_qt.cpp
src/core/ozone/surface_factory_qt.cpp
src/core/web_contents_adapter.cpp
Change-Id: If679aa179123f793639da3d8ee4ab5d116707754
Diffstat (limited to 'tests/auto/widgets/spellchecking/tst_spellchecking.cpp')
-rw-r--r-- | tests/auto/widgets/spellchecking/tst_spellchecking.cpp | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp index b6582083d..d02fc78b9 100644 --- a/tests/auto/widgets/spellchecking/tst_spellchecking.cpp +++ b/tests/auto/widgets/spellchecking/tst_spellchecking.cpp @@ -174,14 +174,41 @@ void tst_Spellchecking::spellcheck() QString result = evaluateJavaScriptSync(m_view->page(), "text();").toString(); QVERIFY(result == text); - // open menu on misspelled word - m_view->activateMenu(m_view->focusWidget(), rect.center()); - QSignalSpy spyMenuReady(m_view, &WebView::menuReady); - QVERIFY(spyMenuReady.wait()); - - // check if menu is valid - QVERIFY(m_view->data().isValid()); - QVERIFY(m_view->data().isContentEditable()); + bool gotMisspelledWord = false; // clumsy QTRY_VERIFY still execs expr after first success + QString detail; + + // check that spellchecker has done text processing and filled misspelled word + QTRY_VERIFY2([&] () { + detail.clear(); + if (gotMisspelledWord) + return true; + + // open menu on misspelled word + m_view->activateMenu(m_view->focusWidget(), rect.center()); + QSignalSpy spyMenuReady(m_view, &WebView::menuReady); + if (!spyMenuReady.wait()) { + detail = "menu was not shown"; + return false; + } + + if (!m_view->data().isValid()) { + detail = "invalid data"; + return false; + } + + if (!m_view->data().isContentEditable()) { + detail = "content is not editable"; + return false; + } + + if (m_view->data().misspelledWord().isEmpty()) { + detail = "no misspelled word"; + return false; + }; + + gotMisspelledWord = true; + return true; + } (), qPrintable(QString("Context menu: %1").arg(detail))); // check misspelled word QCOMPARE(m_view->data().misspelledWord(), QStringLiteral("lowe")); |