From: Steve Brokenshire Date: Sat, 13 Feb 2016 18:11:20 +0000 (+0000) Subject: Splitted VALARM tests for CalendarEventObject into iCalendarEvent/AlarmTests X-Git-Tag: release-0.02~367 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=b301c6e7e7f6848581e3b773468b3becac420ecc;p=xestiacalendar%2F.git Splitted VALARM tests for CalendarEventObject into iCalendarEvent/AlarmTests --- diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index 3118907..b9a989e 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -1069,7 +1069,15 @@ TEST(iCalendarEvent, ObjectDataTests){ ASSERT_EQ("None", XTokenData); ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName); + +} + +TEST(iCalendarEvent, AlarmTests){ + CalendarEventObject TestEvent; + ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load2.vcf")); + ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent.ValidBaseObject()); + // Tests for the first VALARM property. std::string ActionData; @@ -1080,6 +1088,15 @@ TEST(iCalendarEvent, ObjectDataTests){ std::string TriggerValue; std::string TriggerTokens; + std::string DurationData; + std::string DurationTokens; + + std::string RepeatData; + std::string RepeatTokens; + + std::string XTokenData; + std::string XTokenName; + if (TestEvent.CalendarAlarmData.size() > 0){ ActionData = TestEvent.CalendarAlarmData[0].AlarmAction; @@ -1090,6 +1107,12 @@ TEST(iCalendarEvent, ObjectDataTests){ TriggerValue = TestEvent.CalendarAlarmData[0].TriggerValue; TriggerTokens = TestEvent.CalendarAlarmData[0].TriggerTokens; + DurationData = TestEvent.CalendarAlarmData[0].DurationData; + DurationTokens = TestEvent.CalendarAlarmData[0].DurationTokens; + + RepeatData = TestEvent.CalendarAlarmData[0].RepeatData; + RepeatTokens = TestEvent.CalendarAlarmData[0].RepeatTokens; + } ASSERT_EQ("AUDIO", ActionData); @@ -1099,5 +1122,53 @@ TEST(iCalendarEvent, ObjectDataTests){ ASSERT_EQ("END", TriggerRelated); ASSERT_EQ("DATE-TIME", TriggerValue); ASSERT_EQ("PUSH=BUTTON", TriggerTokens); + + ASSERT_EQ("PT5H", DurationData); + ASSERT_EQ("FLYING=NO", DurationTokens); + + ASSERT_EQ("PT5M", RepeatData); + ASSERT_EQ("NEVER=SLEEP", RepeatTokens); + + // Test the first X-Token. + + if (TestEvent.CalendarAlarmData[0].XTokensData.size() > 0){ + + XTokenData = TestEvent.CalendarAlarmData[0].XTokensData[0]; + XTokenName = TestEvent.CalendarAlarmData[0].XTokensDataTokens[0]; + + } -} \ No newline at end of file + 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[0].XTokensData.size() > 1){ + + XTokenData = TestEvent.CalendarAlarmData[0].XTokensData[1]; + XTokenName = TestEvent.CalendarAlarmData[0].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[0].XTokensData.size() > 2){ + + XTokenData = TestEvent.CalendarAlarmData[0].XTokensData[2]; + XTokenName = TestEvent.CalendarAlarmData[0].XTokensDataTokens[2]; + + } + + ASSERT_EQ("Example Data 3", XTokenData); + ASSERT_EQ("X-EXAMPLE3;WORLD=NO", XTokenName); + +}