diff options
Diffstat (limited to 'Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp')
-rw-r--r-- | Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp index 7db9c95..81dc12c 100644 --- a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp @@ -4,22 +4,23 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Base/ByteArray.h" +#include <Swiften/Base/ByteArray.h> +#include <QA/Checker/IO.h> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <boost/bind.hpp> -#include "Swiften/Elements/VCard.h" -#include "Swiften/Avatars/VCardAvatarManager.h" -#include "Swiften/Avatars/AvatarMemoryStorage.h" -#include "Swiften/VCards/VCardManager.h" -#include "Swiften/VCards/VCardStorage.h" -#include "Swiften/MUC/MUCRegistry.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Client/DummyStanzaChannel.h" -#include "Swiften/StringCodecs/SHA1.h" -#include "Swiften/StringCodecs/Hexify.h" +#include <Swiften/Elements/VCard.h> +#include <Swiften/Avatars/VCardAvatarManager.h> +#include <Swiften/Avatars/AvatarMemoryStorage.h> +#include <Swiften/VCards/VCardManager.h> +#include <Swiften/VCards/VCardStorage.h> +#include <Swiften/MUC/MUCRegistry.h> +#include <Swiften/Queries/IQRouter.h> +#include <Swiften/Client/DummyStanzaChannel.h> +#include <Swiften/StringCodecs/SHA1.h> +#include <Swiften/StringCodecs/Hexify.h> using namespace Swift; @@ -55,7 +56,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { return photoHashes.find(jid)->second; } VCard::ref vCard = getVCard(jid); - if (vCard && !vCard->getPhoto().isEmpty()) { + if (vCard && !vCard->getPhoto().empty()) { return Hexify::hexify(SHA1::getHash(vCard->getPhoto())); } else { @@ -79,7 +80,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { avatarStorage = new AvatarMemoryStorage(); vcardStorage = new TestVCardStorage(); vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage); - avatar1 = ByteArray("abcdefg"); + avatar1 = createByteArray("abcdefg"); avatar1Hash = Hexify::hexify(SHA1::getHash(avatar1)); user1 = JID("user1@bar.com/bla"); user2 = JID("user2@foo.com/baz"); @@ -95,7 +96,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashKnownAvatar() { - std::auto_ptr<VCardAvatarManager> testling = createManager(); + boost::shared_ptr<VCardAvatarManager> testling = createManager(); storeVCardWithPhoto(user1.toBare(), avatar1); avatarStorage->addAvatar(avatar1Hash, avatar1); @@ -105,7 +106,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashEmptyAvatar() { - std::auto_ptr<VCardAvatarManager> testling = createManager(); + boost::shared_ptr<VCardAvatarManager> testling = createManager(); storeEmptyVCard(user1.toBare()); std::string result = testling->getAvatarHash(user1); @@ -114,7 +115,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar() { - std::auto_ptr<VCardAvatarManager> testling = createManager(); + boost::shared_ptr<VCardAvatarManager> testling = createManager(); storeVCardWithPhoto(user1.toBare(), avatar1); std::string result = testling->getAvatarHash(user1); @@ -125,7 +126,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashUnknownAvatarUnknownVCard() { - std::auto_ptr<VCardAvatarManager> testling = createManager(); + boost::shared_ptr<VCardAvatarManager> testling = createManager(); std::string result = testling->getAvatarHash(user1); @@ -133,7 +134,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashKnownAvatarUnknownVCard() { - std::auto_ptr<VCardAvatarManager> testling = createManager(); + boost::shared_ptr<VCardAvatarManager> testling = createManager(); vcardStorage->photoHashes[user1.toBare()] = avatar1Hash; std::string result = testling->getAvatarHash(user1); @@ -143,7 +144,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { void testVCardUpdateTriggersUpdate() { - std::auto_ptr<VCardAvatarManager> testling = createManager(); + boost::shared_ptr<VCardAvatarManager> testling = createManager(); vcardManager->requestVCard(user1); sendVCardResult(); @@ -151,8 +152,8 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } private: - std::auto_ptr<VCardAvatarManager> createManager() { - std::auto_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, mucRegistry)); + boost::shared_ptr<VCardAvatarManager> createManager() { + boost::shared_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, mucRegistry)); result->onAvatarChanged.connect(boost::bind(&VCardAvatarManagerTest::handleAvatarChanged, this, _1)); return result; } |