Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added DURATION property for saving data from a CalendarTaskObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 7 Jun 2016 22:30:13 +0000 (23:30 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 7 Jun 2016 22:30:13 +0000 (23:30 +0100)
Added the code and unit tests for the DURATION property.

source/objects/calendartask/CalendarTask-Save.cpp
source/tests/xestiacalendar_icaltasksave.h

index a619e99..f8ae474 100644 (file)
@@ -412,6 +412,32 @@ void CalendarTaskObject::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 PRIORITY value.
        
        if (PriorityData > -1 && PriorityData < 10){
index 84e554a..356fd4d 100644 (file)
@@ -22,6 +22,7 @@ TEST(iCalendarSaveTask, SaveTaskTests){
 
        CalendarTaskObject TestTask;
        CalendarTaskObject TestTask2;
+       CalendarTaskObject TestTask3;
        
        // Load the test journal information.
        
@@ -186,4 +187,26 @@ TEST(iCalendarSaveTask, SaveTaskTests){
        
        ASSERT_EQ(SaveDataComparison, SaveData);
 
+       // Third task file.
+
+       SaveDataComparison = "BEGIN:VCALENDAR\n"
+       "VERSION:2.0\n"
+       "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
+       "BEGIN:VTODO\n"
+       "UID:b3a16392-ad86-4061-be53-c215af2306df\n"
+       "DTSTAMP;OTHER=PARAM:20160131T104500Z\n"
+       "DTSTART:20160131T103000Z\n"
+       "DURATION;TEST=YES:PT15M\n"
+       "END:VTODO\n"
+       "END:VCALENDAR";
+
+       ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask3.LoadFile("iCalendarTask-Load3.vcf"));
+       ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask3.ValidBaseObject());
+       
+       SaveData.clear();
+       
+       TestTask3.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