From 5d41d39b82acb3e2da597df0588fb906e212d608 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 29 Apr 2021 16:14:26 +0200 Subject: Avoid unknownFunc messages in qmltests It was caused by a nested unnamed TestCase, instead rely on the parent testCase being id'ed as testCase. Task-number: QTBUG-74447 Change-Id: I086155e230d0e71ce224a8aa4c669636fe0e0acd Reviewed-by: Kirill Burtsev --- tests/auto/quick/qmltests/data/TestWebEngineView.qml | 1 - tests/auto/quick/qmltests/data/tst_action.qml | 10 ++++++---- tests/auto/quick/qmltests/data/tst_activeFocusOnPress.qml | 1 + tests/auto/quick/qmltests/data/tst_audioMuted.qml | 2 +- tests/auto/quick/qmltests/data/tst_contextMenu.qml | 4 ++-- tests/auto/quick/qmltests/data/tst_findText.qml | 4 ++-- tests/auto/quick/qmltests/data/tst_focusOnNavigation.qml | 1 + tests/auto/quick/qmltests/data/tst_keyboardEvents.qml | 1 + tests/auto/quick/qmltests/data/tst_loadHtml.qml | 1 + tests/auto/quick/qmltests/data/tst_loadUrl.qml | 1 + tests/auto/quick/qmltests/data/tst_navigationRequested.qml | 1 + tests/auto/quick/qmltests/data/tst_newViewRequest.qml | 5 +++-- tests/auto/quick/qmltests/data/tst_settings.qml | 3 ++- .../quick/qmltests/data/tst_unhandledKeyEventPropagation.qml | 1 + 14 files changed, 23 insertions(+), 13 deletions(-) (limited to 'tests/auto/quick/qmltests/data') diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index f2bc09e4b..9033f2441 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -104,7 +104,6 @@ WebEngineView { } TestResult { id: testResult } - TestCase { id: testCase } onLoadingChanged: { loadStatus = loadRequest.status diff --git a/tests/auto/quick/qmltests/data/tst_action.qml b/tests/auto/quick/qmltests/data/tst_action.qml index 852d4145a..91f260e0e 100644 --- a/tests/auto/quick/qmltests/data/tst_action.qml +++ b/tests/auto/quick/qmltests/data/tst_action.qml @@ -41,7 +41,7 @@ TestWebEngineView { } TestCase { - id: actionTests + id: testCase name: "WebEngineAction" when: windowShown @@ -116,8 +116,8 @@ TestWebEngineView { var stopAction = webEngineView.action(WebEngineView.Stop); verify(stopAction); - var triggerSpy = createTemporaryObject(signalSpy, actionTests, {target: selectAction, signalName: "triggered"}); - var stopTriggerSpy = createTemporaryObject(signalSpy, actionTests, {target: stopAction, signalName: "triggered"}); + var triggerSpy = createTemporaryObject(signalSpy, testCase, {target: selectAction, signalName: "triggered"}); + var stopTriggerSpy = createTemporaryObject(signalSpy, testCase, {target: stopAction, signalName: "triggered"}); verify(selectAction.enabled); selectAction.trigger(); @@ -148,7 +148,7 @@ TestWebEngineView { compare(enabledSpy.count, 0); selectAllAction.trigger(); compare(triggerSpy.count, 0); - compare(getTextSelection(), ""); + compare(webEngineView.getTextSelection(), ""); // Focus content by focusing window from JavaScript. Edit actions should be enabled and functional. webView.runJavaScript("window.focus();"); @@ -157,6 +157,7 @@ TestWebEngineView { selectAllAction.trigger(); compare(triggerSpy.count, 1); tryVerify(function() { return webView.getTextSelection() === "foo bar" }); + webView.destroy(); } function test_editActionsWithInitialFocus() { @@ -180,6 +181,7 @@ TestWebEngineView { selectAllAction.trigger(); compare(triggerSpy.count, 1); tryVerify(function() { return webView.getTextSelection() === "foo bar" }); + webView.destroy(); } } } diff --git a/tests/auto/quick/qmltests/data/tst_activeFocusOnPress.qml b/tests/auto/quick/qmltests/data/tst_activeFocusOnPress.qml index c360a1da2..83a2dc8c9 100644 --- a/tests/auto/quick/qmltests/data/tst_activeFocusOnPress.qml +++ b/tests/auto/quick/qmltests/data/tst_activeFocusOnPress.qml @@ -55,6 +55,7 @@ Item { } TestCase { + id: testCase name: "ActiveFocusOnPress" when:windowShown diff --git a/tests/auto/quick/qmltests/data/tst_audioMuted.qml b/tests/auto/quick/qmltests/data/tst_audioMuted.qml index c626d07a0..d0d9e35c3 100644 --- a/tests/auto/quick/qmltests/data/tst_audioMuted.qml +++ b/tests/auto/quick/qmltests/data/tst_audioMuted.qml @@ -42,7 +42,7 @@ TestWebEngineView { } TestCase { - id: test + id: testCase name: "WebEngineViewAudioMuted" function test_audioMuted() { diff --git a/tests/auto/quick/qmltests/data/tst_contextMenu.qml b/tests/auto/quick/qmltests/data/tst_contextMenu.qml index 99450a159..8493ba1c7 100644 --- a/tests/auto/quick/qmltests/data/tst_contextMenu.qml +++ b/tests/auto/quick/qmltests/data/tst_contextMenu.qml @@ -65,12 +65,12 @@ TestWebEngineView { } function destroyContextMenu() { - contextMenuTest.keyPress(Qt.Key_Escape); + testCase.keyPress(Qt.Key_Escape); return getContextMenus().length == 0; } TestCase { - id: contextMenuTest + id: testCase name: "WebEngineViewContextMenu" when: windowShown diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml index c02a1348e..0b4a8d459 100644 --- a/tests/auto/quick/qmltests/data/tst_findText.qml +++ b/tests/auto/quick/qmltests/data/tst_findText.qml @@ -56,7 +56,7 @@ TestWebEngineView { // 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!') + testCase.verify(!findCallbackCalled(), 'Unexpected callback call or uncleared state before findText call!') webEngineView.matchCount = matchCount findFailed = matchCount == 0 @@ -64,7 +64,7 @@ TestWebEngineView { TestCase { - id: testcase + id: testCase name: "WebViewFindText" function getBodyInnerHTML() { diff --git a/tests/auto/quick/qmltests/data/tst_focusOnNavigation.qml b/tests/auto/quick/qmltests/data/tst_focusOnNavigation.qml index 93410a727..b2b7374f6 100644 --- a/tests/auto/quick/qmltests/data/tst_focusOnNavigation.qml +++ b/tests/auto/quick/qmltests/data/tst_focusOnNavigation.qml @@ -65,6 +65,7 @@ Item { } TestCase { + id: testCase name: "WebEngineViewFocusOnNavigation" when: windowShown diff --git a/tests/auto/quick/qmltests/data/tst_keyboardEvents.qml b/tests/auto/quick/qmltests/data/tst_keyboardEvents.qml index 2536f319b..136863c4c 100644 --- a/tests/auto/quick/qmltests/data/tst_keyboardEvents.qml +++ b/tests/auto/quick/qmltests/data/tst_keyboardEvents.qml @@ -36,6 +36,7 @@ TestWebEngineView { height: 480 TestCase { + id: testCase name: "WebEngineViewKeyboardEvents" when: windowShown diff --git a/tests/auto/quick/qmltests/data/tst_loadHtml.qml b/tests/auto/quick/qmltests/data/tst_loadHtml.qml index ed1de41fd..6ed9a4317 100644 --- a/tests/auto/quick/qmltests/data/tst_loadHtml.qml +++ b/tests/auto/quick/qmltests/data/tst_loadHtml.qml @@ -42,6 +42,7 @@ TestWebEngineView { } TestCase { + id: testCase name: "WebEngineViewLoadHtml" when: windowShown diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 8f589cc52..08987e4c3 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -52,6 +52,7 @@ TestWebEngineView { } TestCase { + id: testCase name: "WebEngineViewLoadUrl" when: windowShown diff --git a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml index 96128574e..a24b8f0d4 100644 --- a/tests/auto/quick/qmltests/data/tst_navigationRequested.qml +++ b/tests/auto/quick/qmltests/data/tst_navigationRequested.qml @@ -79,6 +79,7 @@ TestWebEngineView { } TestCase { + id: testCase name: "WebEngineViewNavigationRequested" when: windowShown diff --git a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml index e2b1ce695..891b140e2 100644 --- a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml +++ b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml @@ -77,6 +77,7 @@ TestWebEngineView { } TestCase { + id: testCase name: "NewViewRequest" when: windowShown @@ -157,7 +158,7 @@ TestWebEngineView { " " + ""); verify(webEngineView.waitForLoadSucceeded()); - verifyElementHasFocus("popupButton"); + webEngineView.verifyElementHasFocus("popupButton"); keyPress(Qt.Key_Enter); tryCompare(newViewRequestedSpy, "count", 1); compare(newViewRequest.requestedUrl, url); @@ -175,7 +176,7 @@ TestWebEngineView { compare(loadRequestArray.length, 0); webEngineView.url = Qt.resolvedUrl("test2.html"); verify(webEngineView.waitForLoadSucceeded()); - var center = getElementCenter("link"); + var center = webEngineView.getElementCenter("link"); mouseClick(webEngineView, center.x, center.y, Qt.LeftButton, Qt.ControlModifier); tryCompare(newViewRequestedSpy, "count", 1); compare(newViewRequest.requestedUrl, Qt.resolvedUrl("test1.html")); diff --git a/tests/auto/quick/qmltests/data/tst_settings.qml b/tests/auto/quick/qmltests/data/tst_settings.qml index 2ff4f9c3c..b286a1dae 100644 --- a/tests/auto/quick/qmltests/data/tst_settings.qml +++ b/tests/auto/quick/qmltests/data/tst_settings.qml @@ -36,6 +36,7 @@ TestWebEngineView { height: 300 TestCase { + id: testCase name: "WebEngineViewSettings" function test_javascriptEnabled() { @@ -75,7 +76,7 @@ TestWebEngineView { } function test_settingsAffectCurrentViewOnly() { - var webEngineView2 = Qt.createQmlObject('TestWebEngineView {width: 400; height: 300;}', webEngineView); + var webEngineView2 = Qt.createQmlObject('TestWebEngineView {width: 400; height: 300;}', testCase); webEngineView.settings.javascriptEnabled = true; webEngineView2.settings.javascriptEnabled = true; diff --git a/tests/auto/quick/qmltests/data/tst_unhandledKeyEventPropagation.qml b/tests/auto/quick/qmltests/data/tst_unhandledKeyEventPropagation.qml index 69aa76b77..5e163fc64 100644 --- a/tests/auto/quick/qmltests/data/tst_unhandledKeyEventPropagation.qml +++ b/tests/auto/quick/qmltests/data/tst_unhandledKeyEventPropagation.qml @@ -46,6 +46,7 @@ Item { focus: true } TestCase { + id: testCase name: "WebEngineViewUnhandledKeyEventPropagation" when: false -- cgit v1.2.3