File indexing completed on 2025-01-19 04:46:51

0001 /*
0002    SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "dkimpolicywidgettest.h"
0008 #include "dkimpolicywidget.h"
0009 #include <QCheckBox>
0010 #include <QPushButton>
0011 #include <QTest>
0012 #include <QVBoxLayout>
0013 QTEST_MAIN(DKIMPolicyWidgetTest)
0014 DKIMPolicyWidgetTest::DKIMPolicyWidgetTest(QObject *parent)
0015     : QObject(parent)
0016 {
0017 }
0018 
0019 DKIMPolicyWidgetTest::~DKIMPolicyWidgetTest() = default;
0020 
0021 void DKIMPolicyWidgetTest::shouldHaveDefaultValues()
0022 {
0023     DKIMPolicyWidget w;
0024     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0025     QVERIFY(mainLayout);
0026 
0027     auto mVerifyIfEmailMustBeSigned = w.findChild<QCheckBox *>(QStringLiteral("kcfg_CheckIfEmailShouldBeSigned"));
0028     QVERIFY(mVerifyIfEmailMustBeSigned);
0029     QVERIFY(!mVerifyIfEmailMustBeSigned->text().isEmpty());
0030     QVERIFY(mVerifyIfEmailMustBeSigned->isEnabled());
0031 
0032     auto mUseDMARC = w.findChild<QCheckBox *>(QStringLiteral("kcfg_UseDMarc"));
0033     QVERIFY(mUseDMARC);
0034     QVERIFY(!mUseDMARC->text().isEmpty());
0035     QVERIFY(!mUseDMARC->isEnabled());
0036 
0037     auto mUseDefaultRules = w.findChild<QCheckBox *>(QStringLiteral("kcfg_UseDefaultRules"));
0038     QVERIFY(mUseDefaultRules);
0039     QVERIFY(!mUseDefaultRules->text().isEmpty());
0040     QVERIFY(!mUseDefaultRules->isEnabled());
0041 
0042     auto mRulesButton = w.findChild<QPushButton *>(QStringLiteral("rules"));
0043     QVERIFY(mRulesButton);
0044     QVERIFY(!mRulesButton->isEnabled());
0045     QVERIFY(!mRulesButton->text().isEmpty());
0046 
0047     auto mAutoGenerateRule = w.findChild<QCheckBox *>(QStringLiteral("kcfg_AutogenerateRule"));
0048     QVERIFY(mAutoGenerateRule);
0049     QVERIFY(!mAutoGenerateRule->text().isEmpty());
0050     QVERIFY(!mAutoGenerateRule->isEnabled());
0051 
0052     auto mReadAuthResultHeader = w.findChild<QCheckBox *>(QStringLiteral("kcfg_UseAuthenticationResults"));
0053     QVERIFY(mReadAuthResultHeader);
0054     QVERIFY(!mReadAuthResultHeader->text().isEmpty());
0055     QVERIFY(!mReadAuthResultHeader->isEnabled());
0056 
0057     auto mAutoGenerateOnlyIfSenderInSDID = w.findChild<QCheckBox *>(QStringLiteral("kcfg_AutogenerateRuleOnlyIfSenderOnSDID"));
0058     QVERIFY(mAutoGenerateOnlyIfSenderInSDID);
0059     QVERIFY(!mAutoGenerateOnlyIfSenderInSDID->text().isEmpty());
0060     QVERIFY(!mAutoGenerateOnlyIfSenderInSDID->isEnabled());
0061 }
0062 
0063 #include "moc_dkimpolicywidgettest.cpp"