diff options
Diffstat (limited to 'qt4/tests')
-rw-r--r-- | qt4/tests/capabilities.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/qt4/tests/capabilities.cpp b/qt4/tests/capabilities.cpp index d7922aa3f..cb5beca7a 100644 --- a/qt4/tests/capabilities.cpp +++ b/qt4/tests/capabilities.cpp @@ -20,6 +20,7 @@ public: private Q_SLOTS: void testConnCapabilities(); + void testContactCapabilities(); }; TestCapabilities::TestCapabilities(QObject *parent) @@ -130,6 +131,73 @@ void TestCapabilities::testConnCapabilities() QCOMPARE(connCaps.allClassSpecs(), rccSpecs); } +void TestCapabilities::testContactCapabilities() +{ + ContactCapabilities contactCaps; + // capabilities base + QVERIFY(!contactCaps.isSpecificToContact()); + QVERIFY(!contactCaps.textChats()); + QVERIFY(!contactCaps.streamedMediaCalls()); + QVERIFY(!contactCaps.streamedMediaAudioCalls()); + QVERIFY(!contactCaps.streamedMediaVideoCalls()); + QVERIFY(!contactCaps.streamedMediaVideoCallsWithAudio()); + QVERIFY(!contactCaps.upgradingStreamedMediaCalls()); + QVERIFY(!contactCaps.fileTransfers()); + // contact caps specific + QVERIFY(!contactCaps.streamTubes(QLatin1String("foobar"))); + QVERIFY(!contactCaps.streamTubes(QLatin1String("service-foo"))); + QVERIFY(!contactCaps.streamTubes(QLatin1String("service-bar"))); + QVERIFY(contactCaps.streamTubeServices().isEmpty()); + + RequestableChannelClassSpecList rccSpecs; + rccSpecs.append(RequestableChannelClassSpec::textChat()); + rccSpecs.append(RequestableChannelClassSpec::streamedMediaCall()); + rccSpecs.append(RequestableChannelClassSpec::streamedMediaAudioCall()); + rccSpecs.append(RequestableChannelClassSpec::streamedMediaVideoCall()); + rccSpecs.append(RequestableChannelClassSpec::streamedMediaVideoCallWithAudio()); + rccSpecs.append(RequestableChannelClassSpec::fileTransfer()); + + contactCaps = TestBackdoors::createContactCapabilities(rccSpecs, true); + // capabilities base + QVERIFY(contactCaps.isSpecificToContact()); + QVERIFY(contactCaps.textChats()); + QVERIFY(contactCaps.streamedMediaCalls()); + QVERIFY(contactCaps.streamedMediaAudioCalls()); + QVERIFY(contactCaps.streamedMediaVideoCalls()); + QVERIFY(contactCaps.streamedMediaVideoCallsWithAudio()); + QVERIFY(contactCaps.fileTransfers()); + // contact caps specific + QVERIFY(!contactCaps.streamTubes(QLatin1String("foobar"))); + QVERIFY(!contactCaps.streamTubes(QLatin1String("service-foo"))); + QVERIFY(!contactCaps.streamTubes(QLatin1String("service-bar"))); + QVERIFY(contactCaps.streamTubeServices().isEmpty()); + QCOMPARE(contactCaps.allClassSpecs(), rccSpecs); + + rccSpecs.append(RequestableChannelClassSpec::streamTube(QLatin1String("service-foo"))); + rccSpecs.append(RequestableChannelClassSpec::streamTube(QLatin1String("service-bar"))); + + contactCaps = TestBackdoors::createContactCapabilities(rccSpecs, true); + // capabilities base + QVERIFY(contactCaps.isSpecificToContact()); + QVERIFY(contactCaps.textChats()); + QVERIFY(contactCaps.streamedMediaCalls()); + QVERIFY(contactCaps.streamedMediaAudioCalls()); + QVERIFY(contactCaps.streamedMediaVideoCalls()); + QVERIFY(contactCaps.streamedMediaVideoCallsWithAudio()); + QVERIFY(contactCaps.fileTransfers()); + // contact caps specific + QVERIFY(!contactCaps.streamTubes(QLatin1String("foobar"))); + QVERIFY(contactCaps.streamTubes(QLatin1String("service-foo"))); + QVERIFY(contactCaps.streamTubes(QLatin1String("service-bar"))); + QStringList stubeServices = contactCaps.streamTubeServices(); + stubeServices.sort(); + QStringList expectedSTubeServices; + expectedSTubeServices << QLatin1String("service-foo") << QLatin1String("service-bar"); + expectedSTubeServices.sort(); + QCOMPARE(stubeServices, expectedSTubeServices); + QCOMPARE(contactCaps.allClassSpecs(), rccSpecs); +} + QTEST_MAIN(TestCapabilities) #include "_gen/capabilities.cpp.moc.hpp" |