File indexing completed on 2025-11-09 04:59:20

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "twoauthenticationpasswordwidgettest.h"
0008 #include "misc/twoauthenticationpasswordwidget.h"
0009 #include <KPasswordLineEdit>
0010 #include <QHBoxLayout>
0011 #include <QPushButton>
0012 #include <QTest>
0013 QTEST_MAIN(TwoAuthenticationPasswordWidgetTest)
0014 
0015 TwoAuthenticationPasswordWidgetTest::TwoAuthenticationPasswordWidgetTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 void TwoAuthenticationPasswordWidgetTest::shouldHaveDefaultValues()
0021 {
0022     TwoAuthenticationPasswordWidget w;
0023 
0024     auto twoFactorLayout = w.findChild<QHBoxLayout *>(QStringLiteral("twoFactorLayout"));
0025     QVERIFY(twoFactorLayout);
0026     QCOMPARE(twoFactorLayout->contentsMargins(), QMargins());
0027 
0028     auto mTwoFactorAuthenticationPasswordLineEdit = w.findChild<KPasswordLineEdit *>(QStringLiteral("mTwoFactorAuthenticationPasswordLineEdit"));
0029     QVERIFY(mTwoFactorAuthenticationPasswordLineEdit);
0030 
0031     auto sendNewEmailCode = w.findChild<QPushButton *>(QStringLiteral("sendNewEmailCode"));
0032     QVERIFY(sendNewEmailCode);
0033     QVERIFY(!sendNewEmailCode->text().isEmpty());
0034 }
0035 
0036 #include "moc_twoauthenticationpasswordwidgettest.cpp"