diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-09-09 11:04:52 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-09-11 21:53:44 (GMT) |
commit | 10d8ba50a9e09517cfe4a6d4c3d51a768e989125 (patch) | |
tree | 33e3fb87c07cdf26c91e8146335e41a167aa1bd6 /Swiften/Avatars/UnitTest | |
parent | 6f31cc8a329d15767d54511edd14339ac3dfdd7a (diff) | |
download | swift-10d8ba50a9e09517cfe4a6d4c3d51a768e989125.zip swift-10d8ba50a9e09517cfe4a6d4c3d51a768e989125.tar.bz2 |
Refactoring VCardUpdateAvatarManager.
Diffstat (limited to 'Swiften/Avatars/UnitTest')
-rw-r--r-- | Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp index 5a98a0e..3e8dbdf 100644 --- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp @@ -70,8 +70,8 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { stanzaChannel->onIQReceived(createVCardResult(avatar1)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size())); - CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0].first); - CPPUNIT_ASSERT_EQUAL(avatar1Hash, changes[0].second); + CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]); + CPPUNIT_ASSERT_EQUAL(avatar1Hash, testling->getAvatarHash(user1.toBare())); CPPUNIT_ASSERT(avatarStorage->hasAvatar(avatar1Hash)); CPPUNIT_ASSERT_EQUAL(avatar1, avatarStorage->getAvatar(avatar1Hash)); } @@ -100,8 +100,8 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size())); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size())); - CPPUNIT_ASSERT_EQUAL(user2.toBare(), changes[0].first); - CPPUNIT_ASSERT_EQUAL(avatar1Hash, changes[0].second); + CPPUNIT_ASSERT_EQUAL(user2.toBare(), changes[0]); + CPPUNIT_ASSERT_EQUAL(avatar1Hash, testling->getAvatarHash(user2.toBare())); } void testVCardWithEmptyPhoto() { @@ -110,7 +110,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { stanzaChannel->onIQReceived(createVCardResult(ByteArray())); CPPUNIT_ASSERT(!avatarStorage->hasAvatar(Hexify::hexify(SHA1::getHash(ByteArray())))); - CPPUNIT_ASSERT_EQUAL(boost::filesystem::path(), testling->getAvatarPath(JID("foo@bar.com"))); + CPPUNIT_ASSERT_EQUAL(String(), testling->getAvatarHash(JID("foo@bar.com"))); } void testStanzaChannelReset() { @@ -125,14 +125,14 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { 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); + CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]); + CPPUNIT_ASSERT_EQUAL(avatar1Hash, testling->getAvatarHash(user1.toBare())); } private: std::auto_ptr<VCardUpdateAvatarManager> createManager() { std::auto_ptr<VCardUpdateAvatarManager> result(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, mucRegistry)); - result->onAvatarChanged.connect(boost::bind(&VCardUpdateAvatarManagerTest::handleAvatarChanged, this, _1, _2)); + result->onAvatarChanged.connect(boost::bind(&VCardUpdateAvatarManagerTest::handleAvatarChanged, this, _1)); return result; } @@ -151,8 +151,8 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { return IQ::createResult(JID("baz@fum.com"), stanzaChannel->sentStanzas[0]->getID(), vcard); } - void handleAvatarChanged(const JID& jid, const String& hash) { - changes.push_back(std::pair<JID,String>(jid, hash)); + void handleAvatarChanged(const JID& jid) { + changes.push_back(jid); } private: @@ -170,7 +170,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { VCardMemoryStorage* vcardStorage; ByteArray avatar1; String avatar1Hash; - std::vector<std::pair<JID,String> > changes; + std::vector<JID> changes; JID user1; JID user2; }; |