File indexing completed on 2025-03-09 04:46:55

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "openurlwithconfiguredialogtest.h"
0008 #include "openurlwithconfiguredialog.h"
0009 #include "openurlwithconfigurewidget.h"
0010 #include <QDialogButtonBox>
0011 #include <QStandardPaths>
0012 #include <QTest>
0013 #include <QVBoxLayout>
0014 QTEST_MAIN(OpenUrlWithConfigureDialogTest)
0015 OpenUrlWithConfigureDialogTest::OpenUrlWithConfigureDialogTest(QObject *parent)
0016     : QObject{parent}
0017 {
0018     QStandardPaths::setTestModeEnabled(true);
0019 }
0020 
0021 void OpenUrlWithConfigureDialogTest::shouldHaveDefaultValues()
0022 {
0023     OpenUrlWithConfigureDialog dlg;
0024     QVERIFY(!dlg.windowTitle().isEmpty());
0025 
0026     auto mainLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
0027     QVERIFY(mainLayout);
0028 
0029     auto mConfigureWidget = dlg.findChild<OpenUrlWithConfigureWidget *>(QStringLiteral("mOpenUrlWithWidget"));
0030     QVERIFY(mConfigureWidget);
0031 
0032     auto buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
0033     QVERIFY(buttonBox);
0034     QCOMPARE(buttonBox->standardButtons(), QDialogButtonBox::StandardButtons{QDialogButtonBox::Ok | QDialogButtonBox::Cancel});
0035 }
0036 
0037 #include "moc_openurlwithconfiguredialogtest.cpp"