diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2011-09-28 20:40:01 -0300 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2011-09-30 10:49:48 -0300 |
commit | ccda3cffd7f5a1df7b906a9e07ba5fde1c4d619c (patch) | |
tree | 8040fd6cacad3ed97f16bdcf649b6e7268a1b3bf /qt4/tests | |
parent | a1b652dcd9b009dfe877fba0211ca1bcaad8ab6a (diff) |
capabilities test: Add ContactCapabilities specific tests.
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" |