diff options
author | Carl Schwan <carl@carlschwan.eu> | 2021-01-10 23:26:57 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2021-01-21 19:21:44 +0100 |
commit | 17e62b85cae99d8485be44f90f0622e4ba843fa0 (patch) | |
tree | 7a735b87b7570e84669de48482c1ec30a728dbbf /tests | |
parent | 9fb2970eadf810f7ae38389b333b543c22fb8be7 (diff) | |
download | libquotient-17e62b85cae99d8485be44f90f0622e4ba843fa0.tar.gz libquotient-17e62b85cae99d8485be44f90f0622e4ba843fa0.zip |
Add more properties to CallCandidateEvent
Diffstat (limited to 'tests')
-rw-r--r-- | tests/callcandidateseventtest.cpp | 47 | ||||
-rw-r--r-- | tests/callcandidateseventtest.h | 13 |
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/callcandidateseventtest.cpp b/tests/callcandidateseventtest.cpp new file mode 100644 index 00000000..27108fdd --- /dev/null +++ b/tests/callcandidateseventtest.cpp @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2020 Carl Schwan <carlschwan@kde.org> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include "events/callcandidatesevent.h" +#include "callcandidateseventtest.h" + +void TestCallCandidatesEvent::fromJson() +{ + auto documemt = QJsonDocument::fromJson(R"({ + "age": 242352, + "content": { + "call_id": "12345", + "candidates": [ + { + "candidate": "candidate:863018703 1 udp 2122260223 10.9.64.156 43670 typ host generation 0", + "sdpMLineIndex": 0, + "sdpMid": "audio" + } + ], + "version": 0 + }, + "event_id": "$WLGTSEFSEF:localhost", + "origin_server_ts": 1431961217939, + "room_id": "!Cuyf34gef24t:localhost", + "sender": "@example:localhost", + "type": "m.call.candidates" + })"); + + QVERIFY(documemt.isObject()); + + auto object = documemt.object(); + + Quotient::CallCandidatesEvent callCandidatesEvent(object); + + QCOMPARE(callCandidatesEvent.version(), 0); + QCOMPARE(callCandidatesEvent.callId(), "12345"); + QCOMPARE(callCandidatesEvent.candidates().count(), 1); + + const QJsonObject &candidate = callCandidatesEvent.candidates().at(0).toObject(); + QCOMPARE(candidate.value("sdpMid").toString(), "audio"); + QCOMPARE(candidate.value("sdpMLineIndex").toInt(), 0); + QCOMPARE(candidate.value("candidate").toString(), "candidate:863018703 1 udp 2122260223 10.9.64.156 43670 typ host generation 0"); +} + +QTEST_MAIN(TestCallCandidatesEvent) +#include "callcandidateseventtest.moc" diff --git a/tests/callcandidateseventtest.h b/tests/callcandidateseventtest.h new file mode 100644 index 00000000..b81c9c9b --- /dev/null +++ b/tests/callcandidateseventtest.h @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: 2020 Carl Schwan <carlschwan@kde.org> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include <QtTest/QtTest> + +class TestCallCandidatesEvent : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void fromJson(); +}; |