Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added DURATION property for saving data from a CalendarEventObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 5 Jun 2016 02:24:21 +0000 (03:24 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 5 Jun 2016 02:24:21 +0000 (03:24 +0100)
Added the code and unit tests for the DURATION property.

source/objects/calendarevent/CalendarEvent-Save.cpp
source/tests/xestiacalendar_icaleventsave.h

index 4dddd89..e6eaaae 100644 (file)
@@ -621,6 +621,32 @@ void CalendarEventObject::SaveObjectData(string *SaveData){
                
        }
        
+       // Process the DURATION value.
+       
+       if (DurationData.size() > 0){
+               
+               DataLine += "DURATION";
+
+               if (DurationDataTokens.size() > 0){
+               
+                       DataLine += ";";
+                       DataLine += DurationDataTokens;
+                       
+               }
+               
+               DataLine += ":";
+               DataLine += DurationData;
+               DataLine += "\n";
+               
+               DataLineProcessed = OutputText(&DataLine);
+               
+               *SaveData += DataLineProcessed;
+
+               DataLine.clear();
+               DataLineProcessed.clear();
+               
+       }
+       
        // Process the RRULE value.
        
        if (RecurranceRuleData.size() > 0){
index ae25a55..5686d3c 100644 (file)
@@ -22,6 +22,7 @@ TEST(iCalendarSaveEvent, SaveEventTests){
 
        CalendarEventObject TestEvent;
        CalendarEventObject TestEvent2;
+       CalendarEventObject TestEvent3;
        
        // Load the test event.
        
@@ -197,4 +198,24 @@ TEST(iCalendarSaveEvent, SaveEventTests){
        
        ASSERT_EQ(SaveDataComparison, SaveData);
        
+       ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent3.LoadFile("iCalendarEvent-Load3.vcf"));
+       ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent3.ValidBaseObject());
+
+       SaveData.clear();
+
+       SaveDataComparison = "BEGIN:VCALENDAR\n"
+       "VERSION:2.0\n"
+       "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
+       "BEGIN:VEVENT\n"
+       "UID:b3a16392-ad86-4061-be53-c215af2306e1\n"
+       "DTSTAMP:20160127T111200Z\n"
+       "DTSTART:20160122T183000Z\n"
+       "DURATION;TEST=EXAMPLE:PT1H\n"
+       "END:VEVENT\n"
+       "END:VCALENDAR";
+
+       TestEvent3.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