Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added unit tests to process third VALARM section in iCalendarEvent/AlarmTests
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 14 Feb 2016 14:19:04 +0000 (14:19 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 14 Feb 2016 14:19:04 +0000 (14:19 +0000)
source/tests/xestiacalendar_icaleventload.h

index 04b2868..374db71 100644 (file)
@@ -1279,4 +1279,341 @@ TEST(iCalendarEvent, AlarmTests){
        ASSERT_EQ("Example Data 3", XTokenData);
        ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
        
+       // Tests for the third VALARM property.
+       
+       ActionData.clear();
+       ActionDataTokens.clear();
+       
+       TriggerData.clear();
+       TriggerRelated.clear();
+       TriggerValue.clear();
+       TriggerTokens.clear();
+       
+       DurationData.clear();
+       DurationTokens.clear();
+       
+       RepeatData.clear();
+       RepeatTokens.clear();
+       
+       XTokenData.clear();
+       XTokenName.clear();
+       
+       DescriptionData.clear();
+       DescriptionAltRep.clear();
+       DescriptionLanguage.clear();
+       DescriptionTokens.clear();
+
+       string SummaryData;
+       string SummaryAltRep;
+       string SummaryLanguage;
+       string SummaryTokens;
+       
+       string AttendeeDataMember;
+       string AttendeeDataDelegatedFrom;
+       string AttendeeDataDelegatedTo;
+       string AttendeeDataRole;
+       string AttendeeDataRSVP;
+       string AttendeeDataDirectoryEntry;
+       string AttendeeDataSentBy;
+       string AttendeeDataCommonName;
+       string AttendeeDataCalendarUserType;
+       string AttendeeDataParticipationStatus;
+       string AttendeeDataLanguage;
+       string AttendeeDataTokens;
+       string AttendeeData;
+       
+       string AttachData;
+       string AttachDataFormatType;
+       string AttachDataValue;
+       string AttachDataEncoding;
+       string AttachDataTokens;
+       
+       if (TestEvent.CalendarAlarmData.size() > 2){
+               
+               ActionData = TestEvent.CalendarAlarmData[2].AlarmAction;
+               ActionDataTokens = TestEvent.CalendarAlarmData[2].AlarmActionTokens;
+               
+               TriggerData = TestEvent.CalendarAlarmData[2].TriggerData;
+               TriggerRelated = TestEvent.CalendarAlarmData[2].TriggerRelated;
+               TriggerValue = TestEvent.CalendarAlarmData[2].TriggerValue;
+               TriggerTokens = TestEvent.CalendarAlarmData[2].TriggerTokens;
+               
+               DurationData = TestEvent.CalendarAlarmData[2].DurationData;
+               DurationTokens = TestEvent.CalendarAlarmData[2].DurationTokens;
+               
+               RepeatData = TestEvent.CalendarAlarmData[2].RepeatData;
+               RepeatTokens = TestEvent.CalendarAlarmData[2].RepeatTokens;
+               
+               DescriptionData = TestEvent.CalendarAlarmData[2].DescriptionData;
+               DescriptionAltRep = TestEvent.CalendarAlarmData[2].DescriptionAltRep;
+               DescriptionLanguage = TestEvent.CalendarAlarmData[2].DescriptionLanguage;
+               DescriptionTokens = TestEvent.CalendarAlarmData[2].DescriptionTokens;
+               
+               SummaryData = TestEvent.CalendarAlarmData[2].SummaryData;
+               SummaryAltRep = TestEvent.CalendarAlarmData[2].SummaryAltRep;
+               SummaryLanguage = TestEvent.CalendarAlarmData[2].SummaryLanguage;
+               SummaryTokens = TestEvent.CalendarAlarmData[2].SummaryTokens;
+               
+       }
+       
+       ASSERT_EQ("EMAIL", ActionData);
+       ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens);
+       
+       ASSERT_EQ("20160230T120000Z", TriggerData);
+       ASSERT_EQ("END", TriggerRelated);
+       ASSERT_EQ("DATE-TIME", TriggerValue);
+       ASSERT_EQ("PUSH=BUTTON", TriggerTokens);
+
+       ASSERT_EQ("PT7H", DurationData);
+       ASSERT_EQ("FLYING=YES", DurationTokens);
+
+       ASSERT_EQ("PT3M", RepeatData);
+       ASSERT_EQ("SLEEP=ALWAYS", RepeatTokens);
+       
+       ASSERT_EQ("This is the third alarm.", DescriptionData);
+       ASSERT_EQ("null:nodata", DescriptionAltRep);
+       ASSERT_EQ("kw", DescriptionLanguage);
+       ASSERT_EQ("TERRIBLE=TOKEN", DescriptionTokens);
+
+       ASSERT_EQ("This is the summary of the third alarm.", SummaryData);
+       ASSERT_EQ("null:nodata", SummaryAltRep);
+       ASSERT_EQ("en", SummaryLanguage);
+       ASSERT_EQ("MEEP=MOOP", SummaryTokens);
+
+       // Tests for ATTENDEE. First ATTENDEE property.
+
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.begin() != TestEvent.CalendarAlarmData[2].AttendeeList.end()){
+               
+               AttendeeData = TestEvent.CalendarAlarmData[2].AttendeeList[0];
+               
+       }
+       
+       ASSERT_EQ("Attendee One", AttendeeData);
+       
+       // Second ATTENDEE property.
+       
+       AttendeeData.clear();
+       
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){
+               
+               AttendeeData = TestEvent.CalendarAlarmData[2].AttendeeList[1];
+               
+       }
+
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){
+               
+               AttendeeDataDelegatedFrom = TestEvent.CalendarAlarmData[2].AttendeeListDelegatedFrom[1];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){
+               
+               AttendeeDataDelegatedTo = TestEvent.CalendarAlarmData[2].AttendeeListDelegatedTo[1];
+               
+       }
+
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){
+               
+               AttendeeDataRole = TestEvent.CalendarAlarmData[2].AttendeeListRole[1];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 1){
+               
+               AttendeeDataRSVP = TestEvent.CalendarAlarmData[2].AttendeeListRSVP[1];
+               
+       }
+       
+       ASSERT_EQ("Attendee Two", AttendeeData);
+       ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom);
+       ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo);
+       ASSERT_EQ("CHAIR", AttendeeDataRole);
+       ASSERT_EQ("TRUE", AttendeeDataRSVP);
+
+       // Third ATTENDEE property.
+       
+       AttendeeData.clear();
+       
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeData = TestEvent.CalendarAlarmData[2].AttendeeList[2];
+               
+       }
+
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeDataDirectoryEntry = TestEvent.CalendarAlarmData[2].AttendeeListDirectoryEntry[2];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeDataSentBy = TestEvent.CalendarAlarmData[2].AttendeeListSentBy[2];
+               
+       }
+
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeDataCommonName = TestEvent.CalendarAlarmData[2].AttendeeListCommonName[2];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeDataCalendarUserType = TestEvent.CalendarAlarmData[2].AttendeeListCalendarUserType[2];
+               
+       }
+
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeDataParticipationStatus = TestEvent.CalendarAlarmData[2].AttendeeListParticipationStatus[2];
+               
+       }
+
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeDataLanguage = TestEvent.CalendarAlarmData[2].AttendeeListLanguage[2];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttendeeList.size() > 2){
+               
+               AttendeeDataTokens = TestEvent.CalendarAlarmData[2].AttendeeListTokens[2];
+               
+       }
+       
+       ASSERT_EQ("Attendee Three", AttendeeData);
+       ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry);
+       ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy);
+       ASSERT_EQ("Attendee The Third", AttendeeDataCommonName);
+       ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType);
+       ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus);
+       ASSERT_EQ("kw", AttendeeDataLanguage);
+       ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens);
+
+       // Tests for ATTACH. First ATTACH property.
+
+       if (TestEvent.CalendarAlarmData[2].AttachList.begin() != TestEvent.CalendarAlarmData[2].AttachList.end()){
+               
+               AttachData = TestEvent.CalendarAlarmData[2].AttachList[0];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttachListFormatType.begin() != TestEvent.CalendarAlarmData[2].AttachListFormatType.end()){
+               
+               AttachDataFormatType = TestEvent.CalendarAlarmData[2].AttachListFormatType[0];
+               
+       }
+
+       ASSERT_EQ("http://www.example.com/", AttachData);
+       ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
+       
+       // Second ATTACH property.
+       
+       AttachData.clear();
+       AttachDataFormatType.clear();
+       AttachDataValue.clear();
+       AttachDataEncoding.clear();
+       
+       if (TestEvent.CalendarAlarmData[2].AttachList.size() > 1){
+               
+               AttachData = TestEvent.CalendarAlarmData[2].AttachList[1];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttachListFormatType.size() > 1){
+               
+               AttachDataFormatType = TestEvent.CalendarAlarmData[2].AttachListFormatType[1];
+               
+       }
+
+       ASSERT_EQ("http://www.example.com/page2.html", AttachData);
+       ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
+       
+       // Third ATTACH property.
+
+       AttachData.clear();
+       AttachDataFormatType.clear();
+       AttachDataValue.clear();
+       AttachDataEncoding.clear();
+       AttachDataTokens.clear();
+       
+       if (TestEvent.CalendarAlarmData[2].AttachList.size() > 2){
+               
+               AttachData = TestEvent.CalendarAlarmData[2].AttachList[2];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttachListFormatType.size() > 2){
+               
+               AttachDataFormatType = TestEvent.CalendarAlarmData[2].AttachListFormatType[2];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttachListValue.size() > 2){
+               
+               AttachDataValue = TestEvent.CalendarAlarmData[2].AttachListValue[2];
+               
+       }
+       
+       if (TestEvent.CalendarAlarmData[2].AttachListFormatType.size() > 2){
+               
+               AttachDataEncoding = TestEvent.CalendarAlarmData[2].AttachListEncoding[2];
+               
+       }
+
+       if (TestEvent.CalendarAlarmData[2].AttachListTokens.size() > 2){
+               
+               AttachDataTokens = TestEvent.CalendarAlarmData[2].AttachListTokens[2];
+               
+       }
+       
+       ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData);
+       ASSERT_EQ("text/plain", AttachDataFormatType);
+       ASSERT_EQ("BASE64", AttachDataEncoding);
+       ASSERT_EQ("BINARY", AttachDataValue);
+       ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens);
+       
+       // Test the first X-Token.
+       
+       if (TestEvent.CalendarAlarmData[2].XTokensData.size() > 0){
+               
+               XTokenData = TestEvent.CalendarAlarmData[2].XTokensData[0];
+               XTokenName = TestEvent.CalendarAlarmData[2].XTokensDataTokens[0];
+               
+       }
+       
+       ASSERT_EQ("Example Data 1", XTokenData);
+       ASSERT_EQ("X-EXAMPLE1;YAY=YES", XTokenName);
+       
+       // Test the second X-Token.
+       
+       XTokenData.clear();
+       XTokenName.clear();
+       
+       if (TestEvent.CalendarAlarmData[2].XTokensData.size() > 1){
+               
+               XTokenData = TestEvent.CalendarAlarmData[2].XTokensData[1];
+               XTokenName = TestEvent.CalendarAlarmData[2].XTokensDataTokens[1];
+               
+       }
+       
+       ASSERT_EQ("Example Data 2", XTokenData);
+       ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", XTokenName);
+       
+       // Test the third X-Token.
+
+       XTokenData.clear();
+       XTokenName.clear();
+       
+       if (TestEvent.CalendarAlarmData[2].XTokensData.size() > 2){
+               
+               XTokenData = TestEvent.CalendarAlarmData[2].XTokensData[2];
+               XTokenName = TestEvent.CalendarAlarmData[2].XTokensDataTokens[2];
+               
+       }
+       
+       ASSERT_EQ("Example Data 3", XTokenData);
+       ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
+       
 }
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