summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests/mock-delegates
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qmltests/mock-delegates')
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/AlertDialog.qml5
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/ConfirmDialog.qml24
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/DirectoryPicker.qml18
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/FilePicker.qml24
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/Menu.qml18
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/MenuItem.qml8
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/PromptDialog.qml27
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml13
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml12
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/MenuParams.qml9
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir5
11 files changed, 163 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/AlertDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/AlertDialog.qml
new file mode 100644
index 000000000..7d7efda0c
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/AlertDialog.qml
@@ -0,0 +1,5 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+// Both dialogs are basically expected to behave in the same way from an API point of view
+ConfirmDialog { }
diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/ConfirmDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/ConfirmDialog.qml
new file mode 100644
index 000000000..6125d0b98
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/ConfirmDialog.qml
@@ -0,0 +1,24 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import QtQml
+import QtTest
+import "../../TestParams"
+
+QtObject {
+ property string text
+ property string title
+ signal accepted()
+ signal rejected()
+
+ function open() {
+ JSDialogParams.dialogTitle = title;
+ JSDialogParams.dialogMessage = text;
+ JSDialogParams.dialogCount++;
+ if (JSDialogParams.shouldAcceptDialog)
+ accepted();
+ else
+ rejected();
+ }
+}
+
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/QtWebEngine/ControlsDelegates/FilePicker.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/FilePicker.qml
new file mode 100644
index 000000000..247088bcb
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/FilePicker.qml
@@ -0,0 +1,24 @@
+// Copyright (C) 2021 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 {
+ 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/ControlsDelegates/Menu.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/Menu.qml
new file mode 100644
index 000000000..cd7ed4821
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/Menu.qml
@@ -0,0 +1,18 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQml
+import "../../TestParams"
+
+QtObject {
+ id: menu
+ property string linkText: ""
+ property var mediaType: null
+ property string selectedText: ""
+
+ signal done()
+
+ function open() {
+ MenuParams.isMenuOpened = true;
+ }
+}
diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/MenuItem.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/MenuItem.qml
new file mode 100644
index 000000000..67dab1bba
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/MenuItem.qml
@@ -0,0 +1,8 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQml
+
+QtObject {
+ signal triggered()
+}
diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/PromptDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/PromptDialog.qml
new file mode 100644
index 000000000..81a63d918
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/ControlsDelegates/PromptDialog.qml
@@ -0,0 +1,27 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-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()
+
+ function open() {
+ JSDialogParams.dialogTitle = title;
+ JSDialogParams.dialogMessage = text;
+ JSDialogParams.dialogCount++;
+ if (JSDialogParams.shouldAcceptDialog) {
+ input(JSDialogParams.inputForPrompt)
+ accepted();
+ } else {
+ rejected();
+ }
+ }
+}
diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml b/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml
new file mode 100644
index 000000000..67d67dc40
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/TestParams/FilePickerParams.qml
@@ -0,0 +1,13 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+pragma Singleton
+import QtQuick
+
+QtObject {
+ property var selectedFilesUrl: [];
+ property bool selectFiles: false;
+ property bool filePickerOpened: false;
+ property bool directoryPickerOpened: false;
+ property var nameFilters: [];
+}
diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml b/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml
new file mode 100644
index 000000000..1033b509e
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/TestParams/JSDialogParams.qml
@@ -0,0 +1,12 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+pragma Singleton
+import QtQml
+
+QtObject {
+ property string dialogMessage: "";
+ property string dialogTitle: "";
+ property bool shouldAcceptDialog: true;
+ property string inputForPrompt;
+ property int dialogCount: 0
+}
diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/MenuParams.qml b/tests/auto/quick/qmltests/mock-delegates/TestParams/MenuParams.qml
new file mode 100644
index 000000000..d8a01764c
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/TestParams/MenuParams.qml
@@ -0,0 +1,9 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+pragma Singleton
+import QtQml
+
+QtObject {
+ property bool isMenuOpened: false;
+}
diff --git a/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir b/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir
new file mode 100644
index 000000000..2702ad30f
--- /dev/null
+++ b/tests/auto/quick/qmltests/mock-delegates/TestParams/qmldir
@@ -0,0 +1,5 @@
+# QML module so that the autotests can set testing parameters
+module TestParams
+singleton FilePickerParams 1.0 FilePickerParams.qml
+singleton JSDialogParams 1.0 JSDialogParams.qml
+singleton MenuParams 1.0 MenuParams.qml