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 "filteractionsetstatustest.h"
0008 #include "../filteractions/filteractionsetstatus.h"
0009 #include <QComboBox>
0010 #include <QTest>
0011 #include <QWidget>
0012 
0013 FilterActionSetStatusTest::FilterActionSetStatusTest(QObject *parent)
0014     : QObject(parent)
0015 {
0016 }
0017 
0018 FilterActionSetStatusTest::~FilterActionSetStatusTest() = default;
0019 
0020 void FilterActionSetStatusTest::shouldHaveDefaultValue()
0021 {
0022     MailCommon::FilterActionSetStatus filter;
0023     QWidget *w = filter.createParamWidget(nullptr);
0024     QCOMPARE(w->objectName(), QStringLiteral("combobox"));
0025     auto comboBox = dynamic_cast<QComboBox *>(w);
0026     QVERIFY(comboBox);
0027     QVERIFY(!comboBox->isEditable());
0028     QVERIFY(comboBox->count() > 0);
0029 }
0030 
0031 void FilterActionSetStatusTest::shouldHaveSieveRequires()
0032 {
0033     MailCommon::FilterActionSetStatus filter;
0034     QCOMPARE(filter.sieveRequires(), QStringList() << QStringLiteral("imap4flags"));
0035 }
0036 
0037 void FilterActionSetStatusTest::shouldBeEmpty()
0038 {
0039     MailCommon::FilterActionSetStatus filter;
0040     QVERIFY(filter.isEmpty());
0041 }
0042 
0043 void FilterActionSetStatusTest::shouldRequiresPart()
0044 {
0045     MailCommon::FilterActionSetStatus filter;
0046     QCOMPARE(filter.requiredPart(), MailCommon::SearchRule::Envelope);
0047 }
0048 
0049 QTEST_MAIN(FilterActionSetStatusTest)
0050 
0051 #include "moc_filteractionsetstatustest.cpp"