File indexing completed on 2024-11-24 04:43:06

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 "confirmbeforedeletingcreateruledialogtest.h"
0008 #include "confirmbeforedeletingcreateruledialog.h"
0009 #include "confirmbeforedeletingcreaterulewidget.h"
0010 #include <QDialogButtonBox>
0011 #include <QPushButton>
0012 #include <QTest>
0013 #include <QVBoxLayout>
0014 QTEST_MAIN(ConfirmBeforeDeletingCreateRuleDialogTest)
0015 ConfirmBeforeDeletingCreateRuleDialogTest::ConfirmBeforeDeletingCreateRuleDialogTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 void ConfirmBeforeDeletingCreateRuleDialogTest::shouldHaveDefaultValues()
0021 {
0022     ConfirmBeforeDeletingCreateRuleDialog w;
0023     QVERIFY(!w.windowTitle().isEmpty());
0024     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
0025     QVERIFY(mainLayout);
0026 
0027     auto mConfirmBeforeDeletingCreateRuleWidget =
0028         w.findChild<ConfirmBeforeDeletingCreateRuleWidget *>(QStringLiteral("mConfirmBeforeDeletingCreateRuleWidget"));
0029     mainLayout->addWidget(mConfirmBeforeDeletingCreateRuleWidget);
0030 
0031     auto buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
0032     QVERIFY(buttonBox);
0033     auto okButton = buttonBox->button(QDialogButtonBox::Ok);
0034     QVERIFY(!okButton->isEnabled());
0035 }
0036 
0037 #include "moc_confirmbeforedeletingcreateruledialogtest.cpp"