Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
fbe5341fa3d79cf691e29497024811a9de7c657c
[xestiacalendar/.git] / source / tests / xestiacalendar_icaltasksave.h
1 // xestiacalendar_icaltasksave.h - Xestia Calendar iCalendar Task Component Save Unit Tests
2 //
3 // (c) 2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
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 Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "../objects/calendartask/CalendarTask.h"
21 TEST(iCalendarSaveTask, SaveTaskTests){
23         CalendarTaskObject TestTask;
24         CalendarTaskObject TestTask2;
25         
26         // Load the test journal information.
27         
28         ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load1.vcf"));
29         ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask.ValidBaseObject());
30         
31         ASSERT_EQ(CALENDAROBJECTSAVE_CANNOTOPEN, TestTask.SaveFile("/stupidfilelocation/dontsavehere.ics"));
32         
33         // First task file.
34         
35         std::string SaveDataComparison = "BEGIN:VCALENDAR\n"
36         "VERSION:2.0\n"
37         "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
38         "BEGIN:VTODO\n"
39         "UID:00\n"
40         "DTSTAMP:20160131T160000Z\n"
41         "END:VTODO\n"
42         "END:VCALENDAR";
43         
44         std::string SaveData;
45         
46         TestTask.SaveString(&SaveData);
47         
48         ASSERT_EQ(SaveDataComparison, SaveData);
50         ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask2.LoadFile("iCalendarTask-Load2.vcf"));
51         ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask2.ValidBaseObject());
52         
53         // Second task file.
54         
55         SaveDataComparison = "BEGIN:VCALENDAR\n"
56         "VERSION:2.0\n"
57         "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
58         "BEGIN:VTODO\n"
59         "UID;UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT:b3a16392-ad86-4061-be53-c215af2306e1\n"
60         "DTSTAMP;OTHER=PARAM:20160131T104500Z\n"
61         "CLASS;CHOCOLATE=NONE:PUBLIC\n"
62         "COMPLETED;LYING=NEVER:20160131T110100Z\n"
63         "CREATED;CARAMEL=PLEASE:20160131T080000Z\n"
64         "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;EXAMPLE=TOKEN;MOREDATA=YES:This \n"
65         " is a description of the todo.\n"
66         "DTSTART;VALUE=DATE-TIME;TZID=Europe/Truro;PARAMONE=YES;PARAMTWO=NO:20160131T1\n"
67         " 03000Z\n"
68         "GEO;EXAMPLE=MOOP:20.0;20.0\n"
69         "LAST-MODIFIED;FUTURE=EVEN:20160131T114200Z\n"
70         "LOCATION;ALTREP=\"null:nodata\";LANGUAGE=kw;EXACT=YES:The Crystal Ceiling, Trur\n"
71         " o\n"
72         "END:VTODO\n"
73         "END:VCALENDAR";
74         
75         SaveData.clear();
76         
77         TestTask2.SaveString(&SaveData);
78         
79         ASSERT_EQ(SaveDataComparison, SaveData);
81 }
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