summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2022-12-20 16:12:22 +0100
committerSzabolcs David <davidsz@inf.u-szeged.hu>2023-01-15 21:33:52 +0100
commit35d4b0b1d1c723e32d589b3dfddfe96eaa8e5568 (patch)
treecbcb4c9e17b4048a6f0da7c0e64d66e4028e588c /tests/auto
parent5734c78ba87b8a6e1070e6a65777b5def0da581d (diff)
Quick: Fix file selection modes in the default UI delegate
Our implementation of QML file picker was outdated. Now directory picker is a separate type of dialog and other file selection modes are set in FileDialog.fileMode property. Pick-to: 6.4 6.5 Change-Id: Icc62369539c56666e596e5ee6f1b3068a43acd81 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/qmltests/data/tst_filePicker.qml2
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/DirectoryPicker.qml18
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml1
3 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_filePicker.qml b/tests/auto/quick/qmltests/data/tst_filePicker.qml
index 2404efd2d..a557369ed 100644
--- a/tests/auto/quick/qmltests/data/tst_filePicker.qml
+++ b/tests/auto/quick/qmltests/data/tst_filePicker.qml
@@ -146,7 +146,7 @@ TestWebEngineView {
FilePickerParams.selectedFilesUrl.push(Qt.resolvedUrl("../data"))
keyClick(Qt.Key_Enter) // Focus is on the button. Open FileDialog.
- tryCompare(FilePickerParams, "filePickerOpened", true)
+ tryCompare(FilePickerParams, "directoryPickerOpened", true)
// Check that the title is a file list (eg. "test1.html,test2.html")
tryVerify(function() { return webEngineView.title.match("^([^,]+,)+[^,]+$"); })
diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/DirectoryPicker.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/DirectoryPicker.qml
new file mode 100644
index 000000000..71da28843
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/DirectoryPicker.qml
@@ -0,0 +1,18 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import QtQuick
+import "../../TestParams"
+
+QtObject {
+ signal folderSelected(var folder)
+ signal rejected()
+
+ function open() {
+ FilePickerParams.directoryPickerOpened = true;
+ if (FilePickerParams.selectFiles)
+ folderSelected(FilePickerParams.selectedFilesUrl);
+ else
+ rejected();
+ }
+}
diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml b/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml
index 4a1ffeb02..67d67dc40 100644
--- a/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml
+++ b/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml
@@ -8,5 +8,6 @@ QtObject {
property var selectedFilesUrl: [];
property bool selectFiles: false;
property bool filePickerOpened: false;
+ property bool directoryPickerOpened: false;
property var nameFilters: [];
}