1 // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Event Component Unit Tests
3 // (c) 2016-2017 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "../objects/calendarevent/CalendarEvent.h"
21 TEST(iCalendarEvent, BasicTests){
23 CalendarEventObject testEvent;
25 ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, testEvent.LoadFile("iCalendarEvent-Missing.vcf"));
26 ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, testEvent.LoadFile("iCalendarEvent-InvalidPermissions.vcf"));
27 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load1.vcf"));
31 TEST(iCalendarEvent, BaseObjectVerifyTests){
33 CalendarEventObject testEvent;
34 testEvent.LoadFile("iCalendarEvent-Load1.vcf");
35 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
39 ASSERT_EQ("REQUEST", testEvent.methodData);
40 ASSERT_EQ("EXAMPLE=DATA", testEvent.methodTokens);
42 // Tests for CALSCALE.
44 ASSERT_EQ("GREGORIAN", testEvent.calendarScaleData);
45 ASSERT_EQ("MORE=YES", testEvent.calendarScaleTokens);
49 TEST(iCalendarEvent, ObjectDataTests){
51 CalendarEventObject testEvent;
52 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
53 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
57 ASSERT_EQ("20160122T124100Z", testEvent.dateTimeStampData);
58 ASSERT_EQ("OTHER=PARAM", testEvent.dateTimeStampTokens);
62 ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e0", testEvent.uniqueID);
63 ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", testEvent.uniqueIDTokens);
67 ASSERT_EQ("20160122T183000Z", testEvent.dateTimeStartData);
68 ASSERT_EQ("DATE-TIME", testEvent.dateTimeStartDataValue);
69 ASSERT_EQ("Europe/Truro", testEvent.dateTimeStartDataTimeZoneID);
70 ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", testEvent.dateTimeStartDataTokens);
74 ASSERT_EQ("PUBLIC", testEvent.classData);
75 ASSERT_EQ("CHOCOLATE=BAR", testEvent.classDataTokens);
79 ASSERT_EQ("20160123T081100Z", testEvent.dateTimeCreatedData);
80 ASSERT_EQ("CARAMEL=PLEASE", testEvent.dateTimeCreatedTokens);
82 // Tests for DESCRIPTION.
84 std::string descriptionData;
85 std::string descriptionAltRep;
86 std::string descriptionLanguage;
87 std::string descriptionTokens;
89 if (testEvent.descriptionList.begin() != testEvent.descriptionList.end()){
90 descriptionData = testEvent.descriptionList[0];
93 if (testEvent.descriptionListAltRep.begin() != testEvent.descriptionListAltRep.end()){
94 descriptionAltRep = testEvent.descriptionListAltRep[0];
97 if (testEvent.descriptionListLanguage.begin() != testEvent.descriptionListLanguage.end()){
98 descriptionLanguage = testEvent.descriptionListLanguage[0];
101 if (testEvent.descriptionListTokens.begin() != testEvent.descriptionListTokens.end()){
102 descriptionTokens = testEvent.descriptionListTokens[0];
105 ASSERT_EQ("This is a description of the event.", descriptionData);
106 ASSERT_EQ("null:nodata", descriptionAltRep);
107 ASSERT_EQ("kw", descriptionLanguage);
108 ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", descriptionTokens);
112 ASSERT_EQ("5.0;5.0", testEvent.geographicData);
113 ASSERT_EQ("EXAMPLE=MEEP", testEvent.geographicTokens);
115 // Tests for LAST-MODIFIED.
117 ASSERT_EQ("20160124T093000Z", testEvent.lastModifiedData);
118 ASSERT_EQ("FUTURE=ODD", testEvent.lastModifiedTokens);
120 // Tests for LOCATION.
122 ASSERT_EQ("The Basement, Truro", testEvent.locationData);
123 ASSERT_EQ("null:nodata", testEvent.locationDataAltRep);
124 ASSERT_EQ("kw", testEvent.locationDataLanguage);
125 ASSERT_EQ("EXACT=NO", testEvent.locationDataTokens);
127 // Tests for ORGANIZER.
129 ASSERT_EQ("mailto:organiser@example.com", testEvent.organiserData);
130 ASSERT_EQ("ExampleOrganiser", testEvent.organiserDataCommonName);
131 ASSERT_EQ("null:nodata", testEvent.organiserDataDirectoryEntry);
132 ASSERT_EQ("mailto:organiser.noreply@example.com", testEvent.organiserDataSentByParam);
133 ASSERT_EQ("kw", testEvent.organiserDataLanguage);
134 ASSERT_EQ("HAPPY=DAYS", testEvent.organiserDataTokens);
136 // Tests for PRIORITY.
138 ASSERT_EQ(5, testEvent.priorityData);
139 ASSERT_EQ("STATUS=DEFAULT", testEvent.priorityTokens);
141 // Tests for SEQUENCE.
143 ASSERT_EQ(3, testEvent.sequenceData);
144 ASSERT_EQ("TEST=YAY", testEvent.sequenceTokens);
148 ASSERT_EQ("2.0;Success", testEvent.statusData);
149 ASSERT_EQ("kw", testEvent.statusLanguage);
150 ASSERT_EQ("FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN", testEvent.statusTokens);
152 // Tests for SUMMARY.
154 ASSERT_EQ("A summary of the event.", testEvent.summaryData);
155 ASSERT_EQ("null:nodata", testEvent.summaryDataAltRep);
156 ASSERT_EQ("kw", testEvent.summaryDataLanguage);
157 ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", testEvent.summaryDataTokens);
161 ASSERT_EQ("TRANSPARENT", testEvent.timeTransparencyData);
162 ASSERT_EQ("OPAQUE=NOTYET", testEvent.timeTransparencyDataTokens);
166 ASSERT_EQ("http://www.example.com/", testEvent.urlData);
167 ASSERT_EQ("EXTERNAL=YES", testEvent.urlDataTokens);
169 // Tests for RECURRENCE-ID.
171 ASSERT_EQ("20160124", testEvent.recurranceIDData);
172 ASSERT_EQ("Europe/Truro", testEvent.recurranceIDDataTimeZoneParam);
173 ASSERT_EQ("THISANDFUTURE", testEvent.recurranceIDDataRangeParam);
174 ASSERT_EQ("DATE", testEvent.recurranceIDDataValue);
175 ASSERT_EQ("EXAMPLE=DATA", testEvent.recurranceIDDataTokens);
179 ASSERT_EQ("FREQ=DAILY;COUNT=10", testEvent.recurranceRuleData);
180 ASSERT_EQ("TEST=DATA", testEvent.recurranceRuleDataTokens);
184 ASSERT_EQ("20160124T183000Z", testEvent.dateTimeEndData);
185 ASSERT_EQ("DATE-TIME", testEvent.dateTimeEndDataValue);
186 ASSERT_EQ("Europe/Truro", testEvent.dateTimeEndDataTimeZoneID);
187 ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", testEvent.dateTimeEndDataTokens);
189 // Tests for DURATION. (Done in another file called
190 // iCalendarEvent-Load3.vcf).
192 CalendarEventObject testEvent2;
193 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent2.LoadFile("iCalendarEvent-Load3.vcf"));
194 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent2.ValidBaseObject());
196 ASSERT_EQ("PT1H", testEvent2.durationData);
197 ASSERT_EQ("TEST=EXAMPLE", testEvent2.durationDataTokens);
199 // Tests for ATTACH. First ATTACH property.
201 std::string attachData;
202 std::string attachDataFormatType;
203 std::string attachDataValue;
204 std::string attachDataEncoding;
205 std::string attachDataTokens;
207 if (testEvent.attachList.begin() != testEvent.attachList.end()){
209 attachData = testEvent.attachList[0];
213 if (testEvent.attachListFormatType.begin() != testEvent.attachListFormatType.end()){
215 attachDataFormatType = testEvent.attachListFormatType[0];
219 ASSERT_EQ("http://www.example.com/", attachData);
220 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
222 // Second ATTACH property.
225 attachDataFormatType.clear();
226 attachDataValue.clear();
227 attachDataEncoding.clear();
229 if (testEvent.attachList.size() > 1){
231 attachData = testEvent.attachList[1];
235 if (testEvent.attachListFormatType.size() > 1){
237 attachDataFormatType = testEvent.attachListFormatType[1];
241 ASSERT_EQ("http://www.example.com/page2.html", attachData);
242 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
244 // Third ATTACH property.
247 attachDataFormatType.clear();
248 attachDataValue.clear();
249 attachDataEncoding.clear();
250 attachDataTokens.clear();
252 if (testEvent.attachList.size() > 2){
254 attachData = testEvent.attachList[2];
258 if (testEvent.attachListFormatType.size() > 2){
260 attachDataFormatType = testEvent.attachListFormatType[2];
264 if (testEvent.attachListValue.size() > 2){
266 attachDataValue = testEvent.attachListValue[2];
270 if (testEvent.attachListFormatType.size() > 2){
272 attachDataEncoding = testEvent.attachListEncoding[2];
276 if (testEvent.attachListTokens.size() > 2){
278 attachDataTokens = testEvent.attachListTokens[2];
282 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
283 ASSERT_EQ("text/plain", attachDataFormatType);
284 ASSERT_EQ("BASE64", attachDataEncoding);
285 ASSERT_EQ("BINARY", attachDataValue);
286 ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
288 // Tests for ATTENDEE. First ATTENDEE property.
290 std::string attendeeDataMember;
291 std::string attendeeDataDelegatedFrom;
292 std::string attendeeDataDelegatedTo;
293 std::string attendeeDataRole;
294 std::string attendeeDataRSVP;
295 std::string attendeeDataDirectoryEntry;
296 std::string attendeeDataSentBy;
297 std::string attendeeDataCommonName;
298 std::string attendeeDataCalendarUserType;
299 std::string attendeeDataParticipationStatus;
300 std::string attendeeDataLanguage;
301 std::string attendeeDataTokens;
302 std::string attendeeData;
304 if (testEvent.attendeeList.begin() != testEvent.attendeeList.end()){
306 attendeeData = testEvent.attendeeList[0];
310 ASSERT_EQ("Attendee One", attendeeData);
312 // Second ATTENDEE property.
314 attendeeData.clear();
316 if (testEvent.attendeeList.size() > 1){
318 attendeeData = testEvent.attendeeList[1];
322 if (testEvent.attendeeList.size() > 1){
324 attendeeDataDelegatedFrom = testEvent.attendeeListDelegatedFrom[1];
328 if (testEvent.attendeeList.size() > 1){
330 attendeeDataDelegatedTo = testEvent.attendeeListDelegatedTo[1];
334 if (testEvent.attendeeList.size() > 1){
336 attendeeDataRole = testEvent.attendeeListRole[1];
340 if (testEvent.attendeeList.size() > 1){
342 attendeeDataRSVP = testEvent.attendeeListRSVP[1];
346 ASSERT_EQ("Attendee Two", attendeeData);
347 ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
348 ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
349 ASSERT_EQ("CHAIR", attendeeDataRole);
350 ASSERT_EQ("TRUE", attendeeDataRSVP);
352 // Third ATTENDEE property.
354 attendeeData.clear();
356 if (testEvent.attendeeList.size() > 2){
358 attendeeData = testEvent.attendeeList[2];
362 if (testEvent.attendeeList.size() > 2){
364 attendeeDataDirectoryEntry = testEvent.attendeeListDirectoryEntry[2];
368 if (testEvent.attendeeList.size() > 2){
370 attendeeDataSentBy = testEvent.attendeeListSentBy[2];
374 if (testEvent.attendeeList.size() > 2){
376 attendeeDataCommonName = testEvent.attendeeListCommonName[2];
380 if (testEvent.attendeeList.size() > 2){
382 attendeeDataCalendarUserType = testEvent.attendeeListCalendarUserType[2];
386 if (testEvent.attendeeList.size() > 2){
388 attendeeDataParticipationStatus = testEvent.attendeeListParticipationStatus[2];
392 if (testEvent.attendeeList.size() > 2){
394 attendeeDataLanguage = testEvent.attendeeListLanguage[2];
398 if (testEvent.attendeeList.size() > 2){
400 attendeeDataTokens = testEvent.attendeeListTokens[2];
404 ASSERT_EQ("Attendee Three", attendeeData);
405 ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
406 ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
407 ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
408 ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
409 ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
410 ASSERT_EQ("kw", attendeeDataLanguage);
411 ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
413 // Get the first CATEGORIES.
415 std::string categoryData;
417 if (testEvent.categoriesList.begin() != testEvent.categoriesList.end()){
419 categoryData = testEvent.categoriesList[0];
423 ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", categoryData);
425 categoryData.clear();
427 std::string categoryLanguage;
429 // Get the second CATEGORIES.
431 if (testEvent.categoriesList.size() > 1){
433 categoryData = testEvent.categoriesList[1];
437 if (testEvent.categoriesList.size() > 1){
439 categoryLanguage = testEvent.categoriesListLanguage[1];
443 ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", categoryData);
444 ASSERT_EQ("en", categoryLanguage);
446 categoryData.clear();
447 categoryLanguage.clear();
449 // Get the third CATEGORIES.
451 std::string categoryTokens;
453 if (testEvent.categoriesList.size() > 2){
455 categoryData = testEvent.categoriesList[2];
459 if (testEvent.categoriesList.size() > 2){
461 categoryLanguage = testEvent.categoriesListLanguage[2];
465 if (testEvent.categoriesList.size() > 2){
467 categoryTokens = testEvent.categoriesListTokens[2];
471 ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", categoryData);
472 ASSERT_EQ("en-GB", categoryLanguage);
473 ASSERT_EQ("SAMPLE=TOKEN", categoryTokens);
475 // Get the first COMMENT.
477 std::string commentData;
479 if (testEvent.commentList.begin() != testEvent.commentList.end()){
481 commentData = testEvent.commentList[0];
485 ASSERT_EQ("This is the first comment.", commentData);
487 // Get the second COMMENT.
491 std::string commentDataAltRep;
492 std::string commentDataLanguage;
494 if (testEvent.commentList.size() > 1){
496 commentData = testEvent.commentList[1];
500 if (testEvent.commentList.size() > 1){
502 commentDataAltRep = testEvent.commentListAltRep[1];
506 if (testEvent.commentList.size() > 1){
508 commentDataLanguage = testEvent.commentListLanguage[1];
512 ASSERT_EQ("This is the second comment.", commentData);
513 ASSERT_EQ("null:nodata", commentDataAltRep);
514 ASSERT_EQ("en", commentDataLanguage);
516 // Get the third COMMENT.
520 std::string commentDataTokens;
522 if (testEvent.commentList.size() > 2){
524 commentData = testEvent.commentList[2];
528 if (testEvent.commentList.size() > 2){
530 commentDataTokens = testEvent.commentListTokens[2];
534 ASSERT_EQ("This is the third comment.", commentData);
535 ASSERT_EQ("ZEBRAS=YES", commentDataTokens);
537 // Get the first CONTACT.
539 std::string contactData;
541 if (testEvent.contactList.begin() != testEvent.contactList.end()){
543 contactData = testEvent.contactList[0];
547 ASSERT_EQ("First Contact", contactData);
549 // Get the second CONTACT.
553 std::string contactDataAltRep;
554 std::string contactDataLanguage;
556 if (testEvent.contactList.size() > 1){
558 contactData = testEvent.contactList[1];
562 if (testEvent.contactList.size() > 1){
564 contactDataAltRep = testEvent.contactListAltRep[1];
568 if (testEvent.contactList.size() > 1){
570 contactDataLanguage = testEvent.contactListLanguage[1];
574 ASSERT_EQ("Second Contact", contactData);
575 ASSERT_EQ("null:nodata", contactDataAltRep);
576 ASSERT_EQ("en-GB", contactDataLanguage);
578 // Get the third CONTACT.
582 std::string contactDataTokens;
584 if (testEvent.contactList.size() > 2){
586 contactData = testEvent.contactList[2];
590 if (testEvent.contactList.size() > 2){
592 contactDataTokens = testEvent.contactListTokens[2];
596 ASSERT_EQ("Third Contact", contactData);
597 ASSERT_EQ("ZEBRAS=NO", contactDataTokens);
599 // Get the first EXDATE.
601 std::string excludeDate;
603 if (testEvent.excludeDateData.begin() != testEvent.excludeDateData.end()){
605 excludeDate = testEvent.excludeDateData[0];
609 ASSERT_EQ("20160125T120000Z", excludeDate);
611 // Get the second EXDATE.
615 std::string excludeDataTimeZoneParam;
616 std::string excludeDataValue;
618 if (testEvent.contactList.size() > 1){
620 excludeDate = testEvent.excludeDateData[1];
624 if (testEvent.contactList.size() > 1){
626 excludeDataTimeZoneParam = testEvent.excludeDateDataTimeZoneParam[1];
630 if (testEvent.contactList.size() > 1){
632 excludeDataValue = testEvent.excludeDateDataValue[1];
636 ASSERT_EQ("20160125T130000Z", excludeDate);
637 ASSERT_EQ("DATE-TIME", excludeDataValue);
638 ASSERT_EQ("Europe/Truro", excludeDataTimeZoneParam);
640 // Get the third EXDATE.
644 std::string excludeDataTokens;
646 if (testEvent.contactList.size() > 2){
648 excludeDate = testEvent.excludeDateData[2];
652 if (testEvent.contactList.size() > 2){
654 excludeDataTokens = testEvent.excludeDateDataTokens[2];
658 ASSERT_EQ("20160125T133000Z", excludeDate);
659 ASSERT_EQ("ZOOP=ZIPPO", excludeDataTokens);
661 // Get the first REQUEST-STATUS.
663 std::string requestStatus;
665 if (testEvent.requestStatusData.begin() != testEvent.requestStatusData.end()){
667 requestStatus = testEvent.requestStatusData[0];
671 ASSERT_EQ("2.0;Success", requestStatus);
673 // Get the second REQUEST-STATUS.
675 requestStatus.clear();
677 std::string requestLanguage;
679 if (testEvent.requestStatusData.size() > 1){
681 requestStatus = testEvent.requestStatusData[1];
685 if (testEvent.requestStatusData.size() > 1){
687 requestLanguage = testEvent.requestStatusLanguage[1];
691 ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", requestStatus);
692 ASSERT_EQ("en", requestLanguage);
694 // Get the third REQUEST-STATUS.
696 requestStatus.clear();
698 std::string requestTokens;
700 if (testEvent.requestStatusData.size() > 2){
702 requestStatus = testEvent.requestStatusData[2];
706 if (testEvent.requestStatusData.size() > 2){
708 requestTokens = testEvent.requestStatusTokens[2];
712 ASSERT_EQ("3.7;Invalid calendar user", requestStatus);
713 ASSERT_EQ("USER=MISSING", requestTokens);
715 // Get the first RELATED-TO.
717 std::string relatedTo;
719 if (testEvent.relatedToData.begin() != testEvent.relatedToData.end()){
721 relatedTo = testEvent.relatedToData[0];
725 ASSERT_EQ("person.1@example.com", relatedTo);
727 // Get the second RELATED-TO.
731 std::string relatedToType;
733 if (testEvent.relatedToData.size() > 1){
735 relatedTo = testEvent.relatedToData[1];
739 if (testEvent.relatedToData.size() > 1){
741 relatedToType = testEvent.relatedToDataRelationType[1];
745 ASSERT_EQ("person.2@example.com", relatedTo);
746 ASSERT_EQ("PARENT", relatedToType);
748 // Get the third RELATED-TO.
752 std::string relatedToTokens;
754 if (testEvent.relatedToData.size() > 2){
756 relatedTo = testEvent.relatedToData[2];
760 if (testEvent.relatedToData.size() > 2){
762 relatedToTokens = testEvent.relatedToDataTokens[2];
766 ASSERT_EQ("person.3@example.com", relatedTo);
767 ASSERT_EQ("SCHOOL=MEETING", relatedToTokens);
769 // Get the first RESOURCES.
771 std::string resources;
773 if (testEvent.resourcesData.begin() != testEvent.resourcesData.end()){
775 resources = testEvent.resourcesData[0];
779 ASSERT_EQ("DMAC RECEIVER", resources);
781 // Get the second RESOURCES.
785 std::string resourcesLanguage;
787 if (testEvent.resourcesData.size() > 1){
789 resources = testEvent.resourcesData[1];
793 if (testEvent.resourcesData.size() > 1){
795 resourcesLanguage = testEvent.resourcesDataLanguage[1];
799 ASSERT_EQ("PAL-I TELEVISION SET", resources);
800 ASSERT_EQ("en", resourcesLanguage);
802 // Get the third RESOURCES.
806 std::string resourcesAltRep;
807 std::string resourcesTokens;
809 if (testEvent.resourcesData.size() > 2){
811 resources = testEvent.resourcesData[2];
815 if (testEvent.resourcesData.size() > 2){
817 resourcesAltRep = testEvent.resourcesDataAltRep[2];
821 if (testEvent.resourcesData.size() > 2){
823 resourcesTokens = testEvent.resourcesDataTokens[2];
827 ASSERT_EQ("PAL/SECAM VCR", resources);
828 ASSERT_EQ("null:nodata", resourcesAltRep);
829 ASSERT_EQ("STATUS=BROKEN", resourcesTokens);
831 // Get the first RDATE.
833 std::string recurrenceDate;
835 if (testEvent.recurranceDateData.begin() != testEvent.recurranceDateData.end()){
837 recurrenceDate = testEvent.recurranceDateData[0];
841 ASSERT_EQ("20160120", recurrenceDate);
843 // Get the second RDATE.
845 recurrenceDate.clear();
847 std::string recurrenceDateTimeZoneParam;
848 std::string recurrenceDateValue;
850 if (testEvent.recurranceDateData.size() > 1){
852 recurrenceDate = testEvent.recurranceDateData[1];
856 if (testEvent.recurranceDateData.size() > 1){
858 recurrenceDateTimeZoneParam = testEvent.recurranceDateDataTimeZoneParam[1];
862 if (testEvent.recurranceDateData.size() > 1){
864 recurrenceDateValue = testEvent.recurranceDateDataValue[1];
868 ASSERT_EQ("20160121", recurrenceDate);
869 ASSERT_EQ("DATE", recurrenceDateValue);
870 ASSERT_EQ("Europe/Truro", recurrenceDateTimeZoneParam);
872 // Get the third RDATE.
874 recurrenceDate.clear();
876 std::string recurrenceTokens;
878 if (testEvent.recurranceDateData.size() > 2){
880 recurrenceDate = testEvent.recurranceDateData[2];
884 if (testEvent.recurranceDateData.size() > 2){
886 recurrenceTokens = testEvent.recurranceDateDataTokens[2];
890 ASSERT_EQ("20160520", recurrenceDate);
891 ASSERT_EQ("ZILCH=DATA", recurrenceTokens);
893 // Get the first X-EXAMPLE1 token.
895 std::string xTokenName;
896 std::string xTokenData;
898 if (testEvent.xTokensData.size() != 0 ){
900 xTokenData = testEvent.xTokensData[0];
904 if (testEvent.xTokensData.size() != 0){
906 xTokenName = testEvent.xTokensDataTokens[0];
910 ASSERT_EQ("Moo", xTokenData);
911 ASSERT_EQ("X-EXAMPLE1", xTokenName);
913 // Get the second X-EXAMPLE1 token.
918 if (testEvent.xTokensData.size() > 1){
920 xTokenData = testEvent.xTokensData[1];
924 if (testEvent.xTokensData.size() > 1){
926 xTokenName = testEvent.xTokensDataTokens[1];
930 ASSERT_EQ("Meep", xTokenData);
931 ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", xTokenName);
933 // Get the third X-EXAMPLE1 token.
938 if (testEvent.xTokensData.size() > 2){
940 xTokenData = testEvent.xTokensData[2];
944 if (testEvent.xTokensData.size() > 2){
946 xTokenName = testEvent.xTokensDataTokens[2];
950 ASSERT_EQ("Meow", xTokenData);
951 ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", xTokenName);
953 // Get the first X-EXAMPLE2 token.
958 if (testEvent.xTokensData.size() > 3){
960 xTokenData = testEvent.xTokensData[3];
964 if (testEvent.xTokensData.size() > 3){
966 xTokenName = testEvent.xTokensDataTokens[3];
970 ASSERT_EQ("Dish", xTokenData);
971 ASSERT_EQ("X-EXAMPLE2", xTokenName);
973 // Get the second X-EXAMPLE2 token.
978 if (testEvent.xTokensData.size() > 4){
980 xTokenData = testEvent.xTokensData[4];
984 if (testEvent.xTokensData.size() > 4){
986 xTokenName = testEvent.xTokensDataTokens[4];
990 ASSERT_EQ("Fork", xTokenData);
991 ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", xTokenName);
993 // Get the third X-EXAMPLE2 token.
998 if (testEvent.xTokensData.size() > 5){
1000 xTokenData = testEvent.xTokensData[5];
1004 if (testEvent.xTokensData.size() > 5){
1006 xTokenName = testEvent.xTokensDataTokens[5];
1010 ASSERT_EQ("Table", xTokenData);
1011 ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", xTokenName);
1013 // Get the X-STATUS token.
1018 if (testEvent.xTokensData.size() > 6){
1020 xTokenData = testEvent.xTokensData[6];
1024 if (testEvent.xTokensData.size() > 6){
1026 xTokenName = testEvent.xTokensDataTokens[6];
1030 ASSERT_EQ("Idle", xTokenData);
1031 ASSERT_EQ("X-STATUS;HOLIDAY=YES", xTokenName);
1033 // Get the X-TRANSPORT token.
1038 if (testEvent.xTokensData.size() > 7){
1040 xTokenData = testEvent.xTokensData[7];
1044 if (testEvent.xTokensData.size() > 7){
1046 xTokenName = testEvent.xTokensDataTokens[7];
1050 ASSERT_EQ("Private Hire", xTokenData);
1051 ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", xTokenName);
1053 // Get the X-PHANTOM-STATUS token.
1058 if (testEvent.xTokensData.size() > 8){
1060 xTokenData = testEvent.xTokensData[8];
1064 if (testEvent.xTokensData.size() > 8){
1066 xTokenName = testEvent.xTokensDataTokens[8];
1070 ASSERT_EQ("None", xTokenData);
1071 ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", xTokenName);
1075 TEST(iCalendarEvent, AlarmTests){
1077 CalendarEventObject testEvent;
1078 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
1079 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
1081 // Tests for the first VALARM property.
1083 std::string actionData;
1084 std::string actionDataTokens;
1086 std::string triggerData;
1087 std::string triggerRelated;
1088 std::string triggerValue;
1089 std::string triggerTokens;
1091 std::string durationData;
1092 std::string durationTokens;
1094 std::string repeatData;
1095 std::string repeatTokens;
1097 std::string xTokenData;
1098 std::string xTokenName;
1100 if (testEvent.calendarAlarmData.size() > 0){
1102 actionData = testEvent.calendarAlarmData[0].alarmAction;
1103 actionDataTokens = testEvent.calendarAlarmData[0].alarmActionTokens;
1105 triggerData = testEvent.calendarAlarmData[0].triggerData;
1106 triggerRelated = testEvent.calendarAlarmData[0].triggerRelated;
1107 triggerValue = testEvent.calendarAlarmData[0].triggerValue;
1108 triggerTokens = testEvent.calendarAlarmData[0].triggerTokens;
1110 durationData = testEvent.calendarAlarmData[0].durationData;
1111 durationTokens = testEvent.calendarAlarmData[0].durationTokens;
1113 repeatData = testEvent.calendarAlarmData[0].repeatData;
1114 repeatTokens = testEvent.calendarAlarmData[0].repeatTokens;
1118 ASSERT_EQ("AUDIO", actionData);
1119 ASSERT_EQ("FUNKY=SOUNDS", actionDataTokens);
1121 ASSERT_EQ("20160220T160000Z", triggerData);
1122 ASSERT_EQ("END", triggerRelated);
1123 ASSERT_EQ("DATE-TIME", triggerValue);
1124 ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1126 ASSERT_EQ("PT5H", durationData);
1127 ASSERT_EQ("FLYING=NO", durationTokens);
1129 ASSERT_EQ("PT5M", repeatData);
1130 ASSERT_EQ("NEVER=SLEEP", repeatTokens);
1132 // Tests for ATTACH. First ATTACH property.
1134 std::string attachData;
1135 std::string attachDataFormatType;
1136 std::string attachDataValue;
1137 std::string attachDataEncoding;
1138 std::string attachDataTokens;
1140 if (testEvent.calendarAlarmData[0].attachList.begin() != testEvent.calendarAlarmData[0].attachList.end()){
1142 attachData = testEvent.attachList[0];
1146 if (testEvent.calendarAlarmData[0].attachListFormatType.begin() != testEvent.calendarAlarmData[0].attachListFormatType.end()){
1148 attachDataFormatType = testEvent.attachListFormatType[0];
1152 ASSERT_EQ("http://www.example.com/", attachData);
1153 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1155 // Second ATTACH property.
1158 attachDataFormatType.clear();
1159 attachDataValue.clear();
1160 attachDataEncoding.clear();
1162 if (testEvent.calendarAlarmData[0].attachList.size() > 1){
1164 attachData = testEvent.calendarAlarmData[0].attachList[1];
1168 if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 1){
1170 attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[1];
1174 ASSERT_EQ("http://www.example.com/page2.html", attachData);
1175 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1177 // Third ATTACH property.
1180 attachDataFormatType.clear();
1181 attachDataValue.clear();
1182 attachDataEncoding.clear();
1183 attachDataTokens.clear();
1185 if (testEvent.calendarAlarmData[0].attachList.size() > 2){
1187 attachData = testEvent.calendarAlarmData[0].attachList[2];
1191 if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
1193 attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[2];
1197 if (testEvent.calendarAlarmData[0].attachListValue.size() > 2){
1199 attachDataValue = testEvent.calendarAlarmData[0].attachListValue[2];
1203 if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
1205 attachDataEncoding = testEvent.calendarAlarmData[0].attachListEncoding[2];
1209 if (testEvent.calendarAlarmData[0].attachListTokens.size() > 2){
1211 attachDataTokens = testEvent.calendarAlarmData[0].attachListTokens[2];
1215 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1216 ASSERT_EQ("text/plain", attachDataFormatType);
1217 ASSERT_EQ("BASE64", attachDataEncoding);
1218 ASSERT_EQ("BINARY", attachDataValue);
1219 ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1221 // Test the first X-Token.
1223 if (testEvent.calendarAlarmData[0].xTokensData.size() > 0){
1225 xTokenData = testEvent.calendarAlarmData[0].xTokensData[0];
1226 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[0];
1230 ASSERT_EQ("Example Data 1", xTokenData);
1231 ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1233 // Test the second X-Token.
1238 if (testEvent.calendarAlarmData[0].xTokensData.size() > 1){
1240 xTokenData = testEvent.calendarAlarmData[0].xTokensData[1];
1241 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[1];
1245 ASSERT_EQ("Example Data 2", xTokenData);
1246 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1248 // Test the third X-Token.
1253 if (testEvent.calendarAlarmData[0].xTokensData.size() > 2){
1255 xTokenData = testEvent.calendarAlarmData[0].xTokensData[2];
1256 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[2];
1260 ASSERT_EQ("Example Data 3", xTokenData);
1261 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1263 // Tests for the second VALARM property.
1266 actionDataTokens.clear();
1268 triggerData.clear();
1269 triggerRelated.clear();
1270 triggerValue.clear();
1271 triggerTokens.clear();
1273 durationData.clear();
1274 durationTokens.clear();
1277 repeatTokens.clear();
1282 string descriptionData;
1283 string descriptionAltRep;
1284 string descriptionLanguage;
1285 string descriptionTokens;
1287 if (testEvent.calendarAlarmData.size() > 1){
1289 actionData = testEvent.calendarAlarmData[1].alarmAction;
1290 actionDataTokens = testEvent.calendarAlarmData[1].alarmActionTokens;
1292 triggerData = testEvent.calendarAlarmData[1].triggerData;
1293 triggerRelated = testEvent.calendarAlarmData[1].triggerRelated;
1294 triggerValue = testEvent.calendarAlarmData[1].triggerValue;
1295 triggerTokens = testEvent.calendarAlarmData[1].triggerTokens;
1297 durationData = testEvent.calendarAlarmData[1].durationData;
1298 durationTokens = testEvent.calendarAlarmData[1].durationTokens;
1300 repeatData = testEvent.calendarAlarmData[1].repeatData;
1301 repeatTokens = testEvent.calendarAlarmData[1].repeatTokens;
1303 descriptionData = testEvent.calendarAlarmData[1].descriptionData;
1304 descriptionAltRep = testEvent.calendarAlarmData[1].descriptionAltRep;
1305 descriptionLanguage = testEvent.calendarAlarmData[1].descriptionLanguage;
1306 descriptionTokens = testEvent.calendarAlarmData[1].descriptionTokens;
1310 ASSERT_EQ("DISPLAY", actionData);
1311 ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1313 ASSERT_EQ("20160230T110000Z", triggerData);
1314 ASSERT_EQ("END", triggerRelated);
1315 ASSERT_EQ("DATE-TIME", triggerValue);
1316 ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1318 ASSERT_EQ("PT7H", durationData);
1319 ASSERT_EQ("FLYING=YES", durationTokens);
1321 ASSERT_EQ("PT3M", repeatData);
1322 ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1324 ASSERT_EQ("This is the second alarm.", descriptionData);
1325 ASSERT_EQ("null:nodata", descriptionAltRep);
1326 ASSERT_EQ("kw", descriptionLanguage);
1327 ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1329 // Test the first X-Token.
1331 if (testEvent.calendarAlarmData[1].xTokensData.size() > 0){
1333 xTokenData = testEvent.calendarAlarmData[1].xTokensData[0];
1334 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[0];
1338 ASSERT_EQ("Example Data 1", xTokenData);
1339 ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1341 // Test the second X-Token.
1346 if (testEvent.calendarAlarmData[1].xTokensData.size() > 1){
1348 xTokenData = testEvent.calendarAlarmData[1].xTokensData[1];
1349 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[1];
1353 ASSERT_EQ("Example Data 2", xTokenData);
1354 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1356 // Test the third X-Token.
1361 if (testEvent.calendarAlarmData[1].xTokensData.size() > 2){
1363 xTokenData = testEvent.calendarAlarmData[1].xTokensData[2];
1364 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[2];
1368 ASSERT_EQ("Example Data 3", xTokenData);
1369 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1371 // Tests for the third VALARM property.
1374 actionDataTokens.clear();
1376 triggerData.clear();
1377 triggerRelated.clear();
1378 triggerValue.clear();
1379 triggerTokens.clear();
1381 durationData.clear();
1382 durationTokens.clear();
1385 repeatTokens.clear();
1390 descriptionData.clear();
1391 descriptionAltRep.clear();
1392 descriptionLanguage.clear();
1393 descriptionTokens.clear();
1396 string summaryAltRep;
1397 string summaryLanguage;
1398 string summaryTokens;
1400 string attendeeDataMember;
1401 string attendeeDataDelegatedFrom;
1402 string attendeeDataDelegatedTo;
1403 string attendeeDataRole;
1404 string attendeeDataRSVP;
1405 string attendeeDataDirectoryEntry;
1406 string attendeeDataSentBy;
1407 string attendeeDataCommonName;
1408 string attendeeDataCalendarUserType;
1409 string attendeeDataParticipationStatus;
1410 string attendeeDataLanguage;
1411 string attendeeDataTokens;
1412 string attendeeData;
1415 attachDataFormatType.clear();
1416 attachDataValue.clear();
1417 attachDataEncoding.clear();
1418 attachDataTokens.clear();
1420 if (testEvent.calendarAlarmData.size() > 2){
1422 actionData = testEvent.calendarAlarmData[2].alarmAction;
1423 actionDataTokens = testEvent.calendarAlarmData[2].alarmActionTokens;
1425 triggerData = testEvent.calendarAlarmData[2].triggerData;
1426 triggerRelated = testEvent.calendarAlarmData[2].triggerRelated;
1427 triggerValue = testEvent.calendarAlarmData[2].triggerValue;
1428 triggerTokens = testEvent.calendarAlarmData[2].triggerTokens;
1430 durationData = testEvent.calendarAlarmData[2].durationData;
1431 durationTokens = testEvent.calendarAlarmData[2].durationTokens;
1433 repeatData = testEvent.calendarAlarmData[2].repeatData;
1434 repeatTokens = testEvent.calendarAlarmData[2].repeatTokens;
1436 descriptionData = testEvent.calendarAlarmData[2].descriptionData;
1437 descriptionAltRep = testEvent.calendarAlarmData[2].descriptionAltRep;
1438 descriptionLanguage = testEvent.calendarAlarmData[2].descriptionLanguage;
1439 descriptionTokens = testEvent.calendarAlarmData[2].descriptionTokens;
1441 summaryData = testEvent.calendarAlarmData[2].summaryData;
1442 summaryAltRep = testEvent.calendarAlarmData[2].summaryAltRep;
1443 summaryLanguage = testEvent.calendarAlarmData[2].summaryLanguage;
1444 summaryTokens = testEvent.calendarAlarmData[2].summaryTokens;
1448 ASSERT_EQ("EMAIL", actionData);
1449 ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1451 ASSERT_EQ("20160230T120000Z", triggerData);
1452 ASSERT_EQ("END", triggerRelated);
1453 ASSERT_EQ("DATE-TIME", triggerValue);
1454 ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1456 ASSERT_EQ("PT7H", durationData);
1457 ASSERT_EQ("FLYING=YES", durationTokens);
1459 ASSERT_EQ("PT3M", repeatData);
1460 ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1462 ASSERT_EQ("This is the third alarm.", descriptionData);
1463 ASSERT_EQ("null:nodata", descriptionAltRep);
1464 ASSERT_EQ("kw", descriptionLanguage);
1465 ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1467 ASSERT_EQ("This is the summary of the third alarm.", summaryData);
1468 ASSERT_EQ("null:nodata", summaryAltRep);
1469 ASSERT_EQ("en", summaryLanguage);
1470 ASSERT_EQ("MEEP=MOOP", summaryTokens);
1472 // Tests for ATTENDEE. First ATTENDEE property.
1474 if (testEvent.calendarAlarmData[2].attendeeList.begin() != testEvent.calendarAlarmData[2].attendeeList.end()){
1476 attendeeData = testEvent.calendarAlarmData[2].attendeeList[0];
1480 ASSERT_EQ("Attendee One", attendeeData);
1482 // Second ATTENDEE property.
1484 attendeeData.clear();
1486 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1488 attendeeData = testEvent.calendarAlarmData[2].attendeeList[1];
1492 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1494 attendeeDataDelegatedFrom = testEvent.calendarAlarmData[2].attendeeListDelegatedFrom[1];
1498 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1500 attendeeDataDelegatedTo = testEvent.calendarAlarmData[2].attendeeListDelegatedTo[1];
1504 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1506 attendeeDataRole = testEvent.calendarAlarmData[2].attendeeListRole[1];
1510 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1512 attendeeDataRSVP = testEvent.calendarAlarmData[2].attendeeListRSVP[1];
1516 ASSERT_EQ("Attendee Two", attendeeData);
1517 ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
1518 ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
1519 ASSERT_EQ("CHAIR", attendeeDataRole);
1520 ASSERT_EQ("TRUE", attendeeDataRSVP);
1522 // Third ATTENDEE property.
1524 attendeeData.clear();
1526 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1528 attendeeData = testEvent.calendarAlarmData[2].attendeeList[2];
1532 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1534 attendeeDataDirectoryEntry = testEvent.calendarAlarmData[2].attendeeListDirectoryEntry[2];
1538 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1540 attendeeDataSentBy = testEvent.calendarAlarmData[2].attendeeListSentBy[2];
1544 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1546 attendeeDataCommonName = testEvent.calendarAlarmData[2].attendeeListCommonName[2];
1550 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1552 attendeeDataCalendarUserType = testEvent.calendarAlarmData[2].attendeeListCalendarUserType[2];
1556 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1558 attendeeDataParticipationStatus = testEvent.calendarAlarmData[2].attendeeListParticipationStatus[2];
1562 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1564 attendeeDataLanguage = testEvent.calendarAlarmData[2].attendeeListLanguage[2];
1568 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1570 attendeeDataTokens = testEvent.calendarAlarmData[2].attendeeListTokens[2];
1574 ASSERT_EQ("Attendee Three", attendeeData);
1575 ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
1576 ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
1577 ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
1578 ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
1579 ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
1580 ASSERT_EQ("kw", attendeeDataLanguage);
1581 ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
1583 // Tests for ATTACH. First ATTACH property.
1585 if (testEvent.calendarAlarmData[2].attachList.begin() != testEvent.calendarAlarmData[2].attachList.end()){
1587 attachData = testEvent.calendarAlarmData[2].attachList[0];
1591 if (testEvent.calendarAlarmData[2].attachListFormatType.begin() != testEvent.calendarAlarmData[2].attachListFormatType.end()){
1593 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[0];
1597 ASSERT_EQ("http://www.example.com/", attachData);
1598 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1600 // Second ATTACH property.
1603 attachDataFormatType.clear();
1604 attachDataValue.clear();
1605 attachDataEncoding.clear();
1607 if (testEvent.calendarAlarmData[2].attachList.size() > 1){
1609 attachData = testEvent.calendarAlarmData[2].attachList[1];
1613 if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 1){
1615 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[1];
1619 ASSERT_EQ("http://www.example.com/page2.html", attachData);
1620 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1622 // Third ATTACH property.
1625 attachDataFormatType.clear();
1626 attachDataValue.clear();
1627 attachDataEncoding.clear();
1628 attachDataTokens.clear();
1630 if (testEvent.calendarAlarmData[2].attachList.size() > 2){
1632 attachData = testEvent.calendarAlarmData[2].attachList[2];
1636 if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
1638 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[2];
1642 if (testEvent.calendarAlarmData[2].attachListValue.size() > 2){
1644 attachDataValue = testEvent.calendarAlarmData[2].attachListValue[2];
1648 if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
1650 attachDataEncoding = testEvent.calendarAlarmData[2].attachListEncoding[2];
1654 if (testEvent.calendarAlarmData[2].attachListTokens.size() > 2){
1656 attachDataTokens = testEvent.calendarAlarmData[2].attachListTokens[2];
1660 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1661 ASSERT_EQ("text/plain", attachDataFormatType);
1662 ASSERT_EQ("BASE64", attachDataEncoding);
1663 ASSERT_EQ("BINARY", attachDataValue);
1664 ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1666 // Test the first X-Token.
1668 if (testEvent.calendarAlarmData[2].xTokensData.size() > 0){
1670 xTokenData = testEvent.calendarAlarmData[2].xTokensData[0];
1671 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[0];
1675 ASSERT_EQ("Example Data 1", xTokenData);
1676 ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1678 // Test the second X-Token.
1683 if (testEvent.calendarAlarmData[2].xTokensData.size() > 1){
1685 xTokenData = testEvent.calendarAlarmData[2].xTokensData[1];
1686 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[1];
1690 ASSERT_EQ("Example Data 2", xTokenData);
1691 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1693 // Test the third X-Token.
1698 if (testEvent.calendarAlarmData[2].xTokensData.size() > 2){
1700 xTokenData = testEvent.calendarAlarmData[2].xTokensData[2];
1701 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[2];
1705 ASSERT_EQ("Example Data 3", xTokenData);
1706 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);