summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/data/tst_findText.qml
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-19 12:08:56 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-23 13:52:46 +0200
commitc18c51acf8d0eb9426ce998d6e09f20a4a481c40 (patch)
tree3f314634c361f6ccb4e43d596370167003ec210a /tests/auto/quick/qmltests/data/tst_findText.qml
parentf43d9dc448f0fd2073f44ea696205969ffd0d9c8 (diff)
parent662de14ceecee701b31478849ae147c70f3fe00f (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/quick/qmltests/data/tst_findText.qml')
-rw-r--r--tests/auto/quick/qmltests/data/tst_findText.qml22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml
index 1ec574fae..14053a675 100644
--- a/tests/auto/quick/qmltests/data/tst_findText.qml
+++ b/tests/auto/quick/qmltests/data/tst_findText.qml
@@ -43,13 +43,21 @@ TestWebEngineView {
matchCount = -1
}
+ function findCallbackCalled() { return matchCount != -1 }
+
function findTextCallback(matchCount) {
+ // If this starts to fail then either clear was not called before findText
+ // or unexpected callback was triggered from some search.
+ // On c++ side callback id can be checked to verify
+ testcase.verify(!findCallbackCalled(), 'Unexpected callback call or uncleared state before findText call!')
+
webEngineView.matchCount = matchCount
findFailed = matchCount == 0
}
TestCase {
+ id: testcase
name: "WebViewFindText"
function getBodyInnerHTML() {
@@ -207,13 +215,17 @@ TestWebEngineView {
webEngineView.findText("hello", findFlags, webEngineView.findTextCallback);
// This should not crash.
- webEngineView.url = "https://www.qt.io";
- if (!webEngineView.waitForLoadSucceeded(12000))
- skip("Couldn't load page from network, skipping test.");
+ webEngineView.loadHtml("<html><body>New page with same hello text</body></html>")
+ verify(webEngineView.waitForLoadSucceeded())
// The callback is not supposed to be called, see QTBUG-61506.
- // Check whether the callback was called (-1 = no, other values = yes).
- tryVerify(function() { return webEngineView.matchCount == -1; }, 20000);
+ expectFailContinue('', 'No unexpected findText callback calls occurred.')
+ tryVerify(function() { return webEngineView.findCallbackCalled() })
+ verify(!webEngineView.findCallbackCalled())
+
+ webEngineView.clear();
+ webEngineView.findText('New page', findFlags, webEngineView.findTextCallback)
+ tryCompare(webEngineView, 'matchCount', 1)
}
}
}