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.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 0b9fb5c168..61a2abc084 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -115,6 +115,7 @@ private slots:
void sort();
void mkdir();
+ void deleteFile();
void caseSensitivity();
@@ -927,6 +928,25 @@ void tst_QFileSystemModel::mkdir()
QCOMPARE(oldRow, idx.row());
}
+void tst_QFileSystemModel::deleteFile()
+{
+ QString newFilePath = QDir::temp().filePath("NewFileDeleteTest");
+ QFile newFile(newFilePath);
+ if (newFile.exists()) {
+ if (!newFile.remove())
+ qWarning() << "unable to remove" << newFilePath;
+ QTest::qWait(WAITTIME);
+ }
+ if (!newFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ qWarning() << "unable to create" << newFilePath;
+ }
+ newFile.close();
+ QModelIndex idx = model->index(newFilePath);
+ QVERIFY(idx.isValid());
+ QVERIFY(model->remove(idx));
+ QVERIFY(!newFile.exists());
+}
+
void tst_QFileSystemModel::caseSensitivity()
{
QString tmp = flatDirTestPath;