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

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #include "directorytabwidgettest.h"
0007 #include "directory/directorystackedwidget.h"
0008 #include "directory/directorytabwidget.h"
0009 #include "directory/directorywidget.h"
0010 #include <QTest>
0011 QTEST_MAIN(DirectoryTabWidgetTest)
0012 DirectoryTabWidgetTest::DirectoryTabWidgetTest(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 void DirectoryTabWidgetTest::shouldHaveDefaultValues()
0018 {
0019     DirectoryTabWidget w(nullptr);
0020     QCOMPARE(w.count(), 3);
0021 
0022     auto tab = qobject_cast<DirectoryStackedWidget *>(w.widget(0));
0023     QCOMPARE(tab->objectName(), QStringLiteral("mRooms"));
0024     QCOMPARE(tab->directoryWidget()->type(), DirectoryWidget::Room);
0025     QVERIFY(tab);
0026 
0027     tab = qobject_cast<DirectoryStackedWidget *>(w.widget(1));
0028     QCOMPARE(tab->objectName(), QStringLiteral("mUsers"));
0029     QCOMPARE(tab->directoryWidget()->type(), DirectoryWidget::User);
0030     QVERIFY(tab);
0031 
0032     tab = qobject_cast<DirectoryStackedWidget *>(w.widget(2));
0033     QCOMPARE(tab->objectName(), QStringLiteral("mTeams"));
0034     QCOMPARE(tab->directoryWidget()->type(), DirectoryWidget::Team);
0035     QVERIFY(tab);
0036 }
0037 
0038 #include "moc_directorytabwidgettest.cpp"