Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added source code, headers and unit testing for the GEO vCard property for ContactDat...
[xestiaab/.git] / source / tests / xestiaab_contactload.h
index 39fe16f..f4be7fb 100644 (file)
@@ -1215,4 +1215,125 @@ TEST(ContactLoad, LanguageTests){
 
 }
 
+TEST(ContactLoad, GeographicTests){
+
+       ContactDataObject TestFile;
+
+       // Check that the vCard 4.0 file loads OK.
+
+       ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
+
+       std::map<int,wxString>::iterator TestFileIter;
+       std::map<int,int>::iterator TestFileIntIter;
+       
+       // Start with the general Geoposition.
+       
+       TestFileIter = TestFile.GeneralGeographyList.find(0);
+       ASSERT_NE(TestFile.GeneralGeographyList.end(), TestFileIter);
+       ASSERT_EQ("geo:3.5,3.5", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.GeneralGeographyListAltID.find(0);
+       ASSERT_NE(TestFile.GeneralGeographyListAltID.end(), TestFileIter);
+       ASSERT_EQ("13", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.GeneralGeographyListPID.find(0);
+       ASSERT_NE(TestFile.GeneralGeographyListPID.end(), TestFileIter);
+       ASSERT_EQ("26", TestFileIter->second);
+       
+       // Check the MEDIATYPE section.
+       
+       TestFileIter = TestFile.GeneralGeographyListMediatype.find(0);
+       ASSERT_NE(TestFile.GeneralGeographyListMediatype.end(), TestFileIter);
+       ASSERT_EQ("text/plain", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.GeneralGeographyListPref.find(0);
+       ASSERT_NE(TestFile.GeneralGeographyListPref.end(), TestFileIntIter);
+       ASSERT_EQ(39, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.GeneralGeographyListTokens.find(0);
+       ASSERT_NE(TestFile.GeneralGeographyListTokens.end(), TestFileIter);
+       ASSERT_EQ("POS=Yep", TestFileIter->second);
+
+       // Start with the home Geoposition.
+       
+       TestFileIter = TestFile.HomeGeographyList.find(1);
+       ASSERT_NE(TestFile.HomeGeographyList.end(), TestFileIter);
+       ASSERT_EQ("geo:7.0,7.0", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.HomeGeographyListAltID.find(1);
+       ASSERT_NE(TestFile.HomeGeographyListAltID.end(), TestFileIter);
+       ASSERT_EQ("140", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.HomeGeographyListPID.find(1);
+       ASSERT_NE(TestFile.HomeGeographyListPID.end(), TestFileIter);
+       ASSERT_EQ("70", TestFileIter->second);
+       
+       // Check the MEDIATYPE section.
+       
+       TestFileIter = TestFile.HomeGeographyListMediatype.find(1);
+       ASSERT_NE(TestFile.HomeGeographyListMediatype.end(), TestFileIter);
+       ASSERT_EQ("text/ratherplain", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.HomeGeographyListPref.find(1);
+       ASSERT_NE(TestFile.HomeGeographyListPref.end(), TestFileIntIter);
+       ASSERT_EQ(1, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.HomeGeographyListTokens.find(1);
+       ASSERT_NE(TestFile.HomeGeographyListTokens.end(), TestFileIter);
+       ASSERT_EQ("POS=Nope", TestFileIter->second);
+
+       // Start with the business Geoposition.
+       
+       TestFileIter = TestFile.BusinessGeographyList.find(2);
+       ASSERT_NE(TestFile.BusinessGeographyList.end(), TestFileIter);
+       ASSERT_EQ("geo:14.0,14.0", TestFileIter->second);
+       
+       // Check the ALTID section.
+       
+       TestFileIter = TestFile.BusinessGeographyListAltID.find(2);
+       ASSERT_NE(TestFile.BusinessGeographyListAltID.end(), TestFileIter);
+       ASSERT_EQ("75", TestFileIter->second);
+       
+       // Check the PID section.
+       
+       TestFileIter = TestFile.BusinessGeographyListPID.find(2);
+       ASSERT_NE(TestFile.BusinessGeographyListPID.end(), TestFileIter);
+       ASSERT_EQ("32", TestFileIter->second);
+       
+       // Check the MEDIATYPE section.
+       
+       TestFileIter = TestFile.BusinessGeographyListMediatype.find(2);
+       ASSERT_NE(TestFile.BusinessGeographyListMediatype.end(), TestFileIter);
+       ASSERT_EQ("text/greenplain", TestFileIter->second);
+       
+       // Check the PREF section.
+       
+       TestFileIntIter = TestFile.BusinessGeographyListPref.find(2);
+       ASSERT_NE(TestFile.BusinessGeographyListPref.end(), TestFileIntIter);
+       ASSERT_EQ(4, TestFileIntIter->second);
+       
+       // Check the extra tokens.
+       
+       TestFileIter = TestFile.BusinessGeographyListTokens.find(2);
+       ASSERT_NE(TestFile.BusinessGeographyListTokens.end(), TestFileIter);
+       ASSERT_EQ("POS=Money", 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