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

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "administratoradduserdialogtest.h"
0008 #include "administratordialog/users/administratoradduserdialog.h"
0009 #include "administratordialog/users/administratoradduserwidget.h"
0010 #include <QDialogButtonBox>
0011 #include <QPushButton>
0012 #include <QTest>
0013 #include <QVBoxLayout>
0014 QTEST_MAIN(AdministratorAddUserDialogTest)
0015 AdministratorAddUserDialogTest::AdministratorAddUserDialogTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 void AdministratorAddUserDialogTest::shouldHaveDefaultValues()
0021 {
0022     AdministratorAddUserDialog d(nullptr);
0023     QVERIFY(!d.windowTitle().isEmpty());
0024     auto mainLayout = d.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0025     QVERIFY(mainLayout);
0026     auto mAdministratorWidget = d.findChild<AdministratorAddUserWidget *>(QStringLiteral("mAdministratorWidget"));
0027     QVERIFY(mAdministratorWidget);
0028 
0029     auto button = d.findChild<QDialogButtonBox *>(QStringLiteral("button"));
0030     QVERIFY(button);
0031 
0032     QPushButton *buttonOk = button->button(QDialogButtonBox::Ok);
0033     QVERIFY(buttonOk);
0034     QVERIFY(!buttonOk->isEnabled());
0035 }
0036 
0037 #include "moc_administratoradduserdialogtest.cpp"