Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Updated/Added copyright header and licensing to all source files
[xestiacalendar/.git] / source / tests / xestiacalendar_icaleventload.h
index 374db71..023c197 100644 (file)
@@ -1,14 +1,14 @@
 // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Event Component Unit Tests
 //
-// (c) 2016 Xestia Software Development.
+// (c) 2016-2017 Xestia Software Development.
 //
 // This file is part of Xestia Calendar.
 //
-// Xestia Address Book is free software: you can redistribute it and/or modify
+// Xestia Calendar is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by the
 // Free Software Foundation, version 3 of the license.
 //
-// Xestia Address Book is distributed in the hope that it will be useful,
+// Xestia Calendar is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 // GNU General Public License for more details.
@@ -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