File indexing completed on 2024-06-09 04:59:04
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 "configurenotificationwidgettest.h" 0008 #include "dialogs/configurenotificationwidget.h" 0009 #include <QCheckBox> 0010 #include <QComboBox> 0011 #include <QFormLayout> 0012 #include <QGroupBox> 0013 #include <QTest> 0014 #include <QVBoxLayout> 0015 QTEST_MAIN(ConfigureNotificationWidgetTest) 0016 ConfigureNotificationWidgetTest::ConfigureNotificationWidgetTest(QObject *parent) 0017 : QObject(parent) 0018 { 0019 } 0020 0021 void ConfigureNotificationWidgetTest::shouldHaveDefaultValues() 0022 { 0023 ConfigureNotificationWidget w(nullptr); 0024 QVERIFY(!w.room()); 0025 auto topLayout = w.findChild<QVBoxLayout *>(QStringLiteral("topLayout")); 0026 QVERIFY(topLayout); 0027 QCOMPARE(topLayout->contentsMargins(), QMargins{}); 0028 0029 #if 0 // Failed. Don't know why . FIXME 0030 auto mDisableNotification = topLayout->findChild<QCheckBox *>(QStringLiteral("mDisableNotification")); 0031 QVERIFY(mDisableNotification); 0032 0033 auto mHideUnreadRoomStatus = topLayout->findChild<QCheckBox *>(QStringLiteral("mHideUnreadRoomStatus")); 0034 QVERIFY(mHideUnreadRoomStatus); 0035 0036 auto mMuteGroupMentions = topLayout->findChild<QCheckBox *>(QStringLiteral("mMuteGroupMentions")); 0037 QVERIFY(mMuteGroupMentions); 0038 0039 auto desktopGroupBox = topLayout->findChild<QGroupBox *>(QStringLiteral("desktopGroupBox")); 0040 QVERIFY(desktopGroupBox); 0041 QVERIFY(!desktopGroupBox->title().isEmpty()); 0042 0043 auto desktopGroupBoxLayout = desktopGroupBox->findChild<QFormLayout *>(QStringLiteral("desktopGroupBoxLayout")); 0044 QVERIFY(desktopGroupBoxLayout); 0045 0046 auto mDesktopAlertCombobox = topLayout->findChild<QComboBox *>(QStringLiteral("mDesktopAlertCombobox")); 0047 QVERIFY(mDesktopAlertCombobox); 0048 0049 auto mDesktopAudioCombobox = topLayout->findChild<QComboBox *>(QStringLiteral("mDesktopAudioCombobox")); 0050 QVERIFY(mDesktopAudioCombobox); 0051 0052 auto mDesktopSoundCombobox = topLayout->findChild<QComboBox *>(QStringLiteral("mDesktopSoundCombobox")); 0053 QVERIFY(mDesktopSoundCombobox); 0054 0055 auto mobileGroupBox = topLayout->findChild<QGroupBox *>(QStringLiteral("mobileGroupBox")); 0056 QVERIFY(mobileGroupBox); 0057 QVERIFY(!mobileGroupBox->title().isEmpty()); 0058 0059 auto mobileGroupBoxLayout = mobileGroupBox->findChild<QFormLayout *>(QStringLiteral("mobileGroupBoxLayout")); 0060 QVERIFY(mobileGroupBoxLayout); 0061 0062 auto mMobileAlertCombobox = topLayout->findChild<QComboBox *>(QStringLiteral("mMobileAlertCombobox")); 0063 QVERIFY(mMobileAlertCombobox); 0064 0065 auto emailGroupBox = topLayout->findChild<QGroupBox *>(QStringLiteral("emailGroupBox")); 0066 QVERIFY(emailGroupBox); 0067 QVERIFY(!emailGroupBox->title().isEmpty()); 0068 0069 auto emailGroupBoxLayout = emailGroupBox->findChild<QFormLayout *>(QStringLiteral("emailGroupBoxLayout")); 0070 QVERIFY(emailGroupBoxLayout); 0071 0072 auto mEmailAlertCombobox = topLayout->findChild<QComboBox *>(QStringLiteral("mEmailAlertCombobox")); 0073 QVERIFY(mEmailAlertCombobox); 0074 #endif 0075 } 0076 0077 #include "moc_configurenotificationwidgettest.cpp"