diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-21 18:28:53 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-21 18:30:46 (GMT) |
commit | e019b91aa2326795fa51a876e365573355576842 (patch) | |
tree | e66ed4b836096e2f9a8c43902fede6738900d6dd /Swiften | |
parent | 7fd66adfe9f3a92cd55e70b7478432d1f9030c4b (diff) | |
download | swift-e019b91aa2326795fa51a876e365573355576842.zip swift-e019b91aa2326795fa51a876e365573355576842.tar.bz2 |
Fixed a few avatar unit tests.
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Avatars/UnitTest/AvatarManagerTest.cpp | 10 | ||||
-rw-r--r-- | Swiften/Client/DummyStanzaChannel.h | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp index 511bd12..f954aa1 100644 --- a/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/AvatarManagerTest.cpp @@ -51,15 +51,17 @@ class AvatarManagerTest : public CppUnit::TestFixture { stanzaChannel_->onPresenceReceived(createPresenceWithPhotoHash()); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(stanzaChannel_->sentStanzas.size())); - // TODO - //CPPUNIT_ASSERT(stanzaChannel_->isRequestAtIndex<VCardUpdate>(0, JID("foo@bar.com"), IQ::Get)); + CPPUNIT_ASSERT(stanzaChannel_->isRequestAtIndex<VCard>(0, JID("foo@bar.com"), IQ::Get)); } -/* void testUpdate_UpdateNewHashAlreadyHaveAvatar() { + avatarStorage_->addAvatar("aef56135bcce35eb24a43fcd684005b4ca286497", ByteArray("ghij")); std::auto_ptr<AvatarManager> testling = createManager(); - } + stanzaChannel_->onPresenceReceived(createPresenceWithPhotoHash()); + CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel_->sentStanzas.size())); + } +/* void testUpdate_UpdateNewHashFromMUC() { std::auto_ptr<AvatarManager> testling = createManager(); } diff --git a/Swiften/Client/DummyStanzaChannel.h b/Swiften/Client/DummyStanzaChannel.h index d7aa752..b35ed92 100644 --- a/Swiften/Client/DummyStanzaChannel.h +++ b/Swiften/Client/DummyStanzaChannel.h @@ -39,6 +39,11 @@ namespace Swift { return true; } + template<typename T> bool isRequestAtIndex(int index, const JID& jid, IQ::Type type) { + boost::shared_ptr<IQ> iqStanza = boost::dynamic_pointer_cast<IQ>(sentStanzas[index]); + return iqStanza && iqStanza->getType() == type && iqStanza->getTo() == jid && iqStanza->getPayload<T>(); + } + std::vector<boost::shared_ptr<Stanza> > sentStanzas; }; } |