From 4a6f45d645b011ac083581f965ce7951771a1f98 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 17 Dec 2015 13:11:28 +0100 Subject: Fixed maildirresourcetest --- tests/maildirresourcetest.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index bef94ba..d279a36 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp @@ -18,8 +18,10 @@ static bool copyRecursively(const QString &srcFilePath, if (srcFileInfo.isDir()) { QDir targetDir(tgtFilePath); targetDir.cdUp(); - if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) + if (!targetDir.mkdir(QFileInfo(srcFilePath).fileName())) { + qWarning() << "Failed to create directory " << tgtFilePath; return false; + } QDir sourceDir(srcFilePath); QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); foreach (const QString &fileName, fileNames) { @@ -31,8 +33,10 @@ static bool copyRecursively(const QString &srcFilePath, return false; } } else { - if (!QFile::copy(srcFilePath, tgtFilePath)) + if (!QFile::copy(srcFilePath, tgtFilePath)) { + qWarning() << "Failed to copy file " << tgtFilePath; return false; + } } return true; } @@ -45,13 +49,13 @@ static bool copyRecursively(const QString &srcFilePath, class MaildirResourceTest : public QObject { Q_OBJECT + + QTemporaryDir tempDir; private Q_SLOTS: void initTestCase() { - auto targetPath = QDir::tempPath() + QDir::separator() + "maildirresourcetest" + QDir::separator() + "maildir1"; - QDir dir(targetPath); - dir.removeRecursively(); - + QVERIFY(tempDir.isValid()); + auto targetPath = tempDir.path() + QDir::separator() + "maildir1/"; copyRecursively(TESTDATAPATH "/maildir1", targetPath); Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); -- cgit v1.2.3