summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 61a2abc084..9cb391d5f4 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -212,7 +212,14 @@ void tst_QFileSystemModel::rootPath()
QString oldRootPath = model->rootPath();
const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
QVERIFY(!documentPaths.isEmpty());
- const QString documentPath = documentPaths.front();
+ QString documentPath = documentPaths.front();
+ // In particular on Linux, ~/Documents (the first
+ // DocumentsLocation) may not exist, so choose ~ in that case:
+ if (!QFile::exists(documentPath)) {
+ documentPath = QDir::homePath();
+ qWarning("%s: first documentPath \"%s\" does not exist. Using ~ (\"%s\") instead.",
+ Q_FUNC_INFO, qPrintable(documentPaths.front()), qPrintable(documentPath));
+ }
root = model->setRootPath(documentPath);
QTRY_VERIFY(model->rowCount(root) >= 0);