File indexing completed on 2025-11-30 14:28:40

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "exploredatabasewidgettest.h"
0008 #include "databasedialog/exploredatabasewidget.h"
0009 #include "room/messagelistview.h"
0010 #include <QLabel>
0011 #include <QLineEdit>
0012 #include <QPushButton>
0013 #include <QTest>
0014 #include <QVBoxLayout>
0015 QTEST_MAIN(ExploreDatabaseWidgetTest)
0016 ExploreDatabaseWidgetTest::ExploreDatabaseWidgetTest(QObject *parent)
0017     : QObject{parent}
0018 {
0019 }
0020 
0021 void ExploreDatabaseWidgetTest::shouldHaveDefaultValues()
0022 {
0023     ExploreDatabaseWidget w(nullptr);
0024 
0025     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0026     QVERIFY(mainLayout);
0027     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0028 
0029     auto hboxLayout = w.findChild<QHBoxLayout *>(QStringLiteral("hboxLayout"));
0030     QVERIFY(hboxLayout);
0031     QCOMPARE(hboxLayout->contentsMargins(), QMargins{});
0032 
0033     auto mRoomName = w.findChild<QLineEdit *>(QStringLiteral("mRoomName"));
0034     QVERIFY(mRoomName);
0035     QVERIFY(mRoomName->isClearButtonEnabled());
0036     auto label = w.findChild<QLabel *>(QStringLiteral("label"));
0037     QVERIFY(label);
0038     QVERIFY(!label->text().isEmpty());
0039 
0040     auto pushButton = w.findChild<QPushButton *>(QStringLiteral("pushButton"));
0041     QVERIFY(pushButton);
0042     QVERIFY(!pushButton->text().isEmpty());
0043 
0044     auto mMessageListView = w.findChild<MessageListView *>(QStringLiteral("mMessageListView"));
0045     QVERIFY(mMessageListView);
0046 }
0047 
0048 #include "moc_exploredatabasewidgettest.cpp"