Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added ATTACH unit tests for the third VALARM in iCalendarEvent/AlarmTests
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 16 Feb 2016 22:06:26 +0000 (22:06 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 16 Feb 2016 22:06:26 +0000 (22:06 +0000)
source/tests/xestiacalendar_icaleventload.h

index 374db71..9b3c9a3 100644 (file)
@@ -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){
                
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