Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code and unit tests for saving CLASS in CalendarEventObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 31 May 2016 19:06:12 +0000 (20:06 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 31 May 2016 19:06:12 +0000 (20:06 +0100)
source/objects/calendarevent/CalendarEvent-Save.cpp
source/tests/xestiacalendar_icaleventsave.h

index 911947b..a1d743c 100644 (file)
@@ -9,9 +9,6 @@ void CalendarEventObject::SaveObjectData(string *SaveData){
        
        *SaveData += "BEGIN:VEVENT\n";
        
-       // TODO: Replace SaveData with DataLine, DataLineProcessed
-       // and use the new OutputText function.
-       
        // Process the UID.
        
        if (UniqueID.size() > 0){
@@ -187,6 +184,34 @@ void CalendarEventObject::SaveObjectData(string *SaveData){
                DataLineProcessed.clear();
                
        }
+
+       // Process the CLASS.
+       
+       if (ClassData.size() > 0){
+               
+               if (ClassDataTokens.size() > 0){
+               
+                       DataLine += "CLASS;";
+                       DataLine += ClassDataTokens;
+                       
+               } else {
+
+                       DataLine += "CLASS";
+                       
+               }
+
+               DataLine += ":";
+               DataLine += ClassData;
+               DataLine += "\n";
+               
+               DataLineProcessed = OutputText(&DataLine);
+               
+               *SaveData += DataLineProcessed;
+               
+               DataLine.clear();
+               DataLineProcessed.clear();
+               
+       }
        
        *SaveData += "END:VEVENT\n";
        
index bd00909..1ed9ae6 100644 (file)
@@ -21,6 +21,7 @@
 TEST(iCalendarSaveEvent, SaveEventTests){
 
        CalendarEventObject TestEvent;
+       CalendarEventObject TestEvent2;
        
        // Load the test event.
        
@@ -58,5 +59,29 @@ TEST(iCalendarSaveEvent, SaveEventTests){
        TestEvent.SaveString(&SaveData);
        
        ASSERT_EQ(SaveDataComparison, SaveData);
+
+       // Process the second calendar item.
+
+       ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent2.LoadFile("iCalendarEvent-Load2.vcf"));
+       ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent2.ValidBaseObject());
+
+       SaveDataComparison = "BEGIN:VCARD\n"
+       "VERSION:2.0\n"
+       "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
+       "BEGIN:VEVENT\n"
+       "UID;UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT:b3a16392-ad86-4061-be53-c215af2306e0\n"
+       "DTSTAMP;OTHER=PARAM:20160122T124100Z\n"
+       "DTSTART;VALUE=DATE-TIME;TZID=Europe/Truro;PARAMONE=YES;PARAMTWO=NO:20160122T1\n"
+       " 83000Z\n"
+       "DTEND;VALUE=DATE-TIME;TZID=Europe/Truro;PARAMTHREE=NO;PARAMFOUR=YES:20160124\n"
+       " T183000Z\n"
+       "SUMMARY;ALTREP="null:nodata";LANGUAGE=kw;FAVOURITE=TOFU;NOTLIKE=NONE:A summa\n"
+       " ry of the event.\n"
+       "END:VEVENT\n"
+       "END:VCARD";
+
+       TestEvent2.SaveString(&SaveData);
+       
+       ASSERT_EQ(SaveDataComparison, SaveData);
        
 }
\ No newline at end of file
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