From: Steve Brokenshire Date: Tue, 8 Dec 2015 20:16:11 +0000 (+0000) Subject: Added source, header and unit testing code to check that the file meets the vCard... X-Git-Tag: release-0.09~246 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=cdd1530fcf2b19be9187604deb6aa78fba091366 Added source, header and unit testing code to check that the file meets the vCard 4.0 specification for ContactDataObject. --- diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 854cb56..3d4d319 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -36,7 +36,6 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){ // Check that the vCard is a valid vCard 4.0 file. - vCard vCard4FormatCheck; vCard4FormatCheck.LoadFile(Filename); @@ -46,6 +45,16 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){ return CONTACTLOAD_FILEINVALIDFORMAT; } + + // Check that the vCard meets the base specification. + + if (!vCard4FormatCheck.MeetBaseSpecification()){ + + return CONTACTLOAD_FILEBASESPECFAIL; + + } + + return CONTACTLOAD_UNITTESTFAIL; diff --git a/source/contacteditor/ContactDataObject.h b/source/contacteditor/ContactDataObject.h index dda7238..2c6b394 100644 --- a/source/contacteditor/ContactDataObject.h +++ b/source/contacteditor/ContactDataObject.h @@ -28,7 +28,8 @@ enum ContactLoadStatus{ CONTACTLOAD_UNITTESTFAIL = -1, CONTACTLOAD_FILEMISSING, CONTACTLOAD_FILEERROR, - CONTACTLOAD_FILEINVALIDFORMAT + CONTACTLOAD_FILEINVALIDFORMAT, + CONTACTLOAD_FILEBASESPECFAIL }; class ContactDataObject{ diff --git a/source/tests/xestiaab_contactload.h b/source/tests/xestiaab_contactload.h index 2c13711..93c62d7 100644 --- a/source/tests/xestiaab_contactload.h +++ b/source/tests/xestiaab_contactload.h @@ -37,6 +37,10 @@ TEST(ContactLoad, ContactLoadTests){ ASSERT_EQ(CONTACTLOAD_FILEINVALIDFORMAT, TestFile.LoadFile("LoadCheck-Load1-v3.vcf")); + // Check that the vCard 4.0 file meets the base specification. + + ASSERT_EQ(CONTACTLOAD_FILEBASESPECFAIL, TestFile.LoadFile("LoadCheck-Load3.vcf")); + } // TODO: Add tests for the Contact Loading process. \ No newline at end of file