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

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "createnewservercheckurlwidgettest.h"
0008 #include "createnewserver/createnewservercheckurlwidget.h"
0009 #include <KBusyIndicatorWidget>
0010 #include <KMessageWidget>
0011 #include <QHBoxLayout>
0012 #include <QLabel>
0013 #include <QLineEdit>
0014 #include <QTest>
0015 #include <QVBoxLayout>
0016 QTEST_MAIN(CreateNewServerCheckUrlWidgetTest)
0017 
0018 CreateNewServerCheckUrlWidgetTest::CreateNewServerCheckUrlWidgetTest(QObject *parent)
0019     : QObject{parent}
0020 {
0021 }
0022 
0023 void CreateNewServerCheckUrlWidgetTest::shouldHaveDefaultValues()
0024 {
0025     CreateNewServerCheckUrlWidget w;
0026 
0027     auto topLayout = w.findChild<QVBoxLayout *>(QStringLiteral("topLayout"));
0028     QVERIFY(topLayout);
0029     QCOMPARE(topLayout->contentsMargins(), QMargins{});
0030 
0031     auto serverUrlLayout = w.findChild<QHBoxLayout *>(QStringLiteral("serverUrlLayout"));
0032     QVERIFY(serverUrlLayout);
0033     QCOMPARE(serverUrlLayout->contentsMargins(), QMargins{});
0034 
0035     auto label = w.findChild<QLabel *>(QStringLiteral("label"));
0036     QVERIFY(!label->text().isEmpty());
0037 
0038     auto mServerUrl = w.findChild<QLineEdit *>(QStringLiteral("mServerUrl"));
0039     QVERIFY(mServerUrl->text().isEmpty());
0040 
0041     auto mBusyIndicatorWidget = w.findChild<KBusyIndicatorWidget *>(QStringLiteral("mBusyIndicatorWidget"));
0042     QVERIFY(mBusyIndicatorWidget);
0043 
0044     auto mFailedError = w.findChild<KMessageWidget *>(QStringLiteral("mFailedError"));
0045     QVERIFY(mFailedError);
0046     QCOMPARE(mFailedError->messageType(), KMessageWidget::Error);
0047 }
0048 
0049 #include "moc_createnewservercheckurlwidgettest.cpp"