File indexing completed on 2024-12-22 04:46:00

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 "myaccountconfigurewidgettest.h"
0008 #include "myaccount/myaccount2faconfigurewidget.h"
0009 #include "myaccount/myaccountconfigurewidget.h"
0010 #include "myaccount/myaccountpersonalaccesstokenconfigurewidget.h"
0011 #include "myaccount/myaccountpreferenceconfigurewidget.h"
0012 #include "myaccount/myaccountprofileconfigurewidget.h"
0013 #include <QStackedWidget>
0014 #include <QTabWidget>
0015 #include <QTest>
0016 #include <QVBoxLayout>
0017 
0018 QTEST_MAIN(MyAccountConfigureWidgetTest)
0019 MyAccountConfigureWidgetTest::MyAccountConfigureWidgetTest(QObject *parent)
0020     : QObject(parent)
0021 {
0022 }
0023 
0024 void MyAccountConfigureWidgetTest::shouldHaveDefaultValues()
0025 {
0026     MyAccountConfigureWidget w(nullptr);
0027 
0028     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0029     QVERIFY(mainLayout);
0030     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0031 
0032     auto tabWidget = w.findChild<QTabWidget *>(QStringLiteral("tabWidget"));
0033     QVERIFY(tabWidget);
0034 
0035     auto mMyAccount2ProfileConfigureWidget = w.findChild<MyAccountProfileConfigureWidget *>(QStringLiteral("mMyAccount2ProfileConfigureWidget"));
0036     QVERIFY(mMyAccount2ProfileConfigureWidget);
0037 
0038     auto mMyAccount2FaConfigureWidget = w.findChild<MyAccount2FaConfigureWidget *>(QStringLiteral("mMyAccount2FaConfigureWidget"));
0039     QVERIFY(mMyAccount2FaConfigureWidget);
0040 
0041     auto mMyAccountPreferenceConfigureWidget = w.findChild<MyAccountPreferenceConfigureWidget *>(QStringLiteral("mMyAccountPreferenceConfigureWidget"));
0042     QVERIFY(mMyAccountPreferenceConfigureWidget);
0043 
0044     auto mMyAccountPersonalAccessTokenConfigureWidget =
0045         w.findChild<MyAccountPersonalAccessTokenConfigureWidget *>(QStringLiteral("mMyAccountPersonalAccessTokenConfigureWidget"));
0046     QVERIFY(mMyAccountPersonalAccessTokenConfigureWidget);
0047 
0048     auto mStackedWidget = w.findChild<QStackedWidget *>(QStringLiteral("mStackedWidget"));
0049     QVERIFY(mStackedWidget);
0050 }
0051 
0052 #include "moc_myaccountconfigurewidgettest.cpp"