File indexing completed on 2024-12-01 04:36:35

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 "ruqolamainwidgettest.h"
0008 #if 0
0009 #include "bannerinfodialog/bannermessagewidget.h"
0010 #endif
0011 #include "channellist/channellistwidget.h"
0012 #include "room/roomwidget.h"
0013 #include "ruqolamainwidget.h"
0014 
0015 #include <QHBoxLayout>
0016 #include <QSplitter>
0017 #include <QStandardPaths>
0018 #include <QTest>
0019 
0020 QTEST_MAIN(RuqolaMainWidgetTest)
0021 
0022 RuqolaMainWidgetTest::RuqolaMainWidgetTest(QObject *parent)
0023     : QObject(parent)
0024 {
0025     QStandardPaths::setTestModeEnabled(true);
0026 }
0027 
0028 void RuqolaMainWidgetTest::shouldHaveDefaultValues()
0029 {
0030     RuqolaMainWidget w;
0031     auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainlayout"));
0032     QVERIFY(mainLayout);
0033     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0034 
0035     auto topLayout = w.findChild<QVBoxLayout *>(QStringLiteral("topLayout"));
0036     QVERIFY(topLayout);
0037     QCOMPARE(topLayout->contentsMargins(), QMargins{});
0038 
0039     auto mSplitter = w.findChild<QSplitter *>(QStringLiteral("mSplitter"));
0040     QVERIFY(mSplitter);
0041     QVERIFY(!mSplitter->childrenCollapsible());
0042 
0043     auto mChannelList = w.findChild<ChannelListWidget *>(QStringLiteral("mChannelList"));
0044     QVERIFY(mChannelList);
0045 
0046     auto mStackedRoomWidget = w.findChild<QStackedWidget *>(QStringLiteral("mStackedRoomWidget"));
0047     QVERIFY(mStackedRoomWidget);
0048 
0049     auto mRoomWidget = w.findChild<RoomWidget *>(QStringLiteral("mRoomWidget"));
0050     QVERIFY(mRoomWidget);
0051     QVERIFY(mSplitter->indexOf(mChannelList) >= 0);
0052     QVERIFY(mSplitter->indexOf(mStackedRoomWidget) >= 0);
0053 
0054     auto mEmptyRoomWidget = w.findChild<QWidget *>(QStringLiteral("mEmptyRoomWidget"));
0055     QVERIFY(mEmptyRoomWidget);
0056     QCOMPARE(mStackedRoomWidget->currentWidget(), mEmptyRoomWidget);
0057 
0058 #if 0
0059     auto mBannerMessageWidget = w.findChild<BannerMessageWidget *>(QStringLiteral("mBannerMessageWidget"));
0060     QVERIFY(mBannerMessageWidget);
0061 #endif
0062 }
0063 
0064 #include "moc_ruqolamainwidgettest.cpp"