Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
49753a4f38b0a0324732d3287d947262e00f9a80
[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         "ORGANIZER;CN=ExampleOrganiser;DIR=\"null:nodata\";SENT-BY=\"mailto:organiser.nor\n"
73         " eply@example.com\";LANGUAGE=kw;HAPPY=WEEKS:mailto:organiser@example.com\n"
74         "PERCENT-COMPLETE;DEEP=THOUGHT:42\n"
75         "PRIORITY;STATUS=DEFAULT:5\n"
76         "RECURRENCE-ID;TZID=Europe/Truro;RANGE=THISANDFUTURE;VALUE=DATE;EXAMPLE=DATA:2\n"
77         " 0160131\n"
78         "SEQUENCE;TEST=YAY:3\n"
79         "STATUS;LANGUAGE=kw;FAVOURITE=BEANS;NOTLIKE=UNKNOWN:2.0;Success\n"
80         "SUMMARY;ALTREP=\"null:nodata\";LANGUAGE=kw;FAVOURITE=TOFU;NOTLIKE=NONE:A summar\n"
81         " y of the todo.\n"
82         "URL;EXTERNAL=YES:http://www.example.com/\n"
83         "RRULE;TEST=DATA:FREQ=DAILY;COUNT=10\n"
84         "DUE;TZID=Europe/Truro;VALUE=DATE-TIME;TEST=YES:20160131T150000Z\n"
85         "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/\n"
86         "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/page2.htm\n"
87         " l\n"
88         "ATTACH;FMTTYPE=text/plain;VALUE=BINARY;ENCODING=BASE64;STUPID=EXAMPLE:VGhpcyB\n"
89         " pcyBhbiBleGFtcGxlIGZpbGU=\n"
90         "ATTENDEE:Attendee One\n"
91         "ATTENDEE;DELEGATED-FROM=\"mailto:delegated.from@example.com\";DELEGATED-TO=\"mai\n"
92         " lto:delegated.to@example.com\";ROLE=CHAIR;RSVP=TRUE:Attendee Two\n"
93         "ATTENDEE;DIR=\"null:nodata\";SENT-BY=\"mailto:sent.by@example.com\";CN=\"Attendee \n"
94         " The Third\";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;LANGUAGE=kw;EXAMPLE=DATA:Atte\n"
95         " ndee Three\n"
96         "END:VTODO\n"
97         "END:VCALENDAR";
98         
99         SaveData.clear();
100         
101         TestTask2.SaveString(&SaveData);
102         
103         ASSERT_EQ(SaveDataComparison, SaveData);
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