File indexing completed on 2024-12-22 04:46:00
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #include "myaccount2fadisabletotpwidgettest.h" 0007 #include "myaccount/myaccount2fadisabletotpwidget.h" 0008 #include <QLabel> 0009 #include <QLineEdit> 0010 #include <QPushButton> 0011 #include <QTest> 0012 #include <QVBoxLayout> 0013 QTEST_MAIN(MyAccount2FaDisableTotpWidgetTest) 0014 MyAccount2FaDisableTotpWidgetTest::MyAccount2FaDisableTotpWidgetTest(QObject *parent) 0015 : QObject{parent} 0016 { 0017 } 0018 0019 void MyAccount2FaDisableTotpWidgetTest::shouldHaveDefaultValues() 0020 { 0021 MyAccount2FaDisableTotpWidget w(nullptr); 0022 0023 auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout")); 0024 QVERIFY(mainLayout); 0025 QCOMPARE(mainLayout->contentsMargins(), QMargins{}); 0026 0027 auto label = w.findChild<QLabel *>(QStringLiteral("label")); 0028 QVERIFY(label); 0029 QVERIFY(!label->text().isEmpty()); 0030 0031 auto hboxLayout = w.findChild<QHBoxLayout *>(QStringLiteral("hboxLayout")); 0032 QVERIFY(hboxLayout); 0033 QCOMPARE(hboxLayout->contentsMargins(), QMargins{}); 0034 0035 auto mDisableCodeLineEdit = w.findChild<QLineEdit *>(QStringLiteral("mDisableCodeLineEdit")); 0036 QVERIFY(mDisableCodeLineEdit); 0037 QVERIFY(!mDisableCodeLineEdit->placeholderText().isEmpty()); 0038 0039 auto verifyButton = w.findChild<QPushButton *>(QStringLiteral("verifyButton")); 0040 QVERIFY(verifyButton); 0041 QVERIFY(!verifyButton->text().isEmpty()); 0042 QVERIFY(!verifyButton->isEnabled()); 0043 0044 auto regenerateCode = w.findChild<QPushButton *>(QStringLiteral("regenerateCode")); 0045 QVERIFY(regenerateCode); 0046 QVERIFY(!regenerateCode->text().isEmpty()); 0047 } 0048 0049 #include "moc_myaccount2fadisabletotpwidgettest.cpp"