Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added copyright and license header to the C++ source and header files in the tests...
[xestiaab/.git] / source / tests / xestiaab_vcard.h
1 // xestiaab_vcard.h - Xestia Address Book vCard Unit Tests.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include <gtest/gtest.h>
20 #include <wx/ffile.h>
21 #include "vcard/vcard.h"
23 TEST(vCard, LoadCheck){
25         vCard vCardTest;
26         
27         // Do a failed loading test.
28         // LoadCheck-Invalid.vcf should never exist in the tests directory.
29         
30         ASSERT_EQ(1, vCardTest.LoadFile("LoadCheck-Invalid.vcf"));
31         
32         // Load a vCard that does exist in the tests directory.
33         
34         ASSERT_EQ(0, vCardTest.LoadFile("LoadCheck-Load1.vcf"));
35         
36 }
38 TEST(vCard, SaveCheck){
40         vCard vCardTest;
41         vCard vCardTest2;
42         wxFFile vCardTestFileHdl;
43         wxString vCardTestData;
44         wxString vCardSaveCheck;
45         
46         // Load the contact.
48         vCardTest.LoadFile("LoadCheck-Load1.vcf");
49         vCardSaveCheck = vCardTest.WriteString();
50         
51         // Load the file again and put it into the vCardTestData
52         // string. Both sets of data should match.
53         
54         vCardTestFileHdl.Open("LoadCheck-Load1.vcf", "r");
55         vCardTestFileHdl.ReadAll(&vCardTestData, wxConvAuto());
56         vCardTestFileHdl.Close();
57         
58         ASSERT_EQ(vCardSaveCheck, vCardTestData);
59         
60         vCardTestData.Clear();
61         vCardSaveCheck.Clear();
62         
63         // Add a line and then compare with a saved file.
65         vCardTest2.AddRaw(wxT("BEGIN"), wxT("VCARD"));
66         vCardTest2.AddRaw(wxT("VERSION"), wxT("4.0"));
67         vCardTest2.AddRaw(wxT("FN"), wxT("Test vCard"));
68         vCardTest2.AddRaw(wxT("TITLE"), wxT("The Third Title"));        
69         vCardTest2.AddRaw(wxT("TITLE"), wxT("Knight of the Tests"));
70         vCardTest2.AddRaw(wxT("TITLE"), wxT("The Tester of Cornwall"));
71         vCardTest2.AddRaw(wxT("END"), wxT("VCARD"));
72         
73         vCardSaveCheck = vCardTest2.WriteString();
75         vCardTestFileHdl.Open("LoadCheck-Load2.vcf", "r");
76         vCardTestFileHdl.ReadAll(&vCardTestData, wxConvAuto());
77         vCardTestFileHdl.Close();
78         
79         ASSERT_EQ(vCardSaveCheck, vCardTestData);
81 }
83 TEST(vCard, GetStrings){
85         // Get strings.
87 }
89 TEST(vCard, GetMultipleStrings){
91         // Get multiple strings.
93 }
95 TEST(vCard, v3Conversion){
97         // Convert from a vCard v4 contact to a
98         // v3 contact.
102 TEST(vCard, v4Conversion){
104         // Convert from a vCard v3 contact to a
105         // v4 contact.
109 TEST(vCard, BackwardCompatability){
111         // Check backward compatability which should
112         // prevent data loss.
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