diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-31 11:24:59 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-31 11:24:59 +0200 |
commit | f90ca753a4b723dbf72996bbd1261dc786c7cce6 (patch) | |
tree | 13916b2f69e728af3883e63e23f71a464ef3573b /tests/mailsynctest.h | |
parent | 08c368700c57fc1214aab34a24c921756b3200f0 (diff) | |
download | sink-f90ca753a4b723dbf72996bbd1261dc786c7cce6.tar.gz sink-f90ca753a4b723dbf72996bbd1261dc786c7cce6.zip |
Replace the imapresourcetest with the generic mailsynctest
Diffstat (limited to 'tests/mailsynctest.h')
-rw-r--r-- | tests/mailsynctest.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/mailsynctest.h b/tests/mailsynctest.h new file mode 100644 index 0000000..f9ee7be --- /dev/null +++ b/tests/mailsynctest.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 Christian Mollekopf <chrigi_1@fastmail.fm> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | #pragma once | ||
20 | |||
21 | #include <QObject> | ||
22 | #include <QByteArray> | ||
23 | |||
24 | #include <applicationdomaintype.h> | ||
25 | |||
26 | #define ASYNCCOMPARE(actual, expected) \ | ||
27 | do {\ | ||
28 | if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\ | ||
29 | return KAsync::error<void>(1, "Comparison failed.");\ | ||
30 | } while (0) | ||
31 | |||
32 | #define ASYNCVERIFY(statement) \ | ||
33 | do {\ | ||
34 | if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\ | ||
35 | return KAsync::error<void>(1, "Verify failed.");\ | ||
36 | } while (0) | ||
37 | |||
38 | #define VERIFYEXEC(statement) \ | ||
39 | do {\ | ||
40 | auto result = statement.exec(); \ | ||
41 | result.waitForFinished(); \ | ||
42 | if (!QTest::qVerify(!result.errorCode(), #statement, "", __FILE__, __LINE__))\ | ||
43 | return;\ | ||
44 | } while (0) | ||
45 | |||
46 | namespace Sink { | ||
47 | |||
48 | class MailSyncTest : public QObject | ||
49 | { | ||
50 | Q_OBJECT | ||
51 | |||
52 | protected: | ||
53 | QByteArray mResourceInstanceIdentifier; | ||
54 | QByteArrayList mCapabilities; | ||
55 | |||
56 | virtual void resetTestEnvironment() = 0; | ||
57 | virtual Sink::ApplicationDomain::SinkResource createResource() = 0; | ||
58 | virtual Sink::ApplicationDomain::SinkResource createFaultyResource() = 0; | ||
59 | virtual void removeResourceFromDisk(const QByteArray &mResourceInstanceIdentifier) = 0; | ||
60 | virtual void createFolder(const QStringList &folderPath) = 0; | ||
61 | virtual void removeFolder(const QStringList &folderPath) = 0; | ||
62 | virtual void createMessage(const QStringList &folderPath, const QByteArray &message) = 0; | ||
63 | virtual void removeMessage(const QStringList &folderPath, const QByteArray &message) = 0; | ||
64 | |||
65 | private slots: | ||
66 | void initTestCase(); | ||
67 | void init(); | ||
68 | void cleanup(); | ||
69 | |||
70 | void testListFolders(); | ||
71 | void testListFolderHierarchy(); | ||
72 | void testListNewFolders(); | ||
73 | void testListRemovedFolders(); | ||
74 | |||
75 | void testListMails(); | ||
76 | void testFetchNewMessages(); | ||
77 | void testFetchRemovedMessages(); | ||
78 | |||
79 | void testFailingSync(); | ||
80 | }; | ||
81 | |||
82 | } | ||
83 | |||