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

0001 /*
0002    SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "confirmaddressemailentrydialogtest.h"
0008 #include "../confirmaddressemailentrydialog.h"
0009 #include <KEmailValidator>
0010 #include <QDialogButtonBox>
0011 #include <QLabel>
0012 #include <QLineEdit>
0013 #include <QTest>
0014 #include <QVBoxLayout>
0015 
0016 QTEST_MAIN(ConfirmAddressEmailEntryDialogTest)
0017 
0018 ConfirmAddressEmailEntryDialogTest::ConfirmAddressEmailEntryDialogTest(QObject *parent)
0019     : QObject(parent)
0020 {
0021 }
0022 
0023 void ConfirmAddressEmailEntryDialogTest::shouldHaveDefaultValue()
0024 {
0025     ConfirmAddressEmailEntryDialog dlg;
0026     auto mainLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
0027     QVERIFY(mainLayout);
0028 
0029     auto label = dlg.findChild<QLabel *>(QStringLiteral("label"));
0030     QVERIFY(label);
0031     QVERIFY(!label->text().isEmpty());
0032 
0033     auto mLineEdit = dlg.findChild<QLineEdit *>(QStringLiteral("lineedit"));
0034     QVERIFY(mLineEdit);
0035     QVERIFY(mLineEdit->text().isEmpty());
0036     QVERIFY(mLineEdit->validator());
0037     QVERIFY(qobject_cast<const KEmailValidator *>(mLineEdit->validator()));
0038 
0039     auto buttons = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttons"));
0040     QVERIFY(buttons);
0041 }
0042 
0043 #include "moc_confirmaddressemailentrydialogtest.cpp"