Commit 9d5ccebe authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add new autotest

parent 3e7bb9f9
......@@ -32,4 +32,31 @@ void DKIMManagerRulesTest::shouldHaveDefaultValues()
{
MessageViewer::DKIMManagerRules r;
QVERIFY(r.rules().isEmpty());
QVERIFY(r.isEmpty());
}
void DKIMManagerRulesTest::shouldAddRules()
{
MessageViewer::DKIMManagerRules r;
QVERIFY(r.isEmpty());
MessageViewer::DKIMRule rule;
rule.setDomain(QStringLiteral("bla"));
rule.setFrom(QStringLiteral("foo"));
rule.setRuleType(MessageViewer::DKIMRule::RuleType::MustBeSigned);
r.addRule(rule);
QVERIFY(!r.isEmpty());
}
void DKIMManagerRulesTest::shouldClearRules()
{
MessageViewer::DKIMManagerRules r;
QVERIFY(r.isEmpty());
MessageViewer::DKIMRule rule;
rule.setDomain(QStringLiteral("bla"));
rule.setFrom(QStringLiteral("foo"));
rule.setRuleType(MessageViewer::DKIMRule::RuleType::MustBeSigned);
r.addRule(rule);
QVERIFY(!r.isEmpty());
r.clear();
QVERIFY(r.isEmpty());
}
......@@ -30,6 +30,8 @@ public:
~DKIMManagerRulesTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
void shouldAddRules();
void shouldClearRules();
};
#endif // DKIMMANAGERRULESTEST_H
......@@ -49,6 +49,11 @@ void DKIMManagerRules::addRule(const DKIMRule &rule)
}
}
bool DKIMManagerRules::isEmpty() const
{
return mRules.isEmpty();
}
QVector<DKIMRule> DKIMManagerRules::rules() const
{
return mRules;
......
......@@ -49,6 +49,7 @@ public:
void importRules(const QString &fileName);
void exportRules(const QString &fileName);
Q_REQUIRED_RESULT bool isEmpty() const;
private:
void loadRules(const QString &fileName = QString());
void save(const QString &fileName = QString());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment