From: Steve Brokenshire Date: Tue, 16 Feb 2016 22:06:26 +0000 (+0000) Subject: Added ATTACH unit tests for the third VALARM in iCalendarEvent/AlarmTests X-Git-Tag: release-0.02~354 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=08adbc01175a5aaee5f20e3381477780a1e43671;p=xestiacalendar%2F.git Added ATTACH unit tests for the third VALARM in iCalendarEvent/AlarmTests --- diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index 374db71..9b3c9a3 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -1129,6 +1129,95 @@ TEST(iCalendarEvent, AlarmTests){ ASSERT_EQ("PT5M", RepeatData); ASSERT_EQ("NEVER=SLEEP", RepeatTokens); + // Tests for ATTACH. First ATTACH property. + + std::string AttachData; + std::string AttachDataFormatType; + std::string AttachDataValue; + std::string AttachDataEncoding; + std::string AttachDataTokens; + + if (TestEvent.CalendarAlarmData[0].AttachList.begin() != TestEvent.CalendarAlarmData[0].AttachList.end()){ + + AttachData = TestEvent.AttachList[0]; + + } + + if (TestEvent.CalendarAlarmData[0].AttachListFormatType.begin() != TestEvent.CalendarAlarmData[0].AttachListFormatType.end()){ + + AttachDataFormatType = TestEvent.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[0].AttachList.size() > 1){ + + AttachData = TestEvent.CalendarAlarmData[0].AttachList[1]; + + } + + if (TestEvent.CalendarAlarmData[0].AttachListFormatType.size() > 1){ + + AttachDataFormatType = TestEvent.CalendarAlarmData[0].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[0].AttachList.size() > 2){ + + AttachData = TestEvent.CalendarAlarmData[0].AttachList[2]; + + } + + if (TestEvent.CalendarAlarmData[0].AttachListFormatType.size() > 2){ + + AttachDataFormatType = TestEvent.CalendarAlarmData[0].AttachListFormatType[2]; + + } + + if (TestEvent.CalendarAlarmData[0].AttachListValue.size() > 2){ + + AttachDataValue = TestEvent.CalendarAlarmData[0].AttachListValue[2]; + + } + + if (TestEvent.CalendarAlarmData[0].AttachListFormatType.size() > 2){ + + AttachDataEncoding = TestEvent.CalendarAlarmData[0].AttachListEncoding[2]; + + } + + if (TestEvent.CalendarAlarmData[0].AttachListTokens.size() > 2){ + + AttachDataTokens = TestEvent.CalendarAlarmData[0].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[0].XTokensData.size() > 0){ @@ -1322,11 +1411,11 @@ TEST(iCalendarEvent, AlarmTests){ string AttendeeDataTokens; string AttendeeData; - string AttachData; - string AttachDataFormatType; - string AttachDataValue; - string AttachDataEncoding; - string AttachDataTokens; + AttachData.clear(); + AttachDataFormatType.clear(); + AttachDataValue.clear(); + AttachDataEncoding.clear(); + AttachDataTokens.clear(); if (TestEvent.CalendarAlarmData.size() > 2){