diff options
Diffstat (limited to 'tests/maildirresourcetest.cpp')
-rw-r--r-- | tests/maildirresourcetest.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
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, | |||
18 | if (srcFileInfo.isDir()) { | 18 | if (srcFileInfo.isDir()) { |
19 | QDir targetDir(tgtFilePath); | 19 | QDir targetDir(tgtFilePath); |
20 | targetDir.cdUp(); | 20 | targetDir.cdUp(); |
21 | if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) | 21 | if (!targetDir.mkdir(QFileInfo(srcFilePath).fileName())) { |
22 | qWarning() << "Failed to create directory " << tgtFilePath; | ||
22 | return false; | 23 | return false; |
24 | } | ||
23 | QDir sourceDir(srcFilePath); | 25 | QDir sourceDir(srcFilePath); |
24 | QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); | 26 | QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); |
25 | foreach (const QString &fileName, fileNames) { | 27 | foreach (const QString &fileName, fileNames) { |
@@ -31,8 +33,10 @@ static bool copyRecursively(const QString &srcFilePath, | |||
31 | return false; | 33 | return false; |
32 | } | 34 | } |
33 | } else { | 35 | } else { |
34 | if (!QFile::copy(srcFilePath, tgtFilePath)) | 36 | if (!QFile::copy(srcFilePath, tgtFilePath)) { |
37 | qWarning() << "Failed to copy file " << tgtFilePath; | ||
35 | return false; | 38 | return false; |
39 | } | ||
36 | } | 40 | } |
37 | return true; | 41 | return true; |
38 | } | 42 | } |
@@ -45,13 +49,13 @@ static bool copyRecursively(const QString &srcFilePath, | |||
45 | class MaildirResourceTest : public QObject | 49 | class MaildirResourceTest : public QObject |
46 | { | 50 | { |
47 | Q_OBJECT | 51 | Q_OBJECT |
52 | |||
53 | QTemporaryDir tempDir; | ||
48 | private Q_SLOTS: | 54 | private Q_SLOTS: |
49 | void initTestCase() | 55 | void initTestCase() |
50 | { | 56 | { |
51 | auto targetPath = QDir::tempPath() + QDir::separator() + "maildirresourcetest" + QDir::separator() + "maildir1"; | 57 | QVERIFY(tempDir.isValid()); |
52 | QDir dir(targetPath); | 58 | auto targetPath = tempDir.path() + QDir::separator() + "maildir1/"; |
53 | dir.removeRecursively(); | ||
54 | |||
55 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); | 59 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); |
56 | 60 | ||
57 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 61 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); |