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

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "filteractionmissingidentitydialogtest.h"
0008 #include "../../autotests/dummykernel.h"
0009 #include "../../kernel/mailkernel.h"
0010 #include "../filter/dialog/filteractionmissingidentitydialog.h"
0011 #include <KIdentityManagementWidgets/IdentityCombo>
0012 #include <QDialogButtonBox>
0013 #include <QLabel>
0014 #include <QStandardPaths>
0015 #include <QTest>
0016 
0017 FilterActionMissingIdentityDialogTest::FilterActionMissingIdentityDialogTest(QObject *parent)
0018     : QObject(parent)
0019 {
0020     QStandardPaths::setTestModeEnabled(true);
0021 }
0022 
0023 FilterActionMissingIdentityDialogTest::~FilterActionMissingIdentityDialogTest() = default;
0024 
0025 void FilterActionMissingIdentityDialogTest::initTestCase()
0026 {
0027     auto kernel = new DummyKernel(nullptr);
0028     CommonKernel->registerKernelIf(kernel); // register KernelIf early, it is used by the Filter classes
0029     CommonKernel->registerSettingsIf(kernel); // SettingsIf is used in FolderTreeWidget
0030 }
0031 
0032 void FilterActionMissingIdentityDialogTest::shouldHaveDefaultValue()
0033 {
0034     MailCommon::FilterActionMissingIdentityDialog dlg(QStringLiteral("filename"));
0035     QVERIFY(dlg.isModal());
0036     QVERIFY(!dlg.windowTitle().isEmpty());
0037 
0038     auto label = dlg.findChild<QLabel *>(QStringLiteral("label"));
0039     QVERIFY(label);
0040     QVERIFY(!label->text().isEmpty());
0041 
0042     auto mComboBoxIdentity = dlg.findChild<KIdentityManagementWidgets::IdentityCombo *>(QStringLiteral("comboboxidentity"));
0043     QVERIFY(mComboBoxIdentity);
0044 
0045     auto buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
0046     QVERIFY(buttonBox);
0047 }
0048 
0049 QTEST_MAIN(FilterActionMissingIdentityDialogTest)
0050 
0051 #include "moc_filteractionmissingidentitydialogtest.cpp"