From 7f00e90d3c4be2b023166e483c29a280960a35a4 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 20 Mar 2017 11:19:26 +0100 Subject: Add QML test for "Fix search restart after zero entries" The issue has been fixed in the qtwebengine-chromium 55-based branch: 2890c82cbd3a3e66d7062c9d9f4f065f5cc09d9e This test is based on the corresponding chromium test: https://codereview.chromium.org/2537773008/patch/1/10002 Change-Id: Ia930c42f2c3337f10fe133a35ffb5b596aa61d9f Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/data/tst_findText.qml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml index 4761513c1..78359bfc2 100644 --- a/tests/auto/quick/qmltests/data/tst_findText.qml +++ b/tests/auto/quick/qmltests/data/tst_findText.qml @@ -52,6 +52,15 @@ TestWebEngineView { TestCase { name: "WebViewFindText" + function getBodyInnerHTML() { + var bodyInnerHTML; + runJavaScript("document.body.innerHTML", function(result) { + bodyInnerHTML = result; + }); + tryVerify(function() { return bodyInnerHTML != undefined; }); + return bodyInnerHTML; + } + function test_findText() { var findFlags = WebEngineView.FindCaseSensitively webEngineView.url = Qt.resolvedUrl("test1.html") @@ -126,5 +135,27 @@ TestWebEngineView { tryCompare(webEngineView, "matchCount", 1) verify(!findFailed) } + + function test_findTextInModifiedDOMAfterNotFound() { + var findFlags = 0 + webEngineView.loadHtml( + "" + + "bla" + + ""); + verify(webEngineView.waitForLoadSucceeded()) + + webEngineView.clear() + webEngineView.findText("hello", findFlags, webEngineView.findTextCallback) + tryCompare(webEngineView, "matchCount", 0) + verify(findFailed) + + runJavaScript("document.body.innerHTML = 'blahellobla'"); + tryVerify(function() { return getBodyInnerHTML() == "blahellobla"; }); + + webEngineView.clear() + webEngineView.findText("hello", findFlags, webEngineView.findTextCallback) + tryCompare(webEngineView, "matchCount", 1) + verify(!findFailed) + } } } -- cgit v1.2.3