aboutsummaryrefslogtreecommitdiff
path: root/autotests/callcandidateseventtest.cpp
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-01-21 19:16:31 +0100
committerCarl Schwan <carl@carlschwan.eu>2021-01-21 19:21:45 +0100
commita9987b1bc7f789f3063c06ed23e1f51024341463 (patch)
tree18a0e86760df67ec7fdd1d9c9b57efc872469a29 /autotests/callcandidateseventtest.cpp
parent0368242c543d388b789eb02f22552128e3b14c18 (diff)
downloadlibquotient-a9987b1bc7f789f3063c06ed23e1f51024341463.tar.gz
libquotient-a9987b1bc7f789f3063c06ed23e1f51024341463.zip
Move tests
Diffstat (limited to 'autotests/callcandidateseventtest.cpp')
-rw-r--r--autotests/callcandidateseventtest.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/autotests/callcandidateseventtest.cpp b/autotests/callcandidateseventtest.cpp
new file mode 100644
index 00000000..ca908db3
--- /dev/null
+++ b/autotests/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 document = 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(document.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"