From 43f26916a5716ddcd2270c513f15a62b183929bb Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Tue, 1 Oct 2019 08:17:50 +0200 Subject: Improve QWebEngineFindTextResult API Implements suggestions from 5.14 API review: - Rename activeMatchOrdinal to activeMatch - Extend documentation - Change QML import version number to 1.10 Task-number: QTBUG-77839 Change-Id: I5eae659cfb5355af8d0c878d3b5f00654c9d6d13 Reviewed-by: Leena Miettinen Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/publicapi/tst_publicapi.cpp | 2 +- tests/auto/quick/qmltests/data/tst_findText.qml | 32 +++++++++++----------- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 16 +++++------ 3 files changed, 25 insertions(+), 25 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 9f7dfa8ad..321972057 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -279,7 +279,7 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineFileDialogRequest.dialogReject() --> void" << "QQuickWebEngineFileDialogRequest.mode --> FileMode" << "QWebEngineFindTextResult.numberOfMatches --> int" - << "QWebEngineFindTextResult.activeMatchOrdinal --> int" + << "QWebEngineFindTextResult.activeMatch --> int" << "QQuickWebEngineFormValidationMessageRequest.Hide --> RequestType" << "QQuickWebEngineFormValidationMessageRequest.Move --> RequestType" << "QQuickWebEngineFormValidationMessageRequest.Show --> RequestType" diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml index 040d324e6..c02a1348e 100644 --- a/tests/auto/quick/qmltests/data/tst_findText.qml +++ b/tests/auto/quick/qmltests/data/tst_findText.qml @@ -113,7 +113,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextCaseInsensitive() { @@ -127,7 +127,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextManyMatches() { @@ -141,7 +141,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 100) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } @@ -156,7 +156,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) } function test_findTextNotFound() { @@ -170,7 +170,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) } function test_findTextAfterNotFound() { @@ -184,7 +184,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) webEngineView.url = Qt.resolvedUrl("test1.html") verify(webEngineView.waitForLoadSucceeded()) @@ -195,7 +195,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextInModifiedDOMAfterNotFound() { @@ -212,7 +212,7 @@ TestWebEngineView { verify(findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0) + compare(findTextSpy.signalArguments[0][0].activeMatch, 0) runJavaScript("document.body.innerHTML = 'blahellobla'"); tryVerify(function() { return getBodyInnerHTML() == "blahellobla"; }, 20000); @@ -223,7 +223,7 @@ TestWebEngineView { verify(!findFailed) tryCompare(findTextSpy, "count", 1) compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1) - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1) + compare(findTextSpy.signalArguments[0][0].activeMatch, 1) } function test_findTextInterruptedByLoad() { @@ -276,7 +276,7 @@ TestWebEngineView { findTextSpy.wait(); compare(findTextSpy.count, i); compare(findTextSpy.signalArguments[i-1][0].numberOfMatches, 3); - compare(findTextSpy.signalArguments[i-1][0].activeMatchOrdinal, i); + compare(findTextSpy.signalArguments[i-1][0].activeMatch, i); } // The last match is followed by the fist one. @@ -285,7 +285,7 @@ TestWebEngineView { findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 3); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1); + compare(findTextSpy.signalArguments[0][0].activeMatch, 1); // The first match is preceded by the last one. webEngineView.clear(); @@ -293,23 +293,23 @@ TestWebEngineView { findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 3); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 3); + compare(findTextSpy.signalArguments[0][0].activeMatch, 3); - // Finding another word resets the activeMatchOrdinal. + // Finding another word resets the activeMatch. webEngineView.clear(); webEngineView.findText("bar"); findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 2); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1); + compare(findTextSpy.signalArguments[0][0].activeMatch, 1); - // If no match activeMatchOrdinal is 0. + // If no match activeMatch is 0. webEngineView.clear(); webEngineView.findText("bla"); findTextSpy.wait(); compare(findTextSpy.count, 1); compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0); - compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0); + compare(findTextSpy.signalArguments[0][0].activeMatch, 0); } } } diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 124dc825f..1b3295abb 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -999,7 +999,7 @@ void tst_QWebEnginePage::findTextResult() if (findTextSpy.count() != 1) return QVector({-1, -1}); auto r = findTextSpy.takeFirst().value(0).value(); - return QVector({ r.numberOfMatches(), r.activeMatchOrdinal() }); + return QVector({ r.numberOfMatches(), r.activeMatch() }); }; // findText will abort in blink if the view has an empty size. @@ -1104,7 +1104,7 @@ void tst_QWebEnginePage::findTextActiveMatchOrdinal() QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 3); - QCOMPARE(result.activeMatchOrdinal(), i); + QCOMPARE(result.activeMatch(), i); } // The last match is followed by the fist one. @@ -1112,28 +1112,28 @@ void tst_QWebEnginePage::findTextActiveMatchOrdinal() QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 3); - QCOMPARE(result.activeMatchOrdinal(), 1); + QCOMPARE(result.activeMatch(), 1); // The first match is preceded by the last one. m_view->page()->findText("foo", QWebEnginePage::FindBackward); QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 3); - QCOMPARE(result.activeMatchOrdinal(), 3); + QCOMPARE(result.activeMatch(), 3); - // Finding another word resets the activeMatchOrdinal. + // Finding another word resets the activeMatch. m_view->page()->findText("bar", 0); QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 2); - QCOMPARE(result.activeMatchOrdinal(), 1); + QCOMPARE(result.activeMatch(), 1); - // If no match activeMatchOrdinal is 0. + // If no match activeMatch is 0. m_view->page()->findText("bla", 0); QTRY_COMPARE(findTextSpy.count(), 1); result = findTextSpy.takeFirst().value(0).value(); QCOMPARE(result.numberOfMatches(), 0); - QCOMPARE(result.activeMatchOrdinal(), 0); + QCOMPARE(result.activeMatch(), 0); } static QWindow *findNewTopLevelWindow(const QWindowList &oldTopLevelWindows) -- cgit v1.2.3