diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-29 16:14:26 +0200 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-05-07 18:14:43 +0200 |
commit | 5d41d39b82acb3e2da597df0588fb906e212d608 (patch) | |
tree | 9794fb42f6c54e8dfa94e6631ea1b9edbc137c08 /tests | |
parent | 7e5e92c329597953b9e9a5b84d68e211bf2f2b65 (diff) |
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 <kirill.burtsev@qt.io>
Diffstat (limited to 'tests')
21 files changed, 36 insertions, 22 deletions
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 { " <button id='popupButton' onclick='popup()'>Pop Up!</button>" + "</body></html>"); 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 diff --git a/tests/auto/quick/qmltests2/data/tst_favicon.qml b/tests/auto/quick/qmltests2/data/tst_favicon.qml index 3f522d91a..ea5d20f17 100644 --- a/tests/auto/quick/qmltests2/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests2/data/tst_favicon.qml @@ -59,16 +59,16 @@ TestWebEngineView { function getFaviconPixel(faviconImage) { var grabImage = Qt.createQmlObject(" import QtQuick 2.5\n - Image { }", test) + Image { }", testCase) var faviconCanvas = Qt.createQmlObject(" import QtQuick 2.5\n - Canvas { }", test) + Canvas { }", testCase) - test.tryVerify(function() { return faviconImage.status == Image.Ready }); + testCase.tryVerify(function() { return faviconImage.status == Image.Ready }); faviconImage.grabToImage(function(result) { grabImage.source = result.url }); - test.tryVerify(function() { return grabImage.status == Image.Ready }); + testCase.tryVerify(function() { return grabImage.status == Image.Ready }); faviconCanvas.width = faviconImage.width; faviconCanvas.height = faviconImage.height; @@ -97,7 +97,7 @@ TestWebEngineView { } TestCase { - id: test + id: testCase name: "WebEngineFavicon" when: windowShown @@ -315,7 +315,7 @@ TestWebEngineView { function test_faviconProvider(row) { var faviconImage = Qt.createQmlObject(" import QtQuick 2.5\n - Image { sourceSize: Qt.size(width, height) }", test) + Image { sourceSize: Qt.size(width, height) }", testCase) compare(iconChangedSpy.count, 0) @@ -338,7 +338,7 @@ TestWebEngineView { function test_dynamicFavicon() { var faviconImage = Qt.createQmlObject(" import QtQuick 2.5\n - Image { width: 16; height: 16; sourceSize: Qt.size(width, height); }", test) + Image { width: 16; height: 16; sourceSize: Qt.size(width, height); }", testCase) faviconImage.source = Qt.binding(function() { return webEngineView.icon; }); var colors = [ diff --git a/tests/auto/quick/qmltests2/data/tst_faviconDownload.qml b/tests/auto/quick/qmltests2/data/tst_faviconDownload.qml index 9aa32279c..7d9c39814 100644 --- a/tests/auto/quick/qmltests2/data/tst_faviconDownload.qml +++ b/tests/auto/quick/qmltests2/data/tst_faviconDownload.qml @@ -47,7 +47,7 @@ TestWebEngineView { } TestCase { - id: test + id: testCase name: "WebEngineFaviconDownload" function init() { diff --git a/tests/auto/quick/qmltests2/data/tst_filePicker.qml b/tests/auto/quick/qmltests2/data/tst_filePicker.qml index ab30d9e82..4313c8d9e 100644 --- a/tests/auto/quick/qmltests2/data/tst_filePicker.qml +++ b/tests/auto/quick/qmltests2/data/tst_filePicker.qml @@ -58,6 +58,7 @@ TestWebEngineView { onTitleChanged: { titleChanges.push(webEngineView.title) } TestCase { + id: testCase name: "WebEngineViewSingleFileUpload" when: windowShown diff --git a/tests/auto/quick/qmltests2/data/tst_inputMethod.qml b/tests/auto/quick/qmltests2/data/tst_inputMethod.qml index 0bf9f7eb0..00f85cb71 100644 --- a/tests/auto/quick/qmltests2/data/tst_inputMethod.qml +++ b/tests/auto/quick/qmltests2/data/tst_inputMethod.qml @@ -40,6 +40,7 @@ TestWebEngineView { testSupport: WebEngineTestSupport { } TestCase { + id: testCase name: "WebEngineViewInputMethod" when: windowShown diff --git a/tests/auto/quick/qmltests2/data/tst_mouseClick.qml b/tests/auto/quick/qmltests2/data/tst_mouseClick.qml index eaa012f86..6c314d44c 100644 --- a/tests/auto/quick/qmltests2/data/tst_mouseClick.qml +++ b/tests/auto/quick/qmltests2/data/tst_mouseClick.qml @@ -65,6 +65,7 @@ TestWebEngineView { TestCase { + id: testCase name: "WebEngineViewMouseClick" when: windowShown diff --git a/tests/auto/quick/qmltests2/data/tst_viewSoure.qml b/tests/auto/quick/qmltests2/data/tst_viewSoure.qml index 74b7f803d..28f7e8344 100644 --- a/tests/auto/quick/qmltests2/data/tst_viewSoure.qml +++ b/tests/auto/quick/qmltests2/data/tst_viewSoure.qml @@ -78,7 +78,7 @@ TestWebEngineView { } TestCase { - id: test + id: testCase name: "WebEngineViewSource" function init() { diff --git a/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml b/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml index 50e88ef60..48ba601ac 100644 --- a/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml +++ b/tests/auto/quick/qmltests_ssl/data/tst_certificateError.qml @@ -45,6 +45,7 @@ TestWebEngineView { } TestCase { + id: testCase name: 'CertificateError' when: windowShown |