Warning, file /pim/mailcommon/src/search/autotests/searchrulestatustest.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002   SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #include "searchrulestatustest.h"
0008 #include "../searchrule/searchrulestatus.h"
0009 #include <QTest>
0010 
0011 SearchRuleStatusTest::SearchRuleStatusTest(QObject *parent)
0012     : QObject(parent)
0013 {
0014 }
0015 
0016 void SearchRuleStatusTest::shouldHaveDefaultValue()
0017 {
0018     MailCommon::SearchRuleStatus ruleStatus;
0019     QVERIFY(ruleStatus.contents().isEmpty());
0020     QVERIFY(ruleStatus.field().isEmpty());
0021     QCOMPARE(ruleStatus.function(), MailCommon::SearchRule::FuncContains);
0022     QVERIFY(ruleStatus.isEmpty());
0023 }
0024 
0025 void SearchRuleStatusTest::shouldHaveRequirePart()
0026 {
0027     MailCommon::SearchRuleStatus ruleStatus;
0028     QCOMPARE(ruleStatus.requiredPart(), MailCommon::SearchRule::Envelope);
0029 }
0030 
0031 void SearchRuleStatusTest::shouldMatchStatus()
0032 {
0033 }
0034 
0035 void SearchRuleStatusTest::shouldMatchStatus_data()
0036 {
0037 }
0038 
0039 void SearchRuleStatusTest::shouldBeEmpty()
0040 {
0041     MailCommon::SearchRuleStatus searchrule;
0042     QVERIFY(searchrule.isEmpty());
0043     searchrule = MailCommon::SearchRuleStatus(QByteArray(), MailCommon::SearchRule::FuncContains, QStringLiteral("foo"));
0044     QVERIFY(searchrule.isEmpty());
0045     searchrule = MailCommon::SearchRuleStatus(QByteArray("<tag>"), MailCommon::SearchRule::FuncContains, QString());
0046     QVERIFY(searchrule.isEmpty());
0047 
0048     searchrule = MailCommon::SearchRuleStatus(QByteArray("<tag>"), MailCommon::SearchRule::FuncContains, QStringLiteral("foo"));
0049     QVERIFY(!searchrule.isEmpty());
0050 }
0051 
0052 QTEST_MAIN(SearchRuleStatusTest)
0053 
0054 #include "moc_searchrulestatustest.cpp"