summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qfilesystemmodel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs/qfilesystemmodel')
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 19b1d0e7c8..b27943f071 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -126,6 +126,8 @@ private slots:
void doNotUnwatchOnFailedRmdir();
void specialFiles();
+ void fileInfo();
+
protected:
bool createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount = 0, const QStringList &intial_dirs = QStringList());
@@ -1146,6 +1148,25 @@ void tst_QFileSystemModel::specialFiles()
QTRY_VERIFY(!fileListUnderIndex(&model, rootIndex).contains(testFileName));
}
+void tst_QFileSystemModel::fileInfo()
+{
+ QFileSystemModel model;
+ QModelIndex idx;
+
+ QVERIFY(model.fileInfo(idx).filePath().isEmpty());
+
+ const QString dirPath = flatDirTestPath;
+ QDir dir(dirPath);
+ const QString subdir = QStringLiteral("subdir");
+ QVERIFY(dir.mkdir(subdir));
+ const QString subdirPath = dir.absoluteFilePath(subdir);
+
+ idx = model.setRootPath(subdirPath);
+ QCOMPARE(model.fileInfo(idx), QFileInfo(subdirPath));
+ idx = model.setRootPath(dirPath);
+ QCOMPARE(model.fileInfo(idx), QFileInfo(dirPath));
+}
+
QTEST_MAIN(tst_QFileSystemModel)
#include "tst_qfilesystemmodel.moc"