Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Disable unit tests to be fixed in a future version
[xestiacalendar/.git] / source / tests / iCalendarTimeZoneTests / iCalendarTimeZoneSave.cpp
1 // xestiacalendar_icaltimezonesave.h - Xestia Calendar iCalendar Timezone Component Save Unit Tests
2 //
3 // (c) 2016-2017 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
7 // Xestia Calendar 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 Calendar 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 "CalendarTimezone.h"
20 #include <gtest/gtest.h>
22 class iCalendarTimezoneSaveTests : public ::testing::Test
23 {
24 private:
25     virtual void SetUp()
26     {
27     }
28     
29     virtual void TearDown()
30     {
31     }
32 };
34 TEST_F(iCalendarTimezoneSaveTests, SaveTimezoneTests){
36         CalendarTimezoneObject testTimezone;
37         CalendarTimezoneObject testTimezone2;
38         
39         // Load the first test timezone.
40         
41         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTimezone.LoadFile("iCalendarTimezone-Load1.vcf"));
42         ASSERT_EQ(CALENDAROBJECTVALID_OK, testTimezone.ValidBaseObject());
43         
44         ASSERT_EQ(CALENDAROBJECTSAVE_CANNOTOPEN, testTimezone.SaveFile("/stupidfilelocation/dontsavehere.ics"));
45         
46         // Save the data to a string and compare the data.
48         // First contact file.
49         
50         std::string saveDataComparison = "BEGIN:VCALENDAR\n"
51         "VERSION:2.0\n"
52         "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
53         "BEGIN:VTIMEZONE\n"
54         "TZID:Example/Starrgazy\n"
55         "END:VTIMEZONE\n"
56         "END:VCALENDAR";
57         
58         std::string saveData;
59         
60         testTimezone.SaveString(&saveData);
61         
62         ASSERT_EQ(saveDataComparison, saveData);
63         
64         // Process the second calendar item.
66         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTimezone2.LoadFile("iCalendarTimezone-Load2.vcf"));
67         ASSERT_EQ(CALENDAROBJECTVALID_OK, testTimezone2.ValidBaseObject());
68         
69         saveData.clear();
70         
71         testTimezone2.SaveString(&saveData);
73         saveDataComparison = "BEGIN:VCALENDAR\n"
74         "VERSION:2.0\n"
75         "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
76         "BEGIN:VTIMEZONE\n"
77         "TZID;OTHER=PARAM:Example/Starrgazy\n"
78         "LAST-MODIFIED;FUTURE=ODD:20160203T200700Z\n"
79         "TZURL;URL=YES:http://www.example.com/\n"
80         "BEGIN:STANDARD\n"
81         "DTSTART:20160204T020000\n"
82         "TZOFFSETFROM:-0500\n"
83         "TZOFFSETTO:-0400\n"
84         "END:STANDARD\n"
85         "BEGIN:STANDARD\n"
86         "DTSTART;MEEP=MOO:20160205T020000\n"
87         "TZOFFSETFROM;LETS=GO:-0500\n"
88         "TZOFFSETTO;EXAMPLE=DATA:-0400\n"
89         "END:STANDARD\n"
90         "BEGIN:STANDARD\n"
91         "DTSTART;MEEP=MOO:20160206T020000\n"
92         "TZOFFSETFROM;LETS=GO:-0500\n"
93         "TZOFFSETTO;EXAMPLE=DATA:-0400\n"
94         "RRULE;YAK=YES:FREQ=DAILY;COUNT=10\n"
95         "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=kw;YO=YOYOS:Example timezone comment.\n"
96         "RDATE;VALUE=DATE;TZID=Europe/Truro;BEEP=BOOP:20160205,20160207,20160216,20160\n"
97         " 305\n"
98         "TZNAME;LANGUAGE=en;NOPE=YES:Example Timezone Name 1\n"
99         "X-MOO:Meep\n"
100         "X-MOO:Moop\n"
101         "X-MOO;MEEP=YIKES:Zaap\n"
102         "X-ITEM:Fork\n"
103         "X-ITEM:Spoon\n"
104         "X-ITEM;DIRTY=NO:Knife\n"
105         "X-NOPE:1\n"
106         "X-NOPE:2\n"
107         "X-NOPE;LONG=YES:3\n"
108         "END:STANDARD\n"
109         "BEGIN:DAYLIGHT\n"
110         "DTSTART:20160204T020000\n"
111         "TZOFFSETFROM:-0500\n"
112         "TZOFFSETTO:-0400\n"
113         "END:DAYLIGHT\n"
114         "BEGIN:DAYLIGHT\n"
115         "DTSTART;MEEP=MOO:20160205T020000\n"
116         "TZOFFSETFROM;LETS=GO:-0500\n"
117         "TZOFFSETTO;EXAMPLE=DATA:-0400\n"
118         "END:DAYLIGHT\n"
119         "BEGIN:DAYLIGHT\n"
120         "DTSTART;MEEP=MOO:20160206T020000\n"
121         "TZOFFSETFROM;LETS=GO:-0500\n"
122         "TZOFFSETTO;EXAMPLE=DATA:-0400\n"
123         "RRULE;YAK=YES:FREQ=DAILY;COUNT=10\n"
124         "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=kw;YO=YOYOS:Example timezone comment.\n"
125         "RDATE;VALUE=DATE;TZID=Europe/Truro;BEEP=BOOP:20160205,20160207,20160216,20160\n"
126         " 305\n"
127         "TZNAME;LANGUAGE=en;NOPE=YES:Example Timezone Name 1\n"
128         "X-MOO:Meep\n"
129         "X-MOO:Moop\n"
130         "X-MOO;MEEP=YIKES:Zaap\n"
131         "X-ITEM:Fork\n"
132         "X-ITEM:Spoon\n"
133         "X-ITEM;DIRTY=NO:Knife\n"
134         "X-NOPE:1\n"
135         "X-NOPE:2\n"
136         "X-NOPE;LONG=YES:3\n"
137         "END:DAYLIGHT\n"
138         "END:VTIMEZONE\n"
139         "END:VCALENDAR";
141         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