diff options
-rw-r--r-- | accounts/CMakeLists.txt | 8 | ||||
-rw-r--r-- | accounts/gmail/CMakeLists.txt | 8 | ||||
-rw-r--r-- | accounts/imap/CMakeLists.txt | 12 | ||||
-rw-r--r-- | accounts/imap/tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | accounts/kolabnow/CMakeLists.txt | 18 | ||||
-rw-r--r-- | accounts/maildir/CMakeLists.txt | 18 | ||||
-rw-r--r-- | accounts/maildir/tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | accounts/maildir/tests/settingstest.cpp | 81 | ||||
-rw-r--r-- | framework/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | framework/src/domain/settings/tests/CMakeLists.txt | 9 | ||||
-rw-r--r-- | framework/src/domain/settings/tests/settingstest.cpp (renamed from accounts/imap/tests/settingstest.cpp) | 55 |
11 files changed, 64 insertions, 166 deletions
diff --git a/accounts/CMakeLists.txt b/accounts/CMakeLists.txt index ca72f050..e14fda4e 100644 --- a/accounts/CMakeLists.txt +++ b/accounts/CMakeLists.txt | |||
@@ -1,5 +1,13 @@ | |||
1 | include_directories(../framework/src/) | 1 | include_directories(../framework/src/) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
3 | add_subdirectory(maildir) | 11 | add_subdirectory(maildir) |
4 | add_subdirectory(imap) | 12 | add_subdirectory(imap) |
5 | add_subdirectory(kolabnow) | 13 | add_subdirectory(kolabnow) |
diff --git a/accounts/gmail/CMakeLists.txt b/accounts/gmail/CMakeLists.txt index 7a71264f..5be1b134 100644 --- a/accounts/gmail/CMakeLists.txt +++ b/accounts/gmail/CMakeLists.txt | |||
@@ -1,13 +1,5 @@ | |||
1 | project(kube-accounts-gmail) | 1 | project(kube-accounts-gmail) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
11 | set(SRCS | 3 | set(SRCS |
12 | gmailsettings.cpp | 4 | gmailsettings.cpp |
13 | gmailaccountplugin.cpp | 5 | gmailaccountplugin.cpp |
diff --git a/accounts/imap/CMakeLists.txt b/accounts/imap/CMakeLists.txt index 5ec32bbc..5bd25a93 100644 --- a/accounts/imap/CMakeLists.txt +++ b/accounts/imap/CMakeLists.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | project(kube-accounts-imap) | 1 | project(kube-accounts-imap) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Concurrent Quick Test Gui) | 3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) |
4 | 4 | ||
5 | find_package(Sink CONFIG REQUIRED) | 5 | find_package(Sink CONFIG REQUIRED) |
6 | find_package(KAsync CONFIG REQUIRED) | 6 | find_package(KAsync CONFIG REQUIRED) |
@@ -22,16 +22,6 @@ target_link_libraries(imapaccountplugin | |||
22 | Qt5::Qml | 22 | Qt5::Qml |
23 | ) | 23 | ) |
24 | 24 | ||
25 | add_library(imapaccount_static STATIC ${SRCS}) | ||
26 | target_link_libraries(imapaccount_static | ||
27 | sink | ||
28 | frameworkplugin | ||
29 | Qt5::Core | ||
30 | Qt5::Quick | ||
31 | Qt5::Qml | ||
32 | ) | ||
33 | add_subdirectory(tests) | ||
34 | |||
35 | kpackage_install_package(package org.kube.accounts.imap "genericqml") | 25 | kpackage_install_package(package org.kube.accounts.imap "genericqml") |
36 | 26 | ||
37 | install(TARGETS imapaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/imap) | 27 | install(TARGETS imapaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/imap) |
diff --git a/accounts/imap/tests/CMakeLists.txt b/accounts/imap/tests/CMakeLists.txt deleted file mode 100644 index bdfffe4b..00000000 --- a/accounts/imap/tests/CMakeLists.txt +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | include_directories(../) | ||
2 | add_executable(imapsettingstest settingstest.cpp) | ||
3 | add_test(imapsettingstest imapsettingstest) | ||
4 | target_link_libraries(imapsettingstest | ||
5 | sink | ||
6 | imapaccount_static | ||
7 | Qt5::Core | ||
8 | Qt5::Concurrent | ||
9 | Qt5::Test | ||
10 | ) | ||
diff --git a/accounts/kolabnow/CMakeLists.txt b/accounts/kolabnow/CMakeLists.txt index 8b84d9da..fd168537 100644 --- a/accounts/kolabnow/CMakeLists.txt +++ b/accounts/kolabnow/CMakeLists.txt | |||
@@ -1,13 +1,5 @@ | |||
1 | project(kube-accounts-kolabnow) | 1 | project(kube-accounts-kolabnow) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
11 | set(SRCS | 3 | set(SRCS |
12 | kolabnowsettings.cpp | 4 | kolabnowsettings.cpp |
13 | kolabnowaccountplugin.cpp | 5 | kolabnowaccountplugin.cpp |
@@ -22,16 +14,6 @@ target_link_libraries(kolabnowaccountplugin | |||
22 | Qt5::Qml | 14 | Qt5::Qml |
23 | ) | 15 | ) |
24 | 16 | ||
25 | add_library(kolabnowaccount_static STATIC ${SRCS}) | ||
26 | target_link_libraries(kolabnowaccount_static | ||
27 | sink | ||
28 | frameworkplugin | ||
29 | Qt5::Core | ||
30 | Qt5::Quick | ||
31 | Qt5::Qml | ||
32 | ) | ||
33 | # add_subdirectory(tests) | ||
34 | |||
35 | kpackage_install_package(package org.kube.accounts.kolabnow "genericqml") | 17 | kpackage_install_package(package org.kube.accounts.kolabnow "genericqml") |
36 | 18 | ||
37 | install(TARGETS kolabnowaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow) | 19 | install(TARGETS kolabnowaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow) |
diff --git a/accounts/maildir/CMakeLists.txt b/accounts/maildir/CMakeLists.txt index 1b017328..dc0f02fe 100644 --- a/accounts/maildir/CMakeLists.txt +++ b/accounts/maildir/CMakeLists.txt | |||
@@ -1,13 +1,5 @@ | |||
1 | project(kube-accounts-maildir) | 1 | project(kube-accounts-maildir) |
2 | 2 | ||
3 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Concurrent Quick Test Gui) | ||
4 | |||
5 | find_package(Sink CONFIG REQUIRED) | ||
6 | find_package(KAsync CONFIG REQUIRED) | ||
7 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
8 | |||
9 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
10 | |||
11 | set(SRCS | 3 | set(SRCS |
12 | maildirsettings.cpp | 4 | maildirsettings.cpp |
13 | maildiraccountplugin.cpp | 5 | maildiraccountplugin.cpp |
@@ -22,16 +14,6 @@ target_link_libraries(maildiraccountplugin | |||
22 | Qt5::Qml | 14 | Qt5::Qml |
23 | ) | 15 | ) |
24 | 16 | ||
25 | add_library(maildiraccount_static STATIC ${SRCS}) | ||
26 | target_link_libraries(maildiraccount_static | ||
27 | sink | ||
28 | frameworkplugin | ||
29 | Qt5::Core | ||
30 | Qt5::Quick | ||
31 | Qt5::Qml | ||
32 | ) | ||
33 | add_subdirectory(tests) | ||
34 | |||
35 | kpackage_install_package(package org.kube.accounts.maildir "genericqml") | 17 | kpackage_install_package(package org.kube.accounts.maildir "genericqml") |
36 | 18 | ||
37 | install(TARGETS maildiraccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/maildir) | 19 | install(TARGETS maildiraccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/maildir) |
diff --git a/accounts/maildir/tests/CMakeLists.txt b/accounts/maildir/tests/CMakeLists.txt deleted file mode 100644 index 13d706b2..00000000 --- a/accounts/maildir/tests/CMakeLists.txt +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | include_directories(../) | ||
2 | add_executable(maildirsettingstest settingstest.cpp) | ||
3 | add_test(maildirsettingstest maildirsettingstest) | ||
4 | target_link_libraries(maildirsettingstest | ||
5 | sink | ||
6 | maildiraccount_static | ||
7 | Qt5::Core | ||
8 | Qt5::Test | ||
9 | Qt5::Concurrent | ||
10 | ) | ||
diff --git a/accounts/maildir/tests/settingstest.cpp b/accounts/maildir/tests/settingstest.cpp deleted file mode 100644 index bf041e3c..00000000 --- a/accounts/maildir/tests/settingstest.cpp +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | #include <QTest> | ||
2 | #include <QDebug> | ||
3 | #include <QSignalSpy> | ||
4 | #include <functional> | ||
5 | #include <QStandardPaths> | ||
6 | #include <QDir> | ||
7 | #include <sink/test.h> | ||
8 | #include <sink/store.h> | ||
9 | |||
10 | #include "maildirsettings.h" | ||
11 | |||
12 | class SettingsTest : public QObject | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | private slots: | ||
16 | |||
17 | void initTestCase() | ||
18 | { | ||
19 | Sink::Test::initTest(); | ||
20 | } | ||
21 | |||
22 | void testLoad() | ||
23 | { | ||
24 | auto accountId = "accountid"; | ||
25 | auto maildirPath = QDir::tempPath(); | ||
26 | auto smtpServer = QString("smtpserver"); | ||
27 | auto smtpUsername = QString("username"); | ||
28 | auto smtpPassword = QString("password"); | ||
29 | auto username = QString("username"); | ||
30 | auto emailAddress = QString("emailAddress"); | ||
31 | |||
32 | MaildirSettings settings; | ||
33 | settings.setAccountIdentifier(accountId); | ||
34 | settings.setPath(maildirPath); | ||
35 | settings.setProperty("smtpServer", smtpServer); | ||
36 | settings.setProperty("smtpUsername", smtpUsername); | ||
37 | settings.setProperty("smtpPassword", smtpPassword); | ||
38 | settings.setProperty("userName", username); | ||
39 | settings.setProperty("emailAddress", emailAddress); | ||
40 | settings.save(); | ||
41 | |||
42 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then([](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { | ||
43 | QCOMPARE(resources.size(), 2); | ||
44 | }) | ||
45 | .exec().waitForFinished(); | ||
46 | |||
47 | //Ensure we can read back all the information using the accountid | ||
48 | { | ||
49 | MaildirSettings readSettings; | ||
50 | QSignalSpy spy(&readSettings, &MaildirSettings::pathChanged); | ||
51 | QSignalSpy spy1(&readSettings, &MaildirSettings::smtpResourceChanged); | ||
52 | readSettings.setAccountIdentifier(accountId); | ||
53 | //Once for clear and once for once for the new setting | ||
54 | QTRY_COMPARE(spy.count(), 2); | ||
55 | QTRY_COMPARE(spy1.count(), 2); | ||
56 | QVERIFY(!readSettings.accountIdentifier().isEmpty()); | ||
57 | QCOMPARE(readSettings.path().toString(), maildirPath); | ||
58 | QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer); | ||
59 | QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername); | ||
60 | QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword); | ||
61 | QCOMPARE(readSettings.property("userName").toString(), smtpUsername); | ||
62 | QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress); | ||
63 | } | ||
64 | |||
65 | { | ||
66 | MaildirSettings settings; | ||
67 | QSignalSpy spy(&settings, &MaildirSettings::pathChanged); | ||
68 | settings.setAccountIdentifier(accountId); | ||
69 | QTRY_COMPARE(spy.count(), 2); | ||
70 | settings.remove(); | ||
71 | } | ||
72 | |||
73 | Sink::Store::fetchAll<Sink::ApplicationDomain::SinkResource>(Sink::Query()).then([](const QList<Sink::ApplicationDomain::SinkResource::Ptr> &resources) { | ||
74 | QCOMPARE(resources.size(), 0); | ||
75 | }) | ||
76 | .exec().waitForFinished(); | ||
77 | } | ||
78 | }; | ||
79 | |||
80 | QTEST_GUILESS_MAIN(SettingsTest) | ||
81 | #include "settingstest.moc" | ||
diff --git a/framework/src/CMakeLists.txt b/framework/src/CMakeLists.txt index a22e8c06..8bb3d05c 100644 --- a/framework/src/CMakeLists.txt +++ b/framework/src/CMakeLists.txt | |||
@@ -69,5 +69,6 @@ set(BUILD_TESTING ON) | |||
69 | 69 | ||
70 | add_subdirectory(domain/mime/tests) | 70 | add_subdirectory(domain/mime/tests) |
71 | add_subdirectory(domain/mime/mimetreeparser) | 71 | add_subdirectory(domain/mime/mimetreeparser) |
72 | add_subdirectory(domain/settings/tests) | ||
72 | 73 | ||
73 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) | 74 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) |
diff --git a/framework/src/domain/settings/tests/CMakeLists.txt b/framework/src/domain/settings/tests/CMakeLists.txt new file mode 100644 index 00000000..9cb3f37c --- /dev/null +++ b/framework/src/domain/settings/tests/CMakeLists.txt | |||
@@ -0,0 +1,9 @@ | |||
1 | include_directories(../) | ||
2 | add_executable(settingstest settingstest.cpp) | ||
3 | add_test(settingstest settingstest) | ||
4 | target_link_libraries(settingstest | ||
5 | frameworkplugin | ||
6 | Qt5::Core | ||
7 | Qt5::Concurrent | ||
8 | Qt5::Test | ||
9 | ) | ||
diff --git a/accounts/imap/tests/settingstest.cpp b/framework/src/domain/settings/tests/settingstest.cpp index 386a9082..2d997468 100644 --- a/accounts/imap/tests/settingstest.cpp +++ b/framework/src/domain/settings/tests/settingstest.cpp | |||
@@ -7,7 +7,42 @@ | |||
7 | #include <sink/test.h> | 7 | #include <sink/test.h> |
8 | #include <sink/store.h> | 8 | #include <sink/store.h> |
9 | 9 | ||
10 | #include "imapsettings.h" | 10 | #include <accountsettings.h> |
11 | |||
12 | |||
13 | class TestSettings : public AccountSettings | ||
14 | { | ||
15 | Q_OBJECT | ||
16 | |||
17 | public: | ||
18 | TestSettings(QObject *parent = 0) | ||
19 | : AccountSettings{parent} | ||
20 | {} | ||
21 | |||
22 | Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE | ||
23 | { | ||
24 | loadAccount(); | ||
25 | loadImapResource(); | ||
26 | loadMailtransportResource(); | ||
27 | loadIdentity(); | ||
28 | } | ||
29 | |||
30 | Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE | ||
31 | { | ||
32 | saveAccount(); | ||
33 | saveImapResource(); | ||
34 | saveMailtransportResource(); | ||
35 | saveIdentity(); | ||
36 | } | ||
37 | |||
38 | Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE | ||
39 | { | ||
40 | removeResource(mMailtransportIdentifier); | ||
41 | removeResource(mImapIdentifier); | ||
42 | removeIdentity(); | ||
43 | removeAccount(); | ||
44 | } | ||
45 | }; | ||
11 | 46 | ||
12 | class SettingsTest : public QObject | 47 | class SettingsTest : public QObject |
13 | { | 48 | { |
@@ -31,7 +66,7 @@ private slots: | |||
31 | auto username = QString("username"); | 66 | auto username = QString("username"); |
32 | auto emailAddress = QString("emailAddress"); | 67 | auto emailAddress = QString("emailAddress"); |
33 | 68 | ||
34 | ImapSettings settings; | 69 | TestSettings settings; |
35 | settings.setAccountIdentifier(accountId); | 70 | settings.setAccountIdentifier(accountId); |
36 | settings.setProperty("imapServer", imapServer); | 71 | settings.setProperty("imapServer", imapServer); |
37 | settings.setProperty("imapUsername", imapUsername); | 72 | settings.setProperty("imapUsername", imapUsername); |
@@ -50,9 +85,9 @@ private slots: | |||
50 | 85 | ||
51 | //Ensure we can read back all the information using the accountid | 86 | //Ensure we can read back all the information using the accountid |
52 | { | 87 | { |
53 | ImapSettings readSettings; | 88 | TestSettings readSettings; |
54 | QSignalSpy spy(&readSettings, &ImapSettings::imapResourceChanged); | 89 | QSignalSpy spy(&readSettings, &TestSettings::imapResourceChanged); |
55 | QSignalSpy spy1(&readSettings, &ImapSettings::smtpResourceChanged); | 90 | QSignalSpy spy1(&readSettings, &TestSettings::smtpResourceChanged); |
56 | readSettings.setAccountIdentifier(accountId); | 91 | readSettings.setAccountIdentifier(accountId); |
57 | //Once for clear and once for the new setting | 92 | //Once for clear and once for the new setting |
58 | QTRY_COMPARE(spy.count(), 2); | 93 | QTRY_COMPARE(spy.count(), 2); |
@@ -83,9 +118,9 @@ private slots: | |||
83 | 118 | ||
84 | //Read back settings again | 119 | //Read back settings again |
85 | { | 120 | { |
86 | ImapSettings readSettings; | 121 | TestSettings readSettings; |
87 | QSignalSpy spy(&readSettings, &ImapSettings::imapResourceChanged); | 122 | QSignalSpy spy(&readSettings, &TestSettings::imapResourceChanged); |
88 | QSignalSpy spy1(&readSettings, &ImapSettings::smtpResourceChanged); | 123 | QSignalSpy spy1(&readSettings, &TestSettings::smtpResourceChanged); |
89 | readSettings.setAccountIdentifier(accountId); | 124 | readSettings.setAccountIdentifier(accountId); |
90 | //Once for clear and once for the new setting | 125 | //Once for clear and once for the new setting |
91 | QTRY_COMPARE(spy.count(), 2); | 126 | QTRY_COMPARE(spy.count(), 2); |
@@ -102,8 +137,8 @@ private slots: | |||
102 | } | 137 | } |
103 | 138 | ||
104 | { | 139 | { |
105 | ImapSettings settings; | 140 | TestSettings settings; |
106 | QSignalSpy spy(&settings, &ImapSettings::imapResourceChanged); | 141 | QSignalSpy spy(&settings, &TestSettings::imapResourceChanged); |
107 | settings.setAccountIdentifier(accountId); | 142 | settings.setAccountIdentifier(accountId); |
108 | QTRY_COMPARE(spy.count(), 2); | 143 | QTRY_COMPARE(spy.count(), 2); |
109 | settings.remove(); | 144 | settings.remove(); |