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

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 "administratorroomswidgettest.h"
0008 #include "administratordialog/rooms/administratorroomsselectroomtypewidget.h"
0009 #include "administratordialog/rooms/administratorroomswidget.h"
0010 #include <QLineEdit>
0011 #include <QTest>
0012 #include <QTreeView>
0013 #include <QVBoxLayout>
0014 QTEST_MAIN(AdministratorRoomsWidgetTest)
0015 AdministratorRoomsWidgetTest::AdministratorRoomsWidgetTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 void AdministratorRoomsWidgetTest::shouldHaveDefaultValues()
0021 {
0022     AdministratorRoomsWidget w(nullptr);
0023     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0024     QVERIFY(mainLayout);
0025 
0026     auto mSearchLineEdit = w.findChild<QLineEdit *>(QStringLiteral("mSearchLineEdit"));
0027     QVERIFY(mSearchLineEdit);
0028     QVERIFY(mSearchLineEdit->isClearButtonEnabled());
0029 
0030     auto mTreeView = w.findChild<QTreeView *>(QStringLiteral("mTreeView"));
0031     QVERIFY(mTreeView);
0032     QVERIFY(mTreeView->isSortingEnabled());
0033     QCOMPARE(mTreeView->selectionMode(), QAbstractItemView::SelectionMode::SingleSelection);
0034     QVERIFY(!mTreeView->rootIsDecorated());
0035 
0036     auto mSelectRoomType = w.findChild<AdministratorRoomsSelectRoomTypeWidget *>(QStringLiteral("mSelectRoomType"));
0037     QVERIFY(mSelectRoomType);
0038 }
0039 
0040 #include "moc_administratorroomswidgettest.cpp"