summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/qwebenginepage
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2019-11-20 09:31:20 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2019-11-28 14:07:37 +0100
commit9d2521084dbec9403ab68ea5e95b8a77313af11f (patch)
tree522e74ae2f6db0065dcf2fd44afdba7d04fc7034 /tests/auto/widgets/qwebenginepage
parent2c8113eb5b68d3678fd68bdde32fc6dca726c983 (diff)
Update find request id when a new search interrupts an ongoing search
If the new test became flaky it might happen because the first text search finished before the second findText() call. This is very unlikely, but in this case the test should be modified to not to check if the first find failed. The point is to check we get the correct amount of signals and the second search doesn't assert. If the callbacks will be removed in Qt6, it should be re-considered to remove the "unfinished find" workaround and trigger the first successful findTextFinished() signal even if it happens in the middle of another search. Fixes: QTBUG-80086 Change-Id: I9c1ce20fc43fd81e8af784385a00ac2e7f7603b7 Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
Diffstat (limited to 'tests/auto/widgets/qwebenginepage')
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 88cdcbb96..d8c1a5360 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -992,6 +992,19 @@ void tst_QWebEnginePage::findText()
QTRY_COMPARE(signalSpy.count(), 1);
QTRY_COMPARE(m_view->selectedText(), QString("foo"));
}
+
+ // Invoking startFinding operation for the same text twice. Without any wait, the second one
+ // should interrupt the first one.
+ {
+ QSignalSpy signalSpy(m_view->page(), &QWebEnginePage::findTextFinished);
+ m_view->findText("foo", 0);
+ m_view->findText("foo", 0);
+ QTRY_COMPARE(signalSpy.count(), 2);
+ QTRY_VERIFY(m_view->selectedText().isEmpty());
+
+ QCOMPARE(signalSpy.at(0).value(0).value<QWebEngineFindTextResult>().numberOfMatches(), 0);
+ QCOMPARE(signalSpy.at(1).value(0).value<QWebEngineFindTextResult>().numberOfMatches(), 1);
+ }
}
void tst_QWebEnginePage::findTextResult()