diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-24 09:04:21 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-24 09:04:21 (GMT) |
commit | 6b4bdb629ead79141b20ca72b8634136d351966d (patch) | |
tree | 4b1ff747c57bb2e7cdf9f8559e15f5ccbe009a1e /Swiften/Avatars/UnitTest | |
parent | 4061c75765c2aa1e96d79711baaa735996007cc6 (diff) | |
download | swift-6b4bdb629ead79141b20ca72b8634136d351966d.zip swift-6b4bdb629ead79141b20ca72b8634136d351966d.tar.bz2 |
Clear VCardUpdate avatar hash on stream reset.
Resolves: #554
Release-Notes: Fixed a bug where avatars would no longer appear after
reconnecting.
Diffstat (limited to 'Swiften/Avatars/UnitTest')
-rw-r--r-- | Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp index 3e8dbdf..054853d 100644 --- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp @@ -28,7 +28,8 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { CPPUNIT_TEST(testUpdate_KnownHash); CPPUNIT_TEST(testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification); CPPUNIT_TEST(testVCardWithEmptyPhoto); - CPPUNIT_TEST(testStanzaChannelReset); + CPPUNIT_TEST(testStanzaChannelReset_ClearsHash); + CPPUNIT_TEST(testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash); CPPUNIT_TEST_SUITE_END(); public: @@ -113,7 +114,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(String(), testling->getAvatarHash(JID("foo@bar.com"))); } - void testStanzaChannelReset() { + void testStanzaChannelReset_ClearsHash() { std::auto_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); @@ -122,10 +123,25 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { 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]); + CPPUNIT_ASSERT_EQUAL(String(""), testling->getAvatarHash(user1.toBare())); + } + + void testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash() { + std::auto_ptr<VCardUpdateAvatarManager> testling = createManager(); + stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); + stanzaChannel->onIQReceived(createVCardResult(avatar1)); + changes.clear(); + stanzaChannel->sentStanzas.clear(); + + stanzaChannel->setAvailable(false); + stanzaChannel->setAvailable(true); + stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); + + CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(changes.size())); + CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[1]); CPPUNIT_ASSERT_EQUAL(avatar1Hash, testling->getAvatarHash(user1.toBare())); } |