diff options
author | Balazs Egedi <egedib@inf.u-szeged.hu> | 2021-05-06 16:19:59 +0200 |
---|---|---|
committer | Balazs Egedi <egedib@inf.u-szeged.hu> | 2021-06-04 01:54:46 +0200 |
commit | 4d67b9f639114ddec0521980495ba27921800e39 (patch) | |
tree | 6f2917d370b96e5b8f4450657fafdca26380e3ab /tests | |
parent | 74de8c765b3205a02cc9e2228f9d8a98bb0bbdaf (diff) |
Add mock UIDelegates for Quick Controls 2
{Alert, Confirm, Prompt}Dialogs are added to Controls2Delegates.
javaScriptDialogs auto test now works with Quick Controls 2.
Task-number: QTBUG-93666
Change-Id: I193b6ec3617db8b44a9dfc5534d99bdf8b20a78e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qmltests/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir | 6 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/AlertDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml) | 6 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/ConfirmDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml) | 20 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/PromptDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml) | 24 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/qmldir | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/qmltests.pro | 11 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/tst_qmltests.cpp | 3 |
8 files changed, 36 insertions, 41 deletions
diff --git a/tests/auto/quick/qmltests/CMakeLists.txt b/tests/auto/quick/qmltests/CMakeLists.txt index ebcf0434c..b5898cc2a 100644 --- a/tests/auto/quick/qmltests/CMakeLists.txt +++ b/tests/auto/quick/qmltests/CMakeLists.txt @@ -56,16 +56,12 @@ if(QT_FEATURE_webengine_testsupport) tst_favicon.qml tst_faviconDownload.qml tst_inputMethod.qml + tst_javaScriptDialogs.qml tst_linkHovered.qml tst_loadFail.qml tst_mouseClick.qml tst_viewSoure.qml ) -# if(TARGET Qt::QuickControls) #FIXME - list(APPEND testList tst_javaScriptDialogs.qml) -# else() -# message("\n!!! QuickControls target is missing, some tests are not executed !!! FIXME \n") -# endif() endif() if(TARGET Qt::QuickControls) #FIXME diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir index cf8ac0512..f0d8f33b7 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir @@ -1,5 +1 @@ -module QtWebEngine.UIDelegates -AlertDialog 1.0 AlertDialog.qml -ConfirmDialog 1.0 ConfirmDialog.qml -FilePicker 1.0 FilePicker.qml -PromptDialog 1.0 PromptDialog.qml +module QtWebEngine.Controls1Delegates diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/AlertDialog.qml index 4ba3be4b9..252678754 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/AlertDialog.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -27,6 +27,4 @@ ****************************************************************************/ // Both dialogs are basically expected to behave in the same way from an API point of view -ConfirmDialog -{ -} +ConfirmDialog { } diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/ConfirmDialog.qml index 9933fc2f7..c4d3dd183 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/ConfirmDialog.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -26,24 +26,24 @@ ** ****************************************************************************/ -import QtQml 2.0 -import QtTest 1.0 -import "../../TestParams" 1.0 +import QtQml +import QtTest +import "../../TestParams" QtObject { - property string text; - property string title; - signal accepted(); - signal rejected(); + property string text + property string title + signal accepted() + signal rejected() function open() { JSDialogParams.dialogTitle = title; JSDialogParams.dialogMessage = text; JSDialogParams.dialogCount++; if (JSDialogParams.shouldAcceptDialog) - accepted() + accepted(); else - rejected() + rejected(); } } diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/PromptDialog.qml index 7c5b16eab..800481797 100644 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/PromptDialog.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -26,17 +26,17 @@ ** ****************************************************************************/ -import QtQml 2.0 -import QtTest 1.0 -import "../../TestParams" 1.0 +import QtQml +import QtTest +import "../../TestParams" QtObject { - property string text; - property string title; - signal accepted(); - signal rejected(); - signal input(string text); - signal closing(); + property string text + property string title + signal accepted() + signal rejected() + signal input(string text) + signal closing() function open() { JSDialogParams.dialogTitle = title; @@ -44,9 +44,9 @@ QtObject { JSDialogParams.dialogCount++; if (JSDialogParams.shouldAcceptDialog) { input(JSDialogParams.inputForPrompt) - accepted() + accepted(); } else { - rejected() + rejected(); } } } diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/qmldir b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/qmldir new file mode 100644 index 000000000..5542aba58 --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/qmldir @@ -0,0 +1 @@ +module QtWebEngine.Controls2Delegates diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index e5e84d3c7..6ab2977cb 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -55,11 +55,11 @@ qtConfig(webenginequick-testsupport) { $$PWD/data/tst_favicon.qml \ $$PWD/data/tst_faviconDownload.qml \ $$PWD/data/tst_inputMethod.qml \ + $$PWD/data/tst_javaScriptDialogs.qml \ $$PWD/data/tst_linkHovered.qml \ $$PWD/data/tst_loadFail.qml \ $$PWD/data/tst_mouseClick.qml \ $$PWD/data/tst_viewSoure.qml - qtHaveModule(quickcontrols): QML_TESTS += $$PWD/data/tst_javaScriptDialogs.qml } else { PLUGIN_EXTENSION = .so PLUGIN_PREFIX = lib @@ -134,16 +134,17 @@ OTHER_FILES += \ $$PWD/data/icons/qt32.ico \ $$PWD/data/icons/qtmulti.ico \ $$PWD/data/icons/small-favicon.png \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml \ $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml \ $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/Menu.qml \ $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/MenuItem.qml \ - $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml \ $$PWD/mock-delegates/QtWebEngine/Controls1Delegates/qmldir \ $$PWD/mock-delegates/TestParams/FilePickerParams.qml \ $$PWD/mock-delegates/TestParams/JSDialogParams.qml \ - $$PWD/mock-delegates/TestParams/qmldir + $$PWD/mock-delegates/TestParams/qmldir \ + $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/AlertDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/ConfirmDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/PromptDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/qmldir OTHER_FILES += $$QML_TESTS diff --git a/tests/auto/quick/qmltests/tst_qmltests.cpp b/tests/auto/quick/qmltests/tst_qmltests.cpp index 9bb45cdd7..d9be0a773 100644 --- a/tests/auto/quick/qmltests/tst_qmltests.cpp +++ b/tests/auto/quick/qmltests/tst_qmltests.cpp @@ -128,6 +128,9 @@ int main(int argc, char **argv) sigaction(SIGSEGV, &sigAction, 0); #endif + qputenv("QML2_IMPORT_PATH", QString(QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() + "/mock-delegates").toUtf8()); + // TODO: temporary solution. Remove when Quick Controls 1 is removed. + qputenv("QTWEBENGINE_DIALOG_SET", QByteArray("QtQuickControls2")); QScopedPointer<Application> app; // Force to use English language for testing due to error message checks |