summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp')
-rw-r--r--Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp
index 97edc73..778b001 100644
--- a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp
+++ b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp
@@ -66,27 +66,30 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture {
storeVCardWithPhoto(user1.toBare(), avatar1);
avatarStorage->addAvatar(avatar1Hash, avatar1);
- std::string result = testling->getAvatarHash(user1);
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, result);
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *result);
}
void testGetAvatarHashEmptyAvatar() {
boost::shared_ptr<VCardAvatarManager> testling = createManager();
storeEmptyVCard(user1.toBare());
- std::string result = testling->getAvatarHash(user1);
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT_EQUAL(std::string(), result);
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(std::string(), *result);
}
void testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar() {
boost::shared_ptr<VCardAvatarManager> testling = createManager();
storeVCardWithPhoto(user1.toBare(), avatar1);
- std::string result = testling->getAvatarHash(user1);
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, result);
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *result);
CPPUNIT_ASSERT(avatarStorage->hasAvatar(avatar1Hash));
CPPUNIT_ASSERT_EQUAL(avatar1, avatarStorage->getAvatar(avatar1Hash));
}
@@ -94,9 +97,10 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture {
void testGetAvatarHashUnknownAvatarUnknownVCard() {
boost::shared_ptr<VCardAvatarManager> testling = createManager();
- std::string result = testling->getAvatarHash(user1);
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT_EQUAL(std::string(), result);
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(std::string(), *result);
}
void testGetAvatarHashKnownAvatarUnknownVCard() {
@@ -104,9 +108,10 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture {
avatarStorage->setAvatarForJID(user1, avatar1Hash);
- std::string result = testling->getAvatarHash(user1);
-
- CPPUNIT_ASSERT_EQUAL(std::string(), result);
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
+
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(std::string(), *result);
}