aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickdialogs
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-06-17 18:27:13 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-06-21 10:25:03 +0200
commit321c4c8f3183e2260feb56d13d62e4592883775c (patch)
treeb653966742a3a5ff171e75c5e9c653155aa4c832 /tests/auto/quickdialogs
parentc724ae207ab019f91009bc4c57864c6625f8d8a3 (diff)
tst_QQuickFileDialogImpl: check that closing the dialog rejects
It doesn't. Task-number: QTBUG-101973 Pick-to: 6.4 6.3 6.2 Change-Id: I63a76f9919a4b9a1ebc3b2f95189b518e9c6858b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quickdialogs')
-rw-r--r--tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp
index b4224ab746..33c233142a 100644
--- a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp
+++ b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp
@@ -61,6 +61,7 @@ private slots:
void chooseFolderViaEnter();
void chooseFileAndThenFolderViaTextEdit();
void cancelDialogWhileTextEditHasFocus();
+ void closingDialogCancels();
void goUp();
void goUpWhileTextEditHasFocus();
void goIntoLargeFolder();
@@ -618,6 +619,33 @@ void tst_QQuickFileDialogImpl::cancelDialogWhileTextEditHasFocus()
QVERIFY(!breadcrumbBar->textField()->isVisible());
}
+void tst_QQuickFileDialogImpl::closingDialogCancels()
+{
+ // Open the dialog.
+ DialogTestHelper<QQuickFileDialog, QQuickFileDialogImpl> dialogHelper(this, "fileDialog.qml");
+ OPEN_QUICK_DIALOG();
+
+ QSignalSpy accepted(dialogHelper.dialog, &QQuickAbstractDialog::accepted);
+ QSignalSpy rejected(dialogHelper.dialog, &QQuickAbstractDialog::rejected);
+
+ // Accept the dialog.
+ QVERIFY(QMetaObject::invokeMethod(dialogHelper.window(), "doneAccepted"));
+ QVERIFY(!dialogHelper.dialog->isVisible());
+ QTRY_VERIFY(!dialogHelper.quickDialog->isVisible());
+ QCOMPARE(accepted.size(), 1);
+ QCOMPARE(rejected.size(), 0);
+
+ // Re-open the dialog.
+ accepted.clear();
+ OPEN_QUICK_DIALOG();
+
+ // Close the dialog.
+ CLOSE_QUICK_DIALOG();
+ QCOMPARE(accepted.size(), 0);
+ QEXPECT_FAIL("", "QTBUG-101973", Continue);
+ QCOMPARE(rejected.size(), 1);
+}
+
void tst_QQuickFileDialogImpl::goUp()
{
// Open the dialog. Start off in "sub-dir".