// xestiaab_vcard.h - Xestia Address Book vCard Unit Tests.
//
// (c) 2012-2015 Xestia Software Development.
//
// This file is part of Xestia Address Book.
//
// Xestia Address Book is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, version 3 of the license.
//
// Xestia Address Book is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with Xestia Address Book. If not, see
#include
#include
#include "vcard/vcard.h"
TEST(vCard, LoadCheck){
vCard vCardTest;
// Do a failed loading test.
// LoadCheck-Invalid.vcf should never exist in the tests directory.
ASSERT_EQ(1, vCardTest.LoadFile("LoadCheck-Invalid.vcf"));
// Load a vCard that does exist in the tests directory.
ASSERT_EQ(0, vCardTest.LoadFile("LoadCheck-Load1.vcf"));
}
TEST(vCard, SaveCheck){
vCard vCardTest;
vCard vCardTest2;
wxFFile vCardTestFileHdl;
wxString vCardTestData;
wxString vCardSaveCheck;
// Load the contact.
vCardTest.LoadFile("LoadCheck-Load1.vcf");
vCardSaveCheck = vCardTest.WriteString();
// Load the file again and put it into the vCardTestData
// string. Both sets of data should match.
vCardTestFileHdl.Open("LoadCheck-Load1.vcf", "r");
vCardTestFileHdl.ReadAll(&vCardTestData, wxConvAuto());
vCardTestFileHdl.Close();
ASSERT_EQ(vCardSaveCheck, vCardTestData);
vCardTestData.Clear();
vCardSaveCheck.Clear();
// Add a line and then compare with a saved file.
vCardTest2.AddRaw(wxT("BEGIN"), wxT("VCARD"));
vCardTest2.AddRaw(wxT("VERSION"), wxT("4.0"));
vCardTest2.AddRaw(wxT("FN"), wxT("Test vCard"));
vCardTest2.AddRaw(wxT("TITLE"), wxT("The Third Title"));
vCardTest2.AddRaw(wxT("TITLE"), wxT("Knight of the Tests"));
vCardTest2.AddRaw(wxT("TITLE"), wxT("The Tester of Cornwall"));
vCardTest2.AddRaw(wxT("END"), wxT("VCARD"));
vCardSaveCheck = vCardTest2.WriteString();
vCardTestFileHdl.Open("LoadCheck-Load2.vcf", "r");
vCardTestFileHdl.ReadAll(&vCardTestData, wxConvAuto());
vCardTestFileHdl.Close();
ASSERT_EQ(vCardSaveCheck, vCardTestData);
}
TEST(vCard, GetStrings){
// Get strings.
}
TEST(vCard, GetMultipleStrings){
// Get multiple strings.
}
TEST(vCard, v3Conversion){
// Convert from a vCard v4 contact to a
// v3 contact.
}
TEST(vCard, v4Conversion){
// Convert from a vCard v3 contact to a
// v4 contact.
}
TEST(vCard, BackwardCompatability){
// Check backward compatability which should
// prevent data loss.
}