File indexing completed on 2024-12-01 04:35:30
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 "videoconferencetest.h" 0008 #include "ruqola_autotest_helper.h" 0009 #include "videoconference/videoconference.h" 0010 0011 QTEST_GUILESS_MAIN(VideoConferenceTest) 0012 VideoConferenceTest::VideoConferenceTest(QObject *parent) 0013 : QObject{parent} 0014 { 0015 } 0016 0017 void VideoConferenceTest::shouldHaveDefaultValues() 0018 { 0019 VideoConference w; 0020 QVERIFY(w.callId().isEmpty()); 0021 QVERIFY(w.roomId().isEmpty()); 0022 QVERIFY(w.userId().isEmpty()); 0023 QVERIFY(!w.isValid()); 0024 } 0025 0026 void VideoConferenceTest::shouldExtractVideoConference() 0027 { 0028 QFETCH(QString, name); 0029 QFETCH(VideoConference, videoConference); 0030 const QString originalJsonFile = QLatin1String(RUQOLA_DATA_DIR) + QLatin1String("/videoconference/") + name + QLatin1String(".json"); 0031 const QJsonObject obj = AutoTestHelper::loadJsonObject(originalJsonFile); 0032 0033 VideoConference result; 0034 result.parseVideoConference(obj); 0035 const bool equal = result == videoConference; 0036 if (!equal) { 0037 qDebug() << " result " << result; 0038 qDebug() << " deviceInfo " << videoConference; 0039 } 0040 QVERIFY(equal); 0041 } 0042 0043 void VideoConferenceTest::shouldExtractVideoConference_data() 0044 { 0045 QTest::addColumn<QString>("name"); 0046 QTest::addColumn<VideoConference>("videoConference"); 0047 QTest::addRow("conferenceempty") << QStringLiteral("conferenceempty") << VideoConference(); 0048 { 0049 VideoConference conference; 0050 conference.setAction(VideoConference::IncomingCall); 0051 conference.setCallId(QStringLiteral("6398e61e29673367a61e6f23")); 0052 conference.setRoomId(QStringLiteral("YbwG4T2uB3wZSZSKBxkNpoB3T98EEPCj2K")); 0053 conference.setUserId(QStringLiteral("YbwG4T2uB3wZSZSKB")); 0054 QTest::addRow("call") << QStringLiteral("call") << conference; 0055 } 0056 { 0057 VideoConference conference; 0058 conference.setAction(VideoConference::Accepted); 0059 conference.setCallId(QStringLiteral("6398e79daa2274c5a48a02c2")); 0060 conference.setRoomId(QStringLiteral("YbwG4T2uB3wZSZSKBxkNpoB3T98EEPCj2K")); 0061 conference.setUserId(QStringLiteral("YbwG4T2uB3wZSZSKB")); 0062 QTest::addRow("accept") << QStringLiteral("accept") << conference; 0063 } 0064 { 0065 VideoConference conference; 0066 conference.setAction(VideoConference::Confirmed); 0067 conference.setCallId(QStringLiteral("6398e79daa2274c5a48a02c2")); 0068 conference.setRoomId(QStringLiteral("YbwG4T2uB3wZSZSKBxkNpoB3T98EEPCj2K")); 0069 conference.setUserId(QStringLiteral("xkNpoB3T98EEPCj2K")); 0070 QTest::addRow("confirmed") << QStringLiteral("confirmed") << conference; 0071 } 0072 { 0073 VideoConference conference; 0074 conference.setAction(VideoConference::Rejected); 0075 conference.setCallId(QStringLiteral("6398e888fc94d2587faae3c6")); 0076 conference.setRoomId(QStringLiteral("YbwG4T2uB3wZSZSKBxkNpoB3T98EEPCj2K")); 0077 conference.setUserId(QStringLiteral("YbwG4T2uB3wZSZSKB")); 0078 QTest::addRow("rejected") << QStringLiteral("rejected") << conference; 0079 } 0080 { 0081 VideoConference conference; 0082 conference.setAction(VideoConference::Canceled); 0083 conference.setCallId(QStringLiteral("6398e944aa2274c5a48a02ea")); 0084 conference.setRoomId(QStringLiteral("YbwG4T2uB3wZSZSKBxkNpoB3T98EEPCj2K")); 0085 conference.setUserId(QStringLiteral("YbwG4T2uB3wZSZSKB")); 0086 QTest::addRow("canceled") << QStringLiteral("canceled") << conference; 0087 } 0088 } 0089 0090 #include "moc_videoconferencetest.cpp"