X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_icaleventload.h;h=023c1978688f5b1a175bf4e66553bad3e60d1acd;hb=cba151c4b833a26c63984769f921bab5e755decd;hp=374db71550bb8d228d692c330ed5d30287ea57f9;hpb=4b8bb6b65a54441b24d3a3e7ca505b86eb91d786;p=xestiacalendar%2F.git diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index 374db71..023c197 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -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){