diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-09-05 11:29:34 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-09-05 12:45:52 (GMT) |
commit | c9ab4b6c41eef3ccfe6627f62e7bc085c6743a41 (patch) | |
tree | d29d63b3100061e4ef54ce3310eb7658996a8a3e /Swiften/Avatars/UnitTest | |
parent | 0630c01cf274a9de6b67856b8c00b1503b39353e (diff) | |
download | swift-contrib-c9ab4b6c41eef3ccfe6627f62e7bc085c6743a41.zip swift-contrib-c9ab4b6c41eef3ccfe6627f62e7bc085c6743a41.tar.bz2 |
Clear VCardUpdateManager's cache upon login.
Resolves: #554
Diffstat (limited to 'Swiften/Avatars/UnitTest')
-rw-r--r-- | Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp index e3d9c58..ce100ee 100644 --- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp @@ -27,22 +27,14 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { CPPUNIT_TEST(testUpdate_NewHashStoresAvatarAndEmitsNotificationOnVCardReceive); CPPUNIT_TEST(testUpdate_KnownHash); CPPUNIT_TEST(testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification); - /*& - CPPUNIT_TEST(testUpdate_UpdateNewHashAlreadyHaveAvatar); - CPPUNIT_TEST(testUpdate_UpdateNewHashFromMUC); - CPPUNIT_TEST(testUpdate_UpdateSameHash);*/ - //CPPUNIT_TEST(testUpdate_UpdateWithError); - /* - CPPUNIT_TEST(testUpdate_UpdateNewHashSameThanOtherUser); - CPPUNIT_TEST(testReceiveVCard); - CPPUNIT_TEST(testGetAvatarPath); - CPPUNIT_TEST(testGetAvatarPathFromMUC);*/ + CPPUNIT_TEST(testStanzaChannelReset); CPPUNIT_TEST_SUITE_END(); public: void setUp() { ownJID = JID("foo@fum.com/bum"); stanzaChannel = new DummyStanzaChannel(); + stanzaChannel->setAvailable(true); iqRouter = new IQRouter(stanzaChannel); mucRegistry = new DummyMUCRegistry(); avatarStorage = new AvatarMemoryStorage(); @@ -111,22 +103,21 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(avatar1Hash, changes[0].second); } -/* - void testUpdate_UpdateNewHashFromMUC() { + void testStanzaChannelReset() { std::auto_ptr<VCardUpdateAvatarManager> testling = createManager(); - } - - */ - - /*void testUpdate_UpdateWithError() { - std::auto_ptr<VCardUpdateAvatarManager> testling = createManager(); - boost::shared_ptr<Presence> update = createPresenceWithPhotoHash(); - update->addPayload(boost::shared_ptr<ErrorPayload>(new ErrorPayload())); - stanzaChannel_->onPresenceReceived(update); + stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); + stanzaChannel->onIQReceived(createVCardResult(avatar1)); + changes.clear(); + stanzaChannel->sentStanzas.clear(); - CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel_->sentStanzas.size())); - }*/ + stanzaChannel->setAvailable(false); + stanzaChannel->setAvailable(true); + stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size())); + CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0].first); + CPPUNIT_ASSERT_EQUAL(avatar1Hash, changes[0].second); + } private: std::auto_ptr<VCardUpdateAvatarManager> createManager() { |