Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 97eb1dc9 authored by Laurent Montel's avatar Laurent Montel 😁

Test that temp dir is deleted

parent 54b2d2b4
......@@ -88,6 +88,7 @@ void AttachmentTemporaryFilesDirsTest::shouldForceRemoveTemporaryDirs()
QCOMPARE(attachmentDir.temporaryDirs().count(), 2);
attachmentDir.forceCleanTempFiles();
QCOMPARE(attachmentDir.temporaryDirs().count(), 0);
QCOMPARE(attachmentDir.temporaryFiles().count(), 0);
}
void AttachmentTemporaryFilesDirsTest::shouldForceRemoveTemporaryFiles()
......@@ -98,6 +99,7 @@ void AttachmentTemporaryFilesDirsTest::shouldForceRemoveTemporaryFiles()
QCOMPARE(attachmentDir.temporaryFiles().count(), 2);
attachmentDir.forceCleanTempFiles();
QCOMPARE(attachmentDir.temporaryFiles().count(), 0);
QCOMPARE(attachmentDir.temporaryDirs().count(), 0);
}
void AttachmentTemporaryFilesDirsTest::shouldCreateDeleteTemporaryFiles()
......@@ -109,14 +111,19 @@ void AttachmentTemporaryFilesDirsTest::shouldCreateDeleteTemporaryFiles()
kDebug()<<"Can open file";
return;
}
tmpDir.setAutoRemove(false);
file.close();
QVERIFY(file.exists());
AttachmentTemporaryFilesDirs attachmentDir;
attachmentDir.addTempDir(tmpDir.name());
attachmentDir.addTempFile(file.fileName());
QVERIFY(!attachmentDir.temporaryFiles().isEmpty());
QCOMPARE(attachmentDir.temporaryFiles().first(), file.fileName());
const QString path = tmpDir.name();
attachmentDir.forceCleanTempFiles();
QCOMPARE(attachmentDir.temporaryFiles().count(), 0);
QCOMPARE(attachmentDir.temporaryDirs().count(), 0);
QVERIFY(!QDir(path).exists());
}
QTEST_KDEMAIN(AttachmentTemporaryFilesDirsTest, NoGUI)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment