From 163e262888f8d44d1c4405b420a6a58cb622aca8 Mon Sep 17 00:00:00 2001 From: Balazs Egedi Date: Mon, 10 May 2021 22:14:54 +0200 Subject: Add mock FilePicker UIDelegates for Quick Controls 2 FilePicker is added to Controls2Delegates. filePicker auto test now works with Quick Controls 2. Task-number: QTBUG-93666 Change-Id: I6b5aca6a479603f5258bf49df6caeb024fed17c4 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/CMakeLists.txt | 2 +- .../QtWebEngine/Controls1Delegates/FilePicker.qml | 49 ---------------------- .../QtWebEngine/Controls2Delegates/FilePicker.qml | 49 ++++++++++++++++++++++ tests/auto/quick/qmltests/qmltests.pro | 2 +- 4 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml create mode 100644 tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/FilePicker.qml (limited to 'tests/auto/quick/qmltests') diff --git a/tests/auto/quick/qmltests/CMakeLists.txt b/tests/auto/quick/qmltests/CMakeLists.txt index 1c77e1a05..fd756e6b9 100644 --- a/tests/auto/quick/qmltests/CMakeLists.txt +++ b/tests/auto/quick/qmltests/CMakeLists.txt @@ -17,6 +17,7 @@ set(testList tst_audioMuted.qml tst_desktopBehaviorLoadHtml.qml tst_favicon.qml + tst_filePicker.qml tst_findText.qml tst_focusOnNavigation.qml tst_fullScreenRequest.qml @@ -67,7 +68,6 @@ if(TARGET Qt::QuickControls) #FIXME list(APPEND testList tst_contextMenu.qml tst_download.qml - tst_filePicker.qml ) else() message("\n!!!! QuickControls target is missing, some tests are not executed !!! FIXME \n") diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml deleted file mode 100644 index 745f533f5..000000000 --- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 -import "../../TestParams" 1.0 - -QtObject { - property bool selectMultiple: false; - property bool selectExisting: false; - property bool selectFolder: false; - property var nameFilters: []; - - signal filesSelected(var fileList); - signal rejected(); - - function open() { - FilePickerParams.filePickerOpened = true; - FilePickerParams.nameFilters = nameFilters; - if (FilePickerParams.selectFiles) - filesSelected(FilePickerParams.selectedFilesUrl) - else - rejected() - } -} diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/FilePicker.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/FilePicker.qml new file mode 100644 index 000000000..0ba92f5ce --- /dev/null +++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls2Delegates/FilePicker.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import "../../TestParams" + +QtObject { + property bool selectMultiple: false + property bool selectExisting: false + property bool selectFolder: false + property var nameFilters: [] + + signal filesSelected(var fileList) + signal rejected() + + function open() { + FilePickerParams.filePickerOpened = true; + FilePickerParams.nameFilters = nameFilters; + if (FilePickerParams.selectFiles) + filesSelected(FilePickerParams.selectedFilesUrl); + else + rejected(); + } +} diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 6ab2977cb..513af0f3d 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -134,7 +134,6 @@ OTHER_FILES += \ $$PWD/data/icons/qt32.ico \ $$PWD/data/icons/qtmulti.ico \ $$PWD/data/icons/small-favicon.png \ - $$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/qmldir \ @@ -143,6 +142,7 @@ OTHER_FILES += \ $$PWD/mock-delegates/TestParams/qmldir \ $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/AlertDialog.qml \ $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/ConfirmDialog.qml \ + $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/FilePicker.qml \ $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/PromptDialog.qml \ $$PWD/mock-delegates/QtWebEngine/Controls2Delegates/qmldir -- cgit v1.2.3