aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickdialogs
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2022-07-08 17:14:26 +0800
committerMitch Curtis <mitch.curtis@qt.io>2022-07-11 10:36:45 +0800
commit989e05a0b8240778c9f249edea5c9d27d68f8e0f (patch)
tree17eb909ca7243fbc13f5bb4acd2697c9e9b922cc /tests/auto/quickdialogs
parentb9cae6a90ff547eb7c875bc39121f0657911369d (diff)
Stabilise changeFolderViaDoubleClick and chooseFolderViaEnter
These were failing on Ubuntu 20.04 due to the ListView delegates not being up-to-date. The only reliable solution is to repeatedly check until they are. Task-number: QTBUG-101488 Pick-to: 6.4 6.3 6.2 Change-Id: I437bb1b4bf9ab35ad23b1da1a89e9f77872a2f48 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'tests/auto/quickdialogs')
-rw-r--r--tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp
index 93ca308338..60a11cf289 100644
--- a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp
+++ b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp
@@ -502,6 +502,11 @@ void tst_QQuickFileDialogImpl::changeFolderViaDoubleClick()
QTRY_VERIFY(findViewDelegateItem(dialogHelper.fileDialogListView, subDirIndex, subDirDelegate));
COMPARE_URL(subDirDelegate->file(), QUrl::fromLocalFile(tempSubDir.path()));
QVERIFY(doubleClickButton(subDirDelegate));
+ const QStringList expectedVisibleFiles = showDirsFirst
+ ? QStringList { tempSubSubDir.path(), tempSubFile1->fileName(), tempSubFile2->fileName() }
+ : QStringList { tempSubFile1->fileName(), tempSubFile2->fileName(), tempSubSubDir.path() };
+ QString failureMessage;
+ QTRY_VERIFY2(verifyFileDialogDelegates(dialogHelper.fileDialogListView, expectedVisibleFiles, failureMessage), qPrintable(failureMessage));
// The first file in the directory should now be selected.
const QUrl firstFileUrl = showDirsFirst ? QUrl::fromLocalFile(tempSubSubDir.path()) : QUrl::fromLocalFile(tempSubFile1->fileName());
VERIFY_FILE_SELECTED_AND_FOCUSED(QUrl::fromLocalFile(tempSubDir.path()), firstFileUrl, 0);
@@ -558,6 +563,9 @@ void tst_QQuickFileDialogImpl::chooseFolderViaEnter()
// Select the delegate by pressing enter.
QTest::keyClick(dialogHelper.window(), Qt::Key_Return);
+ const QStringList expectedVisibleFiles = { tempSubSubDir.path(), tempSubFile1->fileName(), tempSubFile2->fileName() };
+ QString failureMessage;
+ QTRY_VERIFY2(verifyFileDialogDelegates(dialogHelper.fileDialogListView, expectedVisibleFiles, failureMessage), qPrintable(failureMessage));
// The first file in the new directory should be selected, which is "sub-sub-dir".
VERIFY_FILE_SELECTED_AND_FOCUSED(QUrl::fromLocalFile(tempSubDir.path()), QUrl::fromLocalFile(tempSubSubDir.path()), 0);
// Since we only chose a folder, the dialog should still be open.