X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_icaleventload.h;h=865d16aa74a66ba3c4359ca8c6c3762897706140;hb=9e8f8cd681c1f0f5d7741c9987774ec9685a5362;hp=539023de672741969bf3847db10321591117a818;hpb=1b22b80b59b7eb6050e0492f45c0785a1c7dd15e;p=xestiacalendar%2F.git diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/xestiacalendar_icaleventload.h index 539023d..865d16a 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/xestiacalendar_icaleventload.h @@ -165,5 +165,124 @@ TEST(iCalendarEvent, ObjectDataTests){ ASSERT_EQ("http://www.example.com/", TestEvent.URLData); ASSERT_EQ("EXTERNAL=YES", TestEvent.URLDataTokens); + + // Tests for RECURRENCE-ID. + + ASSERT_EQ("20160124", TestEvent.RecurranceIDData); + ASSERT_EQ("Europe/Truro", TestEvent.RecurranceIDDataTimeZoneParam); + ASSERT_EQ("THISANDFUTURE", TestEvent.RecurranceIDDataRangeParam); + ASSERT_EQ("DATE", TestEvent.RecurranceIDDataValue); + ASSERT_EQ("EXAMPLE=DATA", TestEvent.RecurranceIDDataTokens); + + // Tests for RRULE. + + ASSERT_EQ("FREQ=DAILY;COUNT=10", TestEvent.RecurranceRuleData); + ASSERT_EQ("TEST=DATA", TestEvent.RecurranceRuleDataTokens); + + // Tests for DTEND. + + ASSERT_EQ("20160124T183000Z", TestEvent.DateTimeEndData); + ASSERT_EQ("DATE-TIME", TestEvent.DateTimeEndDataValue); + ASSERT_EQ("Europe/Truro", TestEvent.DateTimeEndDataTimeZoneID); + ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", TestEvent.DateTimeEndDataTokens); + + // Tests for DURATION. (Done in another file called + // iCalendarEvent-Load3.vcf). + + CalendarEventObject TestEvent2; + ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent2.LoadFile("iCalendarEvent-Load3.vcf")); + ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent2.ValidBaseObject()); + + ASSERT_EQ("PT1H", TestEvent2.DurationData); + ASSERT_EQ("TEST=EXAMPLE", TestEvent2.DurationDataTokens); + + // Tests for ATTACH. First ATTACH property. + + std::string AttachData; + std::string AttachDataFormatType; + std::string AttachDataValue; + std::string AttachDataEncoding; + std::string AttachDataTokens; + + if (TestEvent.AttachList.begin() != TestEvent.AttachList.end()){ + + AttachData = TestEvent.AttachList[0]; + + } + + if (TestEvent.AttachListFormatType.begin() != TestEvent.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.AttachList.size() > 1){ + + AttachData = TestEvent.AttachList[1]; + + } + + if (TestEvent.AttachListFormatType.size() > 1){ + + AttachDataFormatType = TestEvent.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.AttachList.size() > 2){ + + AttachData = TestEvent.AttachList[2]; + + } + + if (TestEvent.AttachListFormatType.size() > 2){ + + AttachDataFormatType = TestEvent.AttachListFormatType[2]; + + } + + if (TestEvent.AttachListValue.size() > 2){ + + AttachDataValue = TestEvent.AttachListValue[2]; + + } + + if (TestEvent.AttachListFormatType.size() > 2){ + + AttachDataEncoding = TestEvent.AttachListEncoding[2]; + + } + + if (TestEvent.AttachListTokens.size() > 2){ + + AttachDataTokens = TestEvent.AttachListTokens[2]; + + } + + ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData); + ASSERT_EQ("text/plain", AttachDataFormatType); + ASSERT_EQ("BASE64", AttachDataEncoding); + ASSERT_EQ("BINARY", AttachDataValue); + ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens); } \ No newline at end of file