File indexing completed on 2024-12-22 04:45:34
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "administratorroomseditwidgettest.h" 0008 #include "administratordialog/rooms/administratorroomseditwidget.h" 0009 #include "dialogs/messagetexteditor.h" 0010 #include "dialogs/roomavatarwidget.h" 0011 #include <QCheckBox> 0012 #include <QFormLayout> 0013 #include <QLabel> 0014 #include <QLineEdit> 0015 #include <QTest> 0016 QTEST_MAIN(AdministratorRoomsEditWidgetTest) 0017 0018 AdministratorRoomsEditWidgetTest::AdministratorRoomsEditWidgetTest(QObject *parent) 0019 : QObject{parent} 0020 { 0021 } 0022 0023 void AdministratorRoomsEditWidgetTest::shouldHaveDefaultValues() 0024 { 0025 AdministratorRoomsEditWidget w; 0026 auto mainLayout = w.findChild<QFormLayout *>(QStringLiteral("mainLayout")); 0027 QVERIFY(mainLayout); 0028 0029 auto mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("mLineEdit")); 0030 QVERIFY(mLineEdit); 0031 QVERIFY(mLineEdit->text().isEmpty()); 0032 0033 auto mOwnerName = w.findChild<QLabel *>(QStringLiteral("mOwnerName")); 0034 QVERIFY(mOwnerName); 0035 QVERIFY(mOwnerName->text().isEmpty()); 0036 0037 auto mDefaultCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mDefaultCheckBox")); 0038 QVERIFY(mDefaultCheckBox); 0039 QVERIFY(!mDefaultCheckBox->isChecked()); 0040 QVERIFY(!mDefaultCheckBox->text().isEmpty()); 0041 0042 auto mFavoriteCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mFavoriteCheckBox")); 0043 QVERIFY(mFavoriteCheckBox); 0044 QVERIFY(!mFavoriteCheckBox->isChecked()); 0045 QVERIFY(!mFavoriteCheckBox->text().isEmpty()); 0046 0047 auto mFeaturedCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mFeaturedCheckBox")); 0048 QVERIFY(mFeaturedCheckBox); 0049 QVERIFY(!mFeaturedCheckBox->isChecked()); 0050 QVERIFY(!mFeaturedCheckBox->text().isEmpty()); 0051 0052 auto mPrivateCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mPrivateCheckBox")); 0053 QVERIFY(mPrivateCheckBox); 0054 QVERIFY(!mPrivateCheckBox->isChecked()); 0055 QVERIFY(!mPrivateCheckBox->text().isEmpty()); 0056 0057 auto mReadOnlyCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mReadOnlyCheckBox")); 0058 QVERIFY(mReadOnlyCheckBox); 0059 QVERIFY(!mReadOnlyCheckBox->isChecked()); 0060 QVERIFY(!mReadOnlyCheckBox->text().isEmpty()); 0061 0062 auto mArchivedCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mArchivedCheckBox")); 0063 QVERIFY(mArchivedCheckBox); 0064 QVERIFY(!mArchivedCheckBox->isChecked()); 0065 QVERIFY(!mArchivedCheckBox->text().isEmpty()); 0066 0067 auto mComment = w.findChild<MessageTextEditor *>(QStringLiteral("mComment")); 0068 QVERIFY(mComment); 0069 0070 auto mAnnouncement = w.findChild<MessageTextEditor *>(QStringLiteral("mAnnouncement")); 0071 QVERIFY(mAnnouncement); 0072 0073 auto mDescription = w.findChild<MessageTextEditor *>(QStringLiteral("mDescription")); 0074 QVERIFY(mDescription); 0075 0076 auto mRoomAvatarWidget = w.findChild<RoomAvatarWidget *>(QStringLiteral("mRoomAvatarWidget")); 0077 QVERIFY(mRoomAvatarWidget); 0078 } 0079 0080 #include "moc_administratorroomseditwidgettest.cpp"