File indexing completed on 2024-12-22 04:45:34

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "administratoroauthcreatedialogtest.h"
0008 #include "administratordialog/oauth/administratoroauthcreatedialog.h"
0009 
0010 #include <QDialogButtonBox>
0011 #include <QPushButton>
0012 #include <QStandardPaths>
0013 #include <QTest>
0014 #include <QVBoxLayout>
0015 
0016 QTEST_MAIN(AdministratorOauthCreateDialogTest)
0017 AdministratorOauthCreateDialogTest::AdministratorOauthCreateDialogTest(QObject *parent)
0018     : QObject{parent}
0019 {
0020     QStandardPaths::setTestModeEnabled(true);
0021 }
0022 
0023 void AdministratorOauthCreateDialogTest::shouldHaveDefaultValues()
0024 {
0025     AdministratorOauthCreateDialog w;
0026     QVERIFY(!w.windowTitle().isEmpty());
0027     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0028     QVERIFY(mainLayout);
0029 
0030     auto buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("button"));
0031     QVERIFY(buttonBox);
0032     QCOMPARE(buttonBox->standardButtons(), QDialogButtonBox::StandardButtons{QDialogButtonBox::Ok | QDialogButtonBox::Cancel});
0033 
0034     auto mCreateWidget = w.findChild<AdministratorOauthCreateWidget *>(QStringLiteral("mCreateWidget"));
0035     QVERIFY(mCreateWidget);
0036 
0037     auto mOkButton = buttonBox->button(QDialogButtonBox::Ok);
0038     QVERIFY(!mOkButton->isEnabled());
0039 }
0040 
0041 #include "moc_administratoroauthcreatedialogtest.cpp"