File indexing completed on 2024-12-08 04:34:08

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "ruqolacentralwidgettest.h"
0008 #include "ruqolacentralwidget.h"
0009 #if 0
0010 #include "servererrorinfohistory/servererrorinfomessagewidget.h"
0011 #endif
0012 #include "whatsnew/whatsnewmessagewidget.h"
0013 
0014 #include <QHBoxLayout>
0015 #include <QStackedWidget>
0016 #include <QStandardPaths>
0017 #include <QTest>
0018 
0019 QTEST_MAIN(RuqolaCentralWidgetTest)
0020 RuqolaCentralWidgetTest::RuqolaCentralWidgetTest(QObject *parent)
0021     : QObject(parent)
0022 {
0023     QStandardPaths::setTestModeEnabled(true);
0024 }
0025 
0026 void RuqolaCentralWidgetTest::shouldHaveDefaultValues()
0027 {
0028     RuqolaCentralWidget w;
0029     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
0030     QVERIFY(mainLayout);
0031     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0032 
0033     auto mStackedWidget = w.findChild<QStackedWidget *>(QStringLiteral("mStackedWidget"));
0034     QVERIFY(mStackedWidget);
0035 
0036 #if 0 // Create on demand => it will be nullptr
0037     auto mServerErrorInfoMessageWidget = w.findChild<ServerErrorInfoMessageWidget *>(QStringLiteral("mServerErrorInfoMessageWidget"));
0038     QVERIFY(mServerErrorInfoMessageWidget);
0039 #endif
0040     auto whatsNewMessageWidget = w.findChild<WhatsNewMessageWidget *>(QStringLiteral("whatsNewMessageWidget"));
0041     QVERIFY(whatsNewMessageWidget);
0042 }
0043 
0044 #include "moc_ruqolacentralwidgettest.cpp"