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

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "confirmaddressdialogtest.h"
0008 #include "../confirmaddressdialog.h"
0009 #include "../confirmaddresswidget.h"
0010 #include <QDialogButtonBox>
0011 #include <QPushButton>
0012 #include <QStandardPaths>
0013 #include <QTest>
0014 #include <QVBoxLayout>
0015 
0016 ConfirmAddressDialogTest::ConfirmAddressDialogTest(QObject *parent)
0017     : QObject(parent)
0018 {
0019     QStandardPaths::setTestModeEnabled(true);
0020 }
0021 
0022 ConfirmAddressDialogTest::~ConfirmAddressDialogTest() = default;
0023 
0024 void ConfirmAddressDialogTest::shouldHaveDefaultValue()
0025 {
0026     ConfirmAddressDialog dlg;
0027     auto mainLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
0028     QVERIFY(mainLayout);
0029 
0030     auto buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
0031     QVERIFY(buttonBox);
0032 
0033     auto confirmAddressWidget = dlg.findChild<ConfirmAddressWidget *>(QStringLiteral("confirmwidget"));
0034     QVERIFY(confirmAddressWidget);
0035 
0036     auto whiteListEmailsButton = dlg.findChild<QPushButton *>(QStringLiteral("whiteListEmailsButton"));
0037     QVERIFY(whiteListEmailsButton);
0038     QVERIFY(!whiteListEmailsButton->isEnabled());
0039 }
0040 
0041 QTEST_MAIN(ConfirmAddressDialogTest)
0042 
0043 #include "moc_confirmaddressdialogtest.cpp"