X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_icaltaskload.h;h=318c6b6d9526af69fcae0d54681b9010b979f104;hb=535b0ddd0ecb26324171ade35d332bd4c60f5e98;hp=62cccb56426ab8f8579246fe97b4dfac66e4e37a;hpb=84350bd10b6dc595f23ca85b2622dba000a10b8c;p=xestiacalendar%2F.git diff --git a/source/tests/xestiacalendar_icaltaskload.h b/source/tests/xestiacalendar_icaltaskload.h index 62cccb5..318c6b6 100644 --- a/source/tests/xestiacalendar_icaltaskload.h +++ b/source/tests/xestiacalendar_icaltaskload.h @@ -161,4 +161,363 @@ TEST(iCalendarTask, ObjectDataTests){ ASSERT_EQ("http://www.example.com/", TestTask.URLData); ASSERT_EQ("EXTERNAL=YES", TestTask.URLDataTokens); + // Tests for RRULE. + + ASSERT_EQ("FREQ=DAILY;COUNT=10", TestTask.RecurranceRuleData); + ASSERT_EQ("TEST=DATA", TestTask.RecurranceRuleDataTokens); + + // Tests for DUE. + + ASSERT_EQ("20160131T150000Z", TestTask.DueData); + ASSERT_EQ("Europe/Truro", TestTask.DueDataTimeZoneID); + ASSERT_EQ("DATE-TIME", TestTask.DueDataValue); + ASSERT_EQ("TEST=YES", TestTask.DueDataTokens); + + // Tests for DURATION. + + CalendarTaskObject TestTask2; + ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask2.LoadFile("iCalendarTask-Load3.vcf")); + ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask2.ValidBaseObject()); + + ASSERT_EQ("PT15M", TestTask2.DurationData); + ASSERT_EQ("TEST=YES", TestTask2.DurationDataTokens); + + // Tests for ATTACH. First ATTACH property. + + std::string AttachData; + std::string AttachDataFormatType; + std::string AttachDataValue; + std::string AttachDataEncoding; + std::string AttachDataTokens; + + if (TestTask.AttachList.begin() != TestTask.AttachList.end()){ + + AttachData = TestTask.AttachList[0]; + + } + + if (TestTask.AttachListFormatType.begin() != TestTask.AttachListFormatType.end()){ + + AttachDataFormatType = TestTask.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 (TestTask.AttachList.size() > 1){ + + AttachData = TestTask.AttachList[1]; + + } + + if (TestTask.AttachListFormatType.size() > 1){ + + AttachDataFormatType = TestTask.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 (TestTask.AttachList.size() > 2){ + + AttachData = TestTask.AttachList[2]; + + } + + if (TestTask.AttachListFormatType.size() > 2){ + + AttachDataFormatType = TestTask.AttachListFormatType[2]; + + } + + if (TestTask.AttachListValue.size() > 2){ + + AttachDataValue = TestTask.AttachListValue[2]; + + } + + if (TestTask.AttachListFormatType.size() > 2){ + + AttachDataEncoding = TestTask.AttachListEncoding[2]; + + } + + if (TestTask.AttachListTokens.size() > 2){ + + AttachDataTokens = TestTask.AttachListTokens[2]; + + } + + ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData); + ASSERT_EQ("text/plain", AttachDataFormatType); + ASSERT_EQ("BASE64", AttachDataEncoding); + ASSERT_EQ("BINARY", AttachDataValue); + ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens); + + // Tests for ATTENDEE. First ATTENDEE property. + + std::string AttendeeDataMember; + std::string AttendeeDataDelegatedFrom; + std::string AttendeeDataDelegatedTo; + std::string AttendeeDataRole; + std::string AttendeeDataRSVP; + std::string AttendeeDataDirectoryEntry; + std::string AttendeeDataSentBy; + std::string AttendeeDataCommonName; + std::string AttendeeDataCalendarUserType; + std::string AttendeeDataParticipationStatus; + std::string AttendeeDataLanguage; + std::string AttendeeDataTokens; + std::string AttendeeData; + + if (TestTask.AttendeeList.begin() != TestTask.AttendeeList.end()){ + + AttendeeData = TestTask.AttendeeList[0]; + + } + + ASSERT_EQ("Attendee One", AttendeeData); + + // Second ATTENDEE property. + + AttendeeData.clear(); + + if (TestTask.AttendeeList.size() > 1){ + + AttendeeData = TestTask.AttendeeList[1]; + + } + + if (TestTask.AttendeeList.size() > 1){ + + AttendeeDataDelegatedFrom = TestTask.AttendeeListDelegatedFrom[1]; + + } + + if (TestTask.AttendeeList.size() > 1){ + + AttendeeDataDelegatedTo = TestTask.AttendeeListDelegatedTo[1]; + + } + + if (TestTask.AttendeeList.size() > 1){ + + AttendeeDataRole = TestTask.AttendeeListRole[1]; + + } + + if (TestTask.AttendeeList.size() > 1){ + + AttendeeDataRSVP = TestTask.AttendeeListRSVP[1]; + + } + + ASSERT_EQ("Attendee Two", AttendeeData); + ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom); + ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo); + ASSERT_EQ("CHAIR", AttendeeDataRole); + ASSERT_EQ("TRUE", AttendeeDataRSVP); + + // Third ATTENDEE property. + + AttendeeData.clear(); + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeData = TestTask.AttendeeList[2]; + + } + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeDataDirectoryEntry = TestTask.AttendeeListDirectoryEntry[2]; + + } + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeDataSentBy = TestTask.AttendeeListSentBy[2]; + + } + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeDataCommonName = TestTask.AttendeeListCommonName[2]; + + } + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeDataCalendarUserType = TestTask.AttendeeListCalendarUserType[2]; + + } + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeDataParticipationStatus = TestTask.AttendeeListParticipationStatus[2]; + + } + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeDataLanguage = TestTask.AttendeeListLanguage[2]; + + } + + if (TestTask.AttendeeList.size() > 2){ + + AttendeeDataTokens = TestTask.AttendeeListTokens[2]; + + } + + ASSERT_EQ("Attendee Three", AttendeeData); + ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry); + ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy); + ASSERT_EQ("Attendee The Third", AttendeeDataCommonName); + ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType); + ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus); + ASSERT_EQ("kw", AttendeeDataLanguage); + ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens); + + // Get the first CATEGORIES. + + std::string CategoryData; + + if (TestTask.CategoriesList.begin() != TestTask.CategoriesList.end()){ + + CategoryData = TestTask.CategoriesList[0]; + + } + + ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", CategoryData); + + CategoryData.clear(); + + std::string CategoryLanguage; + + // Get the second CATEGORIES. + + if (TestTask.CategoriesList.size() > 1){ + + CategoryData = TestTask.CategoriesList[1]; + + } + + if (TestTask.CategoriesList.size() > 1){ + + CategoryLanguage = TestTask.CategoriesListLanguage[1]; + + } + + ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", CategoryData); + ASSERT_EQ("en", CategoryLanguage); + + CategoryData.clear(); + CategoryLanguage.clear(); + + // Get the third CATEGORIES. + + std::string CategoryTokens; + + if (TestTask.CategoriesList.size() > 2){ + + CategoryData = TestTask.CategoriesList[2]; + + } + + if (TestTask.CategoriesList.size() > 2){ + + CategoryLanguage = TestTask.CategoriesListLanguage[2]; + + } + + if (TestTask.CategoriesList.size() > 2){ + + CategoryTokens = TestTask.CategoriesListTokens[2]; + + } + + ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", CategoryData); + ASSERT_EQ("en-GB", CategoryLanguage); + ASSERT_EQ("SAMPLE=TOKEN", CategoryTokens); + + // Get the first COMMENT. + + std::string CommentData; + + if (TestTask.CommentList.begin() != TestTask.CommentList.end()){ + + CommentData = TestTask.CommentList[0]; + + } + + ASSERT_EQ("This is the first comment.", CommentData); + + // Get the second COMMENT. + + CommentData.clear(); + + std::string CommentDataAltRep; + std::string CommentDataLanguage; + + if (TestTask.CommentList.size() > 1){ + + CommentData = TestTask.CommentList[1]; + + } + + if (TestTask.CommentList.size() > 1){ + + CommentDataAltRep = TestTask.CommentListAltRep[1]; + + } + + if (TestTask.CommentList.size() > 1){ + + CommentDataLanguage = TestTask.CommentListLanguage[1]; + + } + + ASSERT_EQ("This is the second comment.", CommentData); + ASSERT_EQ("null:nodata", CommentDataAltRep); + ASSERT_EQ("en", CommentDataLanguage); + + // Get the third COMMENT. + + CommentData.clear(); + + std::string CommentDataTokens; + + if (TestTask.CommentList.size() > 2){ + + CommentData = TestTask.CommentList[2]; + + } + + if (TestTask.CommentList.size() > 2){ + + CommentDataTokens = TestTask.CommentListTokens[2]; + + } + + ASSERT_EQ("This is the third comment.", CommentData); + ASSERT_EQ("ZEBRAS=YES", CommentDataTokens); + } \ No newline at end of file