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

index b9a989e..04b2868 100644 (file)
@@ -1171,4 +1171,112 @@ TEST(iCalendarEvent, AlarmTests){
        ASSERT_EQ("Example Data 3", XTokenData);
        ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName);
        
+       // Tests for the second 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();
+       
+       string DescriptionData;
+       string DescriptionAltRep;
+       string DescriptionLanguage;
+       string DescriptionTokens;
+       
+       if (TestEvent.CalendarAlarmData.size() > 1){
+               
+               ActionData = TestEvent.CalendarAlarmData[1].AlarmAction;
+               ActionDataTokens = TestEvent.CalendarAlarmData[1].AlarmActionTokens;
+               
+               TriggerData = TestEvent.CalendarAlarmData[1].TriggerData;
+               TriggerRelated = TestEvent.CalendarAlarmData[1].TriggerRelated;
+               TriggerValue = TestEvent.CalendarAlarmData[1].TriggerValue;
+               TriggerTokens = TestEvent.CalendarAlarmData[1].TriggerTokens;
+               
+               DurationData = TestEvent.CalendarAlarmData[1].DurationData;
+               DurationTokens = TestEvent.CalendarAlarmData[1].DurationTokens;
+               
+               RepeatData = TestEvent.CalendarAlarmData[1].RepeatData;
+               RepeatTokens = TestEvent.CalendarAlarmData[1].RepeatTokens;
+               
+               DescriptionData = TestEvent.CalendarAlarmData[1].DescriptionData;
+               DescriptionAltRep = TestEvent.CalendarAlarmData[1].DescriptionAltRep;
+               DescriptionLanguage = TestEvent.CalendarAlarmData[1].DescriptionLanguage;
+               DescriptionTokens = TestEvent.CalendarAlarmData[1].DescriptionTokens;
+               
+       }
+       
+       ASSERT_EQ("DISPLAY", ActionData);
+       ASSERT_EQ("FLASHING=LIGHTS", ActionDataTokens);
+       
+       ASSERT_EQ("20160230T110000Z", 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 second alarm.", DescriptionData);
+       ASSERT_EQ("null:nodata", DescriptionAltRep);
+       ASSERT_EQ("kw", DescriptionLanguage);
+       ASSERT_EQ("TERRIBLE=TOKEN", DescriptionTokens);
+       
+       // Test the first X-Token.
+       
+       if (TestEvent.CalendarAlarmData[1].XTokensData.size() > 0){
+               
+               XTokenData = TestEvent.CalendarAlarmData[1].XTokensData[0];
+               XTokenName = TestEvent.CalendarAlarmData[1].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[1].XTokensData.size() > 1){
+               
+               XTokenData = TestEvent.CalendarAlarmData[1].XTokensData[1];
+               XTokenName = TestEvent.CalendarAlarmData[1].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[1].XTokensData.size() > 2){
+               
+               XTokenData = TestEvent.CalendarAlarmData[1].XTokensData[2];
+               XTokenName = TestEvent.CalendarAlarmData[1].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