File indexing completed on 2024-05-26 05:05:56
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #include "myaccount2fatotpwidgettest.h" 0007 #include "myaccount/myaccount2fatotpwidget.h" 0008 #include <QLabel> 0009 #include <QLineEdit> 0010 #include <QPushButton> 0011 #include <QTest> 0012 #include <QVBoxLayout> 0013 QTEST_MAIN(MyAccount2FaTotpWidgetTest) 0014 MyAccount2FaTotpWidgetTest::MyAccount2FaTotpWidgetTest(QObject *parent) 0015 : QObject{parent} 0016 { 0017 } 0018 0019 void MyAccount2FaTotpWidgetTest::shouldHaveDefaultValues() 0020 { 0021 MyAccount2FaTotpWidget w(nullptr); 0022 auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout")); 0023 QVERIFY(mainLayout); 0024 QCOMPARE(mainLayout->contentsMargins(), QMargins{}); 0025 auto mTotpQrCode = w.findChild<QLabel *>(QStringLiteral("mTotpQrCode")); 0026 QVERIFY(mTotpQrCode); 0027 0028 auto mQrCoreLabel = w.findChild<QLabel *>(QStringLiteral("mQrCoreLabel")); 0029 QVERIFY(mQrCoreLabel); 0030 QCOMPARE(mQrCoreLabel->textFormat(), Qt::PlainText); 0031 QCOMPARE(mQrCoreLabel->textInteractionFlags(), Qt::TextSelectableByMouse); 0032 0033 auto mVerifyQrCode = w.findChild<QLineEdit *>(QStringLiteral("mVerifyQrCode")); 0034 QVERIFY(mVerifyQrCode); 0035 QVERIFY(mVerifyQrCode->text().isEmpty()); 0036 QVERIFY(!mVerifyQrCode->placeholderText().isEmpty()); 0037 0038 auto label = w.findChild<QLabel *>(QStringLiteral("label")); 0039 QVERIFY(label); 0040 QVERIFY(!label->text().isEmpty()); 0041 0042 auto verifyButton = w.findChild<QPushButton *>(QStringLiteral("verifyButton")); 0043 QVERIFY(verifyButton); 0044 QVERIFY(!verifyButton->text().isEmpty()); 0045 QVERIFY(!verifyButton->isEnabled()); 0046 } 0047 0048 #include "moc_myaccount2fatotpwidgettest.cpp"