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 "openurlwithconfigurecreatewidgettest.h"
0008 #include "openurlwithconfigurecreatewidget.h"
0009 #include <KUrlRequester>
0010 #include <QFormLayout>
0011 #include <QLabel>
0012 #include <QLineEdit>
0013 #include <QTest>
0014 QTEST_MAIN(OpenUrlWithConfigureCreateWidgetTest)
0015 OpenUrlWithConfigureCreateWidgetTest::OpenUrlWithConfigureCreateWidgetTest(QObject *parent)
0016     : QObject{parent}
0017 {
0018 }
0019 
0020 void OpenUrlWithConfigureCreateWidgetTest::shouldHaveDefaultValues()
0021 {
0022     OpenUrlWithConfigureCreateWidget w;
0023 
0024     auto mainLayout = w.findChild<QFormLayout *>(QStringLiteral("mainlayout"));
0025     QVERIFY(mainLayout);
0026     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0027 
0028     auto mServerName = w.findChild<QLineEdit *>(QStringLiteral("mServerName"));
0029     QVERIFY(mServerName);
0030     QVERIFY(mServerName->text().isEmpty());
0031     QVERIFY(mServerName->isClearButtonEnabled());
0032 
0033     auto mCommandLine = w.findChild<QLineEdit *>(QStringLiteral("mCommandLine"));
0034     QVERIFY(mCommandLine);
0035     QVERIFY(mCommandLine->text().isEmpty());
0036     QVERIFY(mCommandLine->isClearButtonEnabled());
0037 
0038     auto formatHelp = w.findChild<QLabel *>(QStringLiteral("formatHelp"));
0039     QVERIFY(formatHelp);
0040     QCOMPARE(formatHelp->contextMenuPolicy(), Qt::NoContextMenu);
0041 
0042     auto mExecutable = w.findChild<KUrlRequester *>(QStringLiteral("mEditorRequester"));
0043     QVERIFY(mExecutable);
0044 }
0045 
0046 #include "moc_openurlwithconfigurecreatewidgettest.cpp"