summaryrefslogtreecommitdiffstats
path: root/accounts/imap/tests/settingstest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/imap/tests/settingstest.cpp')
-rw-r--r--accounts/imap/tests/settingstest.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/accounts/imap/tests/settingstest.cpp b/accounts/imap/tests/settingstest.cpp
index 69d93079..386a9082 100644
--- a/accounts/imap/tests/settingstest.cpp
+++ b/accounts/imap/tests/settingstest.cpp
@@ -23,11 +23,11 @@ private slots:
23 { 23 {
24 auto accountId = "accountid"; 24 auto accountId = "accountid";
25 auto imapServer = QString("imapserver"); 25 auto imapServer = QString("imapserver");
26 auto imapUsername = QString("username"); 26 auto imapUsername = QString("imapName");
27 auto imapPassword = QString("password"); 27 auto imapPassword = QString("imapPw");
28 auto smtpServer = QString("smtpserver"); 28 auto smtpServer = QString("smtpserver");
29 auto smtpUsername = QString("username"); 29 auto smtpUsername = QString("smtpName");
30 auto smtpPassword = QString("password"); 30 auto smtpPassword = QString("smtpPw");
31 auto username = QString("username"); 31 auto username = QString("username");
32 auto emailAddress = QString("emailAddress"); 32 auto emailAddress = QString("emailAddress");
33 33
@@ -64,10 +64,43 @@ private slots:
64 QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer); 64 QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer);
65 QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername); 65 QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername);
66 QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword); 66 QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword);
67 QCOMPARE(readSettings.property("userName").toString(), smtpUsername); 67 QCOMPARE(readSettings.property("userName").toString(), username);
68 QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress); 68 QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress);
69 } 69 }
70 70
71 //Modify all settings
72 {
73 settings.setProperty("imapServer", imapServer + "mod");
74 settings.setProperty("imapUsername", imapUsername + "mod");
75 settings.setProperty("imapPassword", imapPassword + "mod");
76 settings.setProperty("smtpServer", smtpServer + "mod");
77 settings.setProperty("smtpUsername", smtpUsername + "mod");
78 settings.setProperty("smtpPassword", smtpPassword + "mod");
79 settings.setProperty("userName", username + "mod");
80 settings.setProperty("emailAddress", emailAddress + "mod");
81 settings.save();
82 }
83
84 //Read back settings again
85 {
86 ImapSettings readSettings;
87 QSignalSpy spy(&readSettings, &ImapSettings::imapResourceChanged);
88 QSignalSpy spy1(&readSettings, &ImapSettings::smtpResourceChanged);
89 readSettings.setAccountIdentifier(accountId);
90 //Once for clear and once for the new setting
91 QTRY_COMPARE(spy.count(), 2);
92 QTRY_COMPARE(spy1.count(), 2);
93 QVERIFY(!readSettings.accountIdentifier().isEmpty());
94 QCOMPARE(readSettings.property("imapServer").toString(), imapServer + "mod");
95 QCOMPARE(readSettings.property("imapUsername").toString(), imapUsername + "mod");
96 QCOMPARE(readSettings.property("imapPassword").toString(), imapPassword + "mod");
97 QCOMPARE(readSettings.property("smtpServer").toString(), smtpServer + "mod");
98 QCOMPARE(readSettings.property("smtpUsername").toString(), smtpUsername + "mod");
99 QCOMPARE(readSettings.property("smtpPassword").toString(), smtpPassword + "mod");
100 QCOMPARE(readSettings.property("userName").toString(), username + "mod");
101 QCOMPARE(readSettings.property("emailAddress").toString(), emailAddress + "mod");
102 }
103
71 { 104 {
72 ImapSettings settings; 105 ImapSettings settings;
73 QSignalSpy spy(&settings, &ImapSettings::imapResourceChanged); 106 QSignalSpy spy(&settings, &ImapSettings::imapResourceChanged);