Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code and unit tests to check if a file exists and no errors occur whilst openin...
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 7 Dec 2015 22:36:26 +0000 (22:36 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 7 Dec 2015 22:36:26 +0000 (22:36 +0000)
source/contacteditor/ContactDataObject.cpp
source/tests/xestiaab_contactload.h

index 9270895..f811e61 100644 (file)
@@ -26,6 +26,18 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
        
        }
        
+       wxFile ContactFile;
+       
+       if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){
+       
+               return CONTACTLOAD_FILEERROR;
+       
+       }
+       
+       // Check that the vCard is a valid vCard 4.0 file.
+       
+       
+       
        return CONTACTLOAD_UNITTESTFAIL;
 
 }
\ No newline at end of file
index 090f794..f66f6d5 100644 (file)
 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
 
 #include <gtest/gtest.h>
+#include "../contacteditor/ContactDataObject.h"
+
+TEST(ContactLoad, ContactLoadTests){
+
+
+       ContactDataObject TestFile;
+
+       // Check that the file given is not missing.
+       
+       ASSERT_EQ(CONTACTLOAD_FILEMISSING, TestFile.LoadFile("MissingFile.vcf"));
+       
+       // Check that the file given does not have an error when attempting to
+       // open it. 
+       
+       ASSERT_EQ(CONTACTLOAD_FILEERROR, TestFile.LoadFile("InvalidPermissions.vcf"));
+
+}
 
 // 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