File indexing completed on 2024-11-10 04:50:01

0001 /*
0002   SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #include "mailfiltertest.h"
0008 #include "../mailfilter.h"
0009 #include <QTest>
0010 
0011 MailFilterTest::MailFilterTest(QObject *parent)
0012     : QObject(parent)
0013 {
0014 }
0015 
0016 MailFilterTest::~MailFilterTest() = default;
0017 
0018 void MailFilterTest::shouldHaveDefaultValue()
0019 {
0020     MailCommon::MailFilter mailfilter;
0021     QVERIFY(mailfilter.isEmpty());
0022     QVERIFY(mailfilter.isEnabled());
0023     QVERIFY(mailfilter.applyOnInbound());
0024     QVERIFY(!mailfilter.applyBeforeOutbound());
0025     QVERIFY(mailfilter.applyOnExplicit());
0026     QVERIFY(mailfilter.stopProcessingHere());
0027     QVERIFY(!mailfilter.configureShortcut());
0028     QVERIFY(!mailfilter.configureToolbar());
0029     QVERIFY(mailfilter.isAutoNaming());
0030     QCOMPARE(mailfilter.applicability(), MailCommon::MailFilter::All);
0031     QVERIFY(mailfilter.actions()->isEmpty());
0032     QVERIFY(mailfilter.icon().isEmpty());
0033 }
0034 
0035 void MailFilterTest::shouldApplySettings()
0036 {
0037     MailCommon::MailFilter mailfilter;
0038     bool value = true;
0039     mailfilter.setApplyBeforeOutbound(value);
0040     QCOMPARE(mailfilter.applyBeforeOutbound(), value);
0041     value = false;
0042     mailfilter.setApplyBeforeOutbound(value);
0043     QCOMPARE(mailfilter.applyBeforeOutbound(), value);
0044 }
0045 
0046 QTEST_MAIN(MailFilterTest)
0047 
0048 #include "moc_mailfiltertest.cpp"