File indexing completed on 2024-12-22 04:45:42
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "videoconferencewidgettest.h" 0008 #include "administratorsettingsdialog/videoconference/videoconferencewidget.h" 0009 #include "settingswidgetshelper.h" 0010 #include <QCheckBox> 0011 #include <QLabel> 0012 #include <QLineEdit> 0013 QTEST_MAIN(VideoConferenceWidgetTest) 0014 VideoConferenceWidgetTest::VideoConferenceWidgetTest(QObject *parent) 0015 : QObject{parent} 0016 { 0017 } 0018 0019 void VideoConferenceWidgetTest::shouldHaveDefaultValues() 0020 { 0021 VideoConferenceWidget w(nullptr); 0022 auto bigBlueButtonLabel = w.findChild<QLabel *>(QStringLiteral("bigBlueButtonLabel")); 0023 QVERIFY(bigBlueButtonLabel); 0024 QVERIFY(!bigBlueButtonLabel->text().isEmpty()); 0025 0026 auto mBigBlueEnabled = w.findChild<QCheckBox *>(QStringLiteral("mBigBlueEnabled")); 0027 QVERIFY(mBigBlueEnabled); 0028 QVERIFY(!mBigBlueEnabled->isChecked()); 0029 QVERIFY(!mBigBlueEnabled->text().isEmpty()); 0030 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mBigBlueEnabled), QStringLiteral("bigbluebutton_Enabled")); 0031 0032 auto mServer = w.findChild<QLineEdit *>(QStringLiteral("mServer")); 0033 QVERIFY(mServer); 0034 QVERIFY(mServer->text().isEmpty()); 0035 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mServer), QStringLiteral("bigbluebutton_server")); 0036 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("bigbluebutton_server")); 0037 0038 auto mSharedSecret = w.findChild<QLineEdit *>(QStringLiteral("mSharedSecret")); 0039 QVERIFY(mSharedSecret); 0040 QVERIFY(mSharedSecret->text().isEmpty()); 0041 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mSharedSecret), QStringLiteral("bigbluebutton_sharedSecret")); 0042 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("bigbluebutton_sharedSecret")); 0043 0044 auto mAlwaysOpenNewWindow = w.findChild<QCheckBox *>(QStringLiteral("mAlwaysOpenNewWindow")); 0045 QVERIFY(mAlwaysOpenNewWindow); 0046 QVERIFY(!mAlwaysOpenNewWindow->isChecked()); 0047 QVERIFY(!mAlwaysOpenNewWindow->text().isEmpty()); 0048 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mAlwaysOpenNewWindow), QStringLiteral("bigbluebutton_Open_New_Window")); 0049 0050 auto mJitsiEnabled = w.findChild<QCheckBox *>(QStringLiteral("mJitsiEnabled")); 0051 QVERIFY(mJitsiEnabled); 0052 QVERIFY(!mJitsiEnabled->isChecked()); 0053 QVERIFY(!mJitsiEnabled->text().isEmpty()); 0054 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiEnabled), QStringLiteral("Jitsi_Enabled")); 0055 0056 auto mJitsiDomain = w.findChild<QLineEdit *>(QStringLiteral("mJitsiDomain")); 0057 QVERIFY(mJitsiDomain); 0058 QVERIFY(mJitsiDomain->text().isEmpty()); 0059 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiDomain), QStringLiteral("Jitsi_Domain")); 0060 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("Jitsi_Domain")); 0061 0062 auto mJitsiRoomPrefix = w.findChild<QLineEdit *>(QStringLiteral("mJitsiRoomPrefix")); 0063 QVERIFY(mJitsiRoomPrefix); 0064 QVERIFY(mJitsiRoomPrefix->text().isEmpty()); 0065 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiRoomPrefix), QStringLiteral("Jitsi_URL_Room_Prefix")); 0066 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("Jitsi_URL_Room_Prefix")); 0067 0068 auto mJitsiRoomSuffix = w.findChild<QLineEdit *>(QStringLiteral("mJitsiRoomSuffix")); 0069 QVERIFY(mJitsiRoomSuffix); 0070 QVERIFY(mJitsiRoomSuffix->text().isEmpty()); 0071 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiRoomSuffix), QStringLiteral("Jitsi_URL_Room_Suffix")); 0072 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("Jitsi_URL_Room_Suffix")); 0073 0074 auto mEnableRoomNameHash = w.findChild<QCheckBox *>(QStringLiteral("mJitsiEnableRoomNameHash")); 0075 QVERIFY(mEnableRoomNameHash); 0076 QVERIFY(!mEnableRoomNameHash->isChecked()); 0077 QVERIFY(!mEnableRoomNameHash->text().isEmpty()); 0078 QVERIFY(!mEnableRoomNameHash->toolTip().isEmpty()); 0079 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mEnableRoomNameHash), QStringLiteral("Jitsi_URL_Room_Hash")); 0080 0081 auto mJitsiUseSSL = w.findChild<QCheckBox *>(QStringLiteral("mJitsiUseSSL")); 0082 QVERIFY(mJitsiUseSSL); 0083 QVERIFY(!mJitsiUseSSL->isChecked()); 0084 QVERIFY(!mJitsiUseSSL->text().isEmpty()); 0085 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiUseSSL), QStringLiteral("Jitsi_SSL")); 0086 0087 auto mJitsiAlwaysOpenNewWindow = w.findChild<QCheckBox *>(QStringLiteral("mJitsiAlwaysOpenNewWindow")); 0088 QVERIFY(mJitsiAlwaysOpenNewWindow); 0089 QVERIFY(!mJitsiAlwaysOpenNewWindow->isChecked()); 0090 QVERIFY(!mJitsiAlwaysOpenNewWindow->text().isEmpty()); 0091 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiAlwaysOpenNewWindow), QStringLiteral("Jitsi_Open_New_Window")); 0092 0093 auto mJitsiEnableInChannels = w.findChild<QCheckBox *>(QStringLiteral("mJitsiEnableInChannels")); 0094 QVERIFY(mJitsiEnableInChannels); 0095 QVERIFY(!mJitsiEnableInChannels->isChecked()); 0096 QVERIFY(!mJitsiEnableInChannels->text().isEmpty()); 0097 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiEnableInChannels), QStringLiteral("Jitsi_Enable_Channels")); 0098 0099 auto mJitsiEnableTeams = w.findChild<QCheckBox *>(QStringLiteral("mJitsiEnableTeams")); 0100 QVERIFY(mJitsiEnableTeams); 0101 QVERIFY(!mJitsiEnableTeams->isChecked()); 0102 QVERIFY(!mJitsiEnableTeams->text().isEmpty()); 0103 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiEnableTeams), QStringLiteral("Jitsi_Enable_Teams")); 0104 0105 auto mJitsiChromeExtensionId = w.findChild<QLineEdit *>(QStringLiteral("mJitsiChromeExtensionId")); 0106 QVERIFY(mJitsiChromeExtensionId); 0107 QVERIFY(mJitsiChromeExtensionId->text().isEmpty()); 0108 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiChromeExtensionId), QStringLiteral("Jitsi_Chrome_Extension")); 0109 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("Jitsi_Chrome_Extension")); 0110 0111 auto mJitsiEnableJWTAuth = w.findChild<QCheckBox *>(QStringLiteral("mJitsiEnableJWTAuth")); 0112 QVERIFY(mJitsiEnableJWTAuth); 0113 QVERIFY(!mJitsiEnableJWTAuth->isChecked()); 0114 QVERIFY(!mJitsiEnableJWTAuth->text().isEmpty()); 0115 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiEnableJWTAuth), QStringLiteral("Jitsi_Enabled_TokenAuth")); 0116 0117 auto mJitsiApplicationID = w.findChild<QLineEdit *>(QStringLiteral("mJitsiApplicationID")); 0118 QVERIFY(mJitsiApplicationID); 0119 QVERIFY(mJitsiApplicationID->text().isEmpty()); 0120 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiApplicationID), QStringLiteral("Jitsi_Application_ID")); 0121 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("Jitsi_Application_ID")); 0122 0123 auto mJitsiApplicationSecret = w.findChild<QLineEdit *>(QStringLiteral("mJitsiApplicationSecret")); 0124 QVERIFY(mJitsiApplicationSecret); 0125 QVERIFY(mJitsiApplicationSecret->text().isEmpty()); 0126 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiApplicationSecret), QStringLiteral("Jitsi_Application_Secret")); 0127 SettingsWidgetHelper::checkLabelToolButton(&w, QStringLiteral("Jitsi_Application_Secret")); 0128 0129 auto mJitsiLimitTokenJitsiRoom = w.findChild<QCheckBox *>(QStringLiteral("mJitsiLimitTokenJitsiRoom")); 0130 QVERIFY(mJitsiLimitTokenJitsiRoom); 0131 QVERIFY(!mJitsiLimitTokenJitsiRoom->isChecked()); 0132 QVERIFY(!mJitsiLimitTokenJitsiRoom->text().isEmpty()); 0133 QCOMPARE(SettingsWidgetHelper::widgetSettingsName(mJitsiLimitTokenJitsiRoom), QStringLiteral("Jitsi_Limit_Token_To_Room")); 0134 } 0135 0136 #include "moc_videoconferencewidgettest.cpp"