Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added source code, headers and unit testing for the LOGO vCard Property for ContactDa...
[xestiaab/.git] / source / tests / xestiaab_contactload.h
index dea51d3..66e548e 100644 (file)
@@ -2465,4 +2465,165 @@ TEST(ContactLoad, PhotoTests){
        
 }
 
+TEST(ContactLoad, LogoTests){
+
+       ContactDataObject TestFile;
+
+       // Check that the vCard 4.0 file loads OK.
+
+       ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
+
+       std::map<int,std::string>::iterator TestStrIter;
+       std::map<int,wxString>::iterator TestFileIter;
+       std::map<int,int>::iterator TestFileIntIter;    
+
+       // Start with the first photo.
+       
+       TestStrIter = TestFile.LogosList.find(0);
+       ASSERT_NE(TestFile.LogosList.end(), TestStrIter);
+       ASSERT_EQ("iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAJUlEQVQoz2NkwAb+//8PYTAyMmLKMjGQDuilhxHudBrbM8zCDQCxHQkPeaUvawAAAABJRU5ErkJggg==", 
+               TestStrIter->second);
+
+       // Check that it has the correct encoding.
+       
+       TestFileIter = TestFile.LogosListPicEncType.find(0);
+       ASSERT_NE(TestFile.LogosListPicEncType.end(), TestFileIter);
+       ASSERT_EQ("base64", TestFileIter->second);
+       
+       // Check that it has the correct image type.
+
+       TestFileIter = TestFile.LogosListPictureType.find(0);
+       ASSERT_NE(TestFile.LogosListPictureType.end(), TestFileIter);
+       ASSERT_EQ("image/png", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.LogosListAltID.find(0);
+       ASSERT_NE(TestFile.LogosListAltID.end(), TestFileIter);
+       ASSERT_EQ("70", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.LogosListPID.find(0);
+       ASSERT_NE(TestFile.LogosListPID.end(), TestFileIter);
+       ASSERT_EQ("71", TestFileIter->second);
+       
+       // Check the MEDIATYPE section.
+       
+       TestFileIter = TestFile.LogosListMediatype.find(0);
+       ASSERT_NE(TestFile.LogosListMediatype.end(), TestFileIter);
+       ASSERT_EQ("image/png", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.LogosListPref.find(0);
+       ASSERT_NE(TestFile.LogosListPref.end(), TestFileIntIter);
+       ASSERT_EQ(72, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.LogosListTokens.find(0);
+       ASSERT_NE(TestFile.LogosListTokens.end(), TestFileIter);
+       ASSERT_EQ("MEEP=MOO", TestFileIter->second);
+       
+       // Start with the second photo.
+       
+       TestStrIter = TestFile.LogosList.find(1);
+       ASSERT_NE(TestFile.LogosList.end(), TestStrIter);
+       ASSERT_EQ("iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAHklEQVQoz2NkYPjPgAr+owkwMqIpYGIgHYzqGdx6AAKNAxMN5P6+AAAAAElFTkSuQmCC", 
+               TestStrIter->second);
+
+       // Check that it has the correct encoding.
+       
+       TestFileIter = TestFile.LogosListPicEncType.find(1);
+       ASSERT_NE(TestFile.LogosListPicEncType.end(), TestFileIter);
+       ASSERT_EQ("base64", TestFileIter->second);
+       
+       // Check that it has the correct image type.
+
+       TestFileIter = TestFile.LogosListPictureType.find(1);
+       ASSERT_NE(TestFile.LogosListPictureType.end(), TestFileIter);
+       ASSERT_EQ("image/png", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.LogosListAltID.find(1);
+       ASSERT_NE(TestFile.LogosListAltID.end(), TestFileIter);
+       ASSERT_EQ("20", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.LogosListPID.find(1);
+       ASSERT_NE(TestFile.LogosListPID.end(), TestFileIter);
+       ASSERT_EQ("21", TestFileIter->second);
+       
+       // Check the MEDIATYPE section.
+       
+       TestFileIter = TestFile.LogosListMediatype.find(1);
+       ASSERT_NE(TestFile.LogosListMediatype.end(), TestFileIter);
+       ASSERT_EQ("image/png", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.LogosListPref.find(1);
+       ASSERT_NE(TestFile.LogosListPref.end(), TestFileIntIter);
+       ASSERT_EQ(22, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.LogosListTokens.find(1);
+       ASSERT_NE(TestFile.LogosListTokens.end(), TestFileIter);
+       ASSERT_EQ("BEEP=BOOP", TestFileIter->second);
+
+       // Start with the second photo.
+       
+       TestStrIter = TestFile.LogosList.find(2);
+       ASSERT_NE(TestFile.LogosList.end(), TestStrIter);
+       ASSERT_EQ("iVBORw0KGgoAAAANSUhEUgAAABEAAAAKCAIAAADdHiL1AAAAIElEQVQoz2MUm53EgApepsxF4XfaoylgYiAdjOoZ3HoAeuQD2WdxRzcAAAAASUVORK5CYII=", 
+               TestStrIter->second);
+
+       // Check that it has the correct encoding.
+       
+       TestFileIter = TestFile.LogosListPicEncType.find(2);
+       ASSERT_NE(TestFile.LogosListPicEncType.end(), TestFileIter);
+       ASSERT_EQ("base64", TestFileIter->second);
+       
+       // Check that it has the correct image type.
+
+       TestFileIter = TestFile.LogosListPictureType.find(2);
+       ASSERT_NE(TestFile.LogosListPictureType.end(), TestFileIter);
+       ASSERT_EQ("image/png", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.LogosListAltID.find(2);
+       ASSERT_NE(TestFile.LogosListAltID.end(), TestFileIter);
+       ASSERT_EQ("90", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.LogosListPID.find(2);
+       ASSERT_NE(TestFile.LogosListPID.end(), TestFileIter);
+       ASSERT_EQ("91", TestFileIter->second);
+       
+       // Check the MEDIATYPE section.
+       
+       TestFileIter = TestFile.LogosListMediatype.find(2);
+       ASSERT_NE(TestFile.LogosListMediatype.end(), TestFileIter);
+       ASSERT_EQ("image/png", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.LogosListPref.find(2);
+       ASSERT_NE(TestFile.LogosListPref.end(), TestFileIntIter);
+       ASSERT_EQ(92, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.LogosListTokens.find(2);
+       ASSERT_NE(TestFile.LogosListTokens.end(), TestFileIter);
+       ASSERT_EQ("LOGO=YUP", TestFileIter->second);
+       
+}
+
 // TODO: Add tests for the Contact Loading process.
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy