1 // iCalendarEventLoad.cpp - Xestia Calendar iCalendar Event Component Unit Tests
3 // (c) 2016-2019 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 "CalendarEvent.h"
20 #include <gtest/gtest.h>
22 class iCalendarEventLoadTests : public ::testing::Test
29 virtual void TearDown()
34 TEST_F(iCalendarEventLoadTests, DISABLED_BasicTests){
36 CalendarEventObject testEvent;
38 ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, testEvent.LoadFile("iCalendarEvent-Missing.vcf"));
39 ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, testEvent.LoadFile("iCalendarEvent-InvalidPermissions.vcf"));
40 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load1.vcf"));
44 TEST_F(iCalendarEventLoadTests, BaseObjectVerifyTests){
46 CalendarEventObject testEvent;
47 testEvent.LoadFile("iCalendarEvent-Load1.vcf");
48 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
52 ASSERT_EQ("REQUEST", testEvent.methodData);
53 ASSERT_EQ("EXAMPLE=DATA", testEvent.methodTokens);
55 // Tests for CALSCALE.
57 ASSERT_EQ("GREGORIAN", testEvent.calendarScaleData);
58 ASSERT_EQ("MORE=YES", testEvent.calendarScaleTokens);
62 TEST_F(iCalendarEventLoadTests, ObjectDataTests){
64 CalendarEventObject testEvent;
65 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
66 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
70 ASSERT_EQ("20160122T124100Z", testEvent.dateTimeStampData);
71 ASSERT_EQ("OTHER=PARAM", testEvent.dateTimeStampTokens);
75 ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e0", testEvent.uniqueID);
76 ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", testEvent.uniqueIDTokens);
80 ASSERT_EQ("20160122T183000Z", testEvent.dateTimeStartData);
81 ASSERT_EQ("DATE-TIME", testEvent.dateTimeStartDataValue);
82 ASSERT_EQ("Europe/Truro", testEvent.dateTimeStartDataTimeZoneID);
83 ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", testEvent.dateTimeStartDataTokens);
87 ASSERT_EQ("PUBLIC", testEvent.classData);
88 ASSERT_EQ("CHOCOLATE=BAR", testEvent.classDataTokens);
92 ASSERT_EQ("20160123T081100Z", testEvent.dateTimeCreatedData);
93 ASSERT_EQ("CARAMEL=PLEASE", testEvent.dateTimeCreatedTokens);
95 // Tests for DESCRIPTION.
97 std::string descriptionData;
98 std::string descriptionAltRep;
99 std::string descriptionLanguage;
100 std::string descriptionTokens;
102 if (testEvent.descriptionList.begin() != testEvent.descriptionList.end()){
103 descriptionData = testEvent.descriptionList[0];
106 if (testEvent.descriptionListAltRep.begin() != testEvent.descriptionListAltRep.end()){
107 descriptionAltRep = testEvent.descriptionListAltRep[0];
110 if (testEvent.descriptionListLanguage.begin() != testEvent.descriptionListLanguage.end()){
111 descriptionLanguage = testEvent.descriptionListLanguage[0];
114 if (testEvent.descriptionListTokens.begin() != testEvent.descriptionListTokens.end()){
115 descriptionTokens = testEvent.descriptionListTokens[0];
118 ASSERT_EQ("This is a description of the event.", descriptionData);
119 ASSERT_EQ("null:nodata", descriptionAltRep);
120 ASSERT_EQ("kw", descriptionLanguage);
121 ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", descriptionTokens);
125 ASSERT_EQ("5.0;5.0", testEvent.geographicData);
126 ASSERT_EQ("EXAMPLE=MEEP", testEvent.geographicTokens);
128 // Tests for LAST-MODIFIED.
130 ASSERT_EQ("20160124T093000Z", testEvent.lastModifiedData);
131 ASSERT_EQ("FUTURE=ODD", testEvent.lastModifiedTokens);
133 // Tests for LOCATION.
135 ASSERT_EQ("The Basement, Truro", testEvent.locationData);
136 ASSERT_EQ("null:nodata", testEvent.locationDataAltRep);
137 ASSERT_EQ("kw", testEvent.locationDataLanguage);
138 ASSERT_EQ("EXACT=NO", testEvent.locationDataTokens);
140 // Tests for ORGANIZER.
142 ASSERT_EQ("mailto:organiser@example.com", testEvent.organiserData);
143 ASSERT_EQ("ExampleOrganiser", testEvent.organiserDataCommonName);
144 ASSERT_EQ("null:nodata", testEvent.organiserDataDirectoryEntry);
145 ASSERT_EQ("mailto:organiser.noreply@example.com", testEvent.organiserDataSentByParam);
146 ASSERT_EQ("kw", testEvent.organiserDataLanguage);
147 ASSERT_EQ("HAPPY=DAYS", testEvent.organiserDataTokens);
149 // Tests for PRIORITY.
151 ASSERT_EQ(5, testEvent.priorityData);
152 ASSERT_EQ("STATUS=DEFAULT", testEvent.priorityTokens);
154 // Tests for SEQUENCE.
156 ASSERT_EQ(3, testEvent.sequenceData);
157 ASSERT_EQ("TEST=YAY", testEvent.sequenceTokens);
161 ASSERT_EQ("2.0;Success", testEvent.statusData);
162 ASSERT_EQ("kw", testEvent.statusLanguage);
163 ASSERT_EQ("FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN", testEvent.statusTokens);
165 // Tests for SUMMARY.
167 ASSERT_EQ("A summary of the event.", testEvent.summaryData);
168 ASSERT_EQ("null:nodata", testEvent.summaryDataAltRep);
169 ASSERT_EQ("kw", testEvent.summaryDataLanguage);
170 ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", testEvent.summaryDataTokens);
174 ASSERT_EQ("TRANSPARENT", testEvent.timeTransparencyData);
175 ASSERT_EQ("OPAQUE=NOTYET", testEvent.timeTransparencyDataTokens);
179 ASSERT_EQ("http://www.example.com/", testEvent.urlData);
180 ASSERT_EQ("EXTERNAL=YES", testEvent.urlDataTokens);
182 // Tests for RECURRENCE-ID.
184 ASSERT_EQ("20160124", testEvent.recurranceIDData);
185 ASSERT_EQ("Europe/Truro", testEvent.recurranceIDDataTimeZoneParam);
186 ASSERT_EQ("THISANDFUTURE", testEvent.recurranceIDDataRangeParam);
187 ASSERT_EQ("DATE", testEvent.recurranceIDDataValue);
188 ASSERT_EQ("EXAMPLE=DATA", testEvent.recurranceIDDataTokens);
192 ASSERT_EQ("FREQ=DAILY;COUNT=10", testEvent.recurranceRuleData);
193 ASSERT_EQ("TEST=DATA", testEvent.recurranceRuleDataTokens);
197 ASSERT_EQ("20160124T183000Z", testEvent.dateTimeEndData);
198 ASSERT_EQ("DATE-TIME", testEvent.dateTimeEndDataValue);
199 ASSERT_EQ("Europe/Truro", testEvent.dateTimeEndDataTimeZoneID);
200 ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", testEvent.dateTimeEndDataTokens);
202 // Tests for DURATION. (Done in another file called
203 // iCalendarEvent-Load3.vcf).
205 CalendarEventObject testEvent2;
206 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent2.LoadFile("iCalendarEvent-Load3.vcf"));
207 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent2.ValidBaseObject());
209 ASSERT_EQ("PT1H", testEvent2.durationData);
210 ASSERT_EQ("TEST=EXAMPLE", testEvent2.durationDataTokens);
212 // Tests for ATTACH. First ATTACH property.
214 std::string attachData;
215 std::string attachDataFormatType;
216 std::string attachDataValue;
217 std::string attachDataEncoding;
218 std::string attachDataTokens;
220 if (testEvent.attachList.begin() != testEvent.attachList.end()){
222 attachData = testEvent.attachList[0];
226 if (testEvent.attachListFormatType.begin() != testEvent.attachListFormatType.end()){
228 attachDataFormatType = testEvent.attachListFormatType[0];
232 ASSERT_EQ("http://www.example.com/", attachData);
233 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
235 // Second ATTACH property.
238 attachDataFormatType.clear();
239 attachDataValue.clear();
240 attachDataEncoding.clear();
242 if (testEvent.attachList.size() > 1){
244 attachData = testEvent.attachList[1];
248 if (testEvent.attachListFormatType.size() > 1){
250 attachDataFormatType = testEvent.attachListFormatType[1];
254 ASSERT_EQ("http://www.example.com/page2.html", attachData);
255 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
257 // Third ATTACH property.
260 attachDataFormatType.clear();
261 attachDataValue.clear();
262 attachDataEncoding.clear();
263 attachDataTokens.clear();
265 if (testEvent.attachList.size() > 2){
267 attachData = testEvent.attachList[2];
271 if (testEvent.attachListFormatType.size() > 2){
273 attachDataFormatType = testEvent.attachListFormatType[2];
277 if (testEvent.attachListValue.size() > 2){
279 attachDataValue = testEvent.attachListValue[2];
283 if (testEvent.attachListFormatType.size() > 2){
285 attachDataEncoding = testEvent.attachListEncoding[2];
289 if (testEvent.attachListTokens.size() > 2){
291 attachDataTokens = testEvent.attachListTokens[2];
295 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
296 ASSERT_EQ("text/plain", attachDataFormatType);
297 ASSERT_EQ("BASE64", attachDataEncoding);
298 ASSERT_EQ("BINARY", attachDataValue);
299 ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
301 // Tests for ATTENDEE. First ATTENDEE property.
303 std::string attendeeDataMember;
304 std::string attendeeDataDelegatedFrom;
305 std::string attendeeDataDelegatedTo;
306 std::string attendeeDataRole;
307 std::string attendeeDataRSVP;
308 std::string attendeeDataDirectoryEntry;
309 std::string attendeeDataSentBy;
310 std::string attendeeDataCommonName;
311 std::string attendeeDataCalendarUserType;
312 std::string attendeeDataParticipationStatus;
313 std::string attendeeDataLanguage;
314 std::string attendeeDataTokens;
315 std::string attendeeData;
317 if (testEvent.attendeeList.begin() != testEvent.attendeeList.end()){
319 attendeeData = testEvent.attendeeList[0];
323 ASSERT_EQ("Attendee One", attendeeData);
325 // Second ATTENDEE property.
327 attendeeData.clear();
329 if (testEvent.attendeeList.size() > 1){
331 attendeeData = testEvent.attendeeList[1];
335 if (testEvent.attendeeList.size() > 1){
337 attendeeDataDelegatedFrom = testEvent.attendeeListDelegatedFrom[1];
341 if (testEvent.attendeeList.size() > 1){
343 attendeeDataDelegatedTo = testEvent.attendeeListDelegatedTo[1];
347 if (testEvent.attendeeList.size() > 1){
349 attendeeDataRole = testEvent.attendeeListRole[1];
353 if (testEvent.attendeeList.size() > 1){
355 attendeeDataRSVP = testEvent.attendeeListRSVP[1];
359 ASSERT_EQ("Attendee Two", attendeeData);
360 ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
361 ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
362 ASSERT_EQ("CHAIR", attendeeDataRole);
363 ASSERT_EQ("TRUE", attendeeDataRSVP);
365 // Third ATTENDEE property.
367 attendeeData.clear();
369 if (testEvent.attendeeList.size() > 2){
371 attendeeData = testEvent.attendeeList[2];
375 if (testEvent.attendeeList.size() > 2){
377 attendeeDataDirectoryEntry = testEvent.attendeeListDirectoryEntry[2];
381 if (testEvent.attendeeList.size() > 2){
383 attendeeDataSentBy = testEvent.attendeeListSentBy[2];
387 if (testEvent.attendeeList.size() > 2){
389 attendeeDataCommonName = testEvent.attendeeListCommonName[2];
393 if (testEvent.attendeeList.size() > 2){
395 attendeeDataCalendarUserType = testEvent.attendeeListCalendarUserType[2];
399 if (testEvent.attendeeList.size() > 2){
401 attendeeDataParticipationStatus = testEvent.attendeeListParticipationStatus[2];
405 if (testEvent.attendeeList.size() > 2){
407 attendeeDataLanguage = testEvent.attendeeListLanguage[2];
411 if (testEvent.attendeeList.size() > 2){
413 attendeeDataTokens = testEvent.attendeeListTokens[2];
417 ASSERT_EQ("Attendee Three", attendeeData);
418 ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
419 ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
420 ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
421 ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
422 ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
423 ASSERT_EQ("kw", attendeeDataLanguage);
424 ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
426 // Get the first CATEGORIES.
428 std::string categoryData;
430 if (testEvent.categoriesList.begin() != testEvent.categoriesList.end()){
432 categoryData = testEvent.categoriesList[0];
436 ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", categoryData);
438 categoryData.clear();
440 std::string categoryLanguage;
442 // Get the second CATEGORIES.
444 if (testEvent.categoriesList.size() > 1){
446 categoryData = testEvent.categoriesList[1];
450 if (testEvent.categoriesList.size() > 1){
452 categoryLanguage = testEvent.categoriesListLanguage[1];
456 ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", categoryData);
457 ASSERT_EQ("en", categoryLanguage);
459 categoryData.clear();
460 categoryLanguage.clear();
462 // Get the third CATEGORIES.
464 std::string categoryTokens;
466 if (testEvent.categoriesList.size() > 2){
468 categoryData = testEvent.categoriesList[2];
472 if (testEvent.categoriesList.size() > 2){
474 categoryLanguage = testEvent.categoriesListLanguage[2];
478 if (testEvent.categoriesList.size() > 2){
480 categoryTokens = testEvent.categoriesListTokens[2];
484 ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", categoryData);
485 ASSERT_EQ("en-GB", categoryLanguage);
486 ASSERT_EQ("SAMPLE=TOKEN", categoryTokens);
488 // Get the first COMMENT.
490 std::string commentData;
492 if (testEvent.commentList.begin() != testEvent.commentList.end()){
494 commentData = testEvent.commentList[0];
498 ASSERT_EQ("This is the first comment.", commentData);
500 // Get the second COMMENT.
504 std::string commentDataAltRep;
505 std::string commentDataLanguage;
507 if (testEvent.commentList.size() > 1){
509 commentData = testEvent.commentList[1];
513 if (testEvent.commentList.size() > 1){
515 commentDataAltRep = testEvent.commentListAltRep[1];
519 if (testEvent.commentList.size() > 1){
521 commentDataLanguage = testEvent.commentListLanguage[1];
525 ASSERT_EQ("This is the second comment.", commentData);
526 ASSERT_EQ("null:nodata", commentDataAltRep);
527 ASSERT_EQ("en", commentDataLanguage);
529 // Get the third COMMENT.
533 std::string commentDataTokens;
535 if (testEvent.commentList.size() > 2){
537 commentData = testEvent.commentList[2];
541 if (testEvent.commentList.size() > 2){
543 commentDataTokens = testEvent.commentListTokens[2];
547 ASSERT_EQ("This is the third comment.", commentData);
548 ASSERT_EQ("ZEBRAS=YES", commentDataTokens);
550 // Get the first CONTACT.
552 std::string contactData;
554 if (testEvent.contactList.begin() != testEvent.contactList.end()){
556 contactData = testEvent.contactList[0];
560 ASSERT_EQ("First Contact", contactData);
562 // Get the second CONTACT.
566 std::string contactDataAltRep;
567 std::string contactDataLanguage;
569 if (testEvent.contactList.size() > 1){
571 contactData = testEvent.contactList[1];
575 if (testEvent.contactList.size() > 1){
577 contactDataAltRep = testEvent.contactListAltRep[1];
581 if (testEvent.contactList.size() > 1){
583 contactDataLanguage = testEvent.contactListLanguage[1];
587 ASSERT_EQ("Second Contact", contactData);
588 ASSERT_EQ("null:nodata", contactDataAltRep);
589 ASSERT_EQ("en-GB", contactDataLanguage);
591 // Get the third CONTACT.
595 std::string contactDataTokens;
597 if (testEvent.contactList.size() > 2){
599 contactData = testEvent.contactList[2];
603 if (testEvent.contactList.size() > 2){
605 contactDataTokens = testEvent.contactListTokens[2];
609 ASSERT_EQ("Third Contact", contactData);
610 ASSERT_EQ("ZEBRAS=NO", contactDataTokens);
612 // Get the first EXDATE.
614 std::string excludeDate;
616 if (testEvent.excludeDateData.begin() != testEvent.excludeDateData.end()){
618 excludeDate = testEvent.excludeDateData[0];
622 ASSERT_EQ("20160125T120000Z", excludeDate);
624 // Get the second EXDATE.
628 std::string excludeDataTimeZoneParam;
629 std::string excludeDataValue;
631 if (testEvent.contactList.size() > 1){
633 excludeDate = testEvent.excludeDateData[1];
637 if (testEvent.contactList.size() > 1){
639 excludeDataTimeZoneParam = testEvent.excludeDateDataTimeZoneParam[1];
643 if (testEvent.contactList.size() > 1){
645 excludeDataValue = testEvent.excludeDateDataValue[1];
649 ASSERT_EQ("20160125T130000Z", excludeDate);
650 ASSERT_EQ("DATE-TIME", excludeDataValue);
651 ASSERT_EQ("Europe/Truro", excludeDataTimeZoneParam);
653 // Get the third EXDATE.
657 std::string excludeDataTokens;
659 if (testEvent.contactList.size() > 2){
661 excludeDate = testEvent.excludeDateData[2];
665 if (testEvent.contactList.size() > 2){
667 excludeDataTokens = testEvent.excludeDateDataTokens[2];
671 ASSERT_EQ("20160125T133000Z", excludeDate);
672 ASSERT_EQ("ZOOP=ZIPPO", excludeDataTokens);
674 // Get the first REQUEST-STATUS.
676 std::string requestStatus;
678 if (testEvent.requestStatusData.begin() != testEvent.requestStatusData.end()){
680 requestStatus = testEvent.requestStatusData[0];
684 ASSERT_EQ("2.0;Success", requestStatus);
686 // Get the second REQUEST-STATUS.
688 requestStatus.clear();
690 std::string requestLanguage;
692 if (testEvent.requestStatusData.size() > 1){
694 requestStatus = testEvent.requestStatusData[1];
698 if (testEvent.requestStatusData.size() > 1){
700 requestLanguage = testEvent.requestStatusLanguage[1];
704 ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", requestStatus);
705 ASSERT_EQ("en", requestLanguage);
707 // Get the third REQUEST-STATUS.
709 requestStatus.clear();
711 std::string requestTokens;
713 if (testEvent.requestStatusData.size() > 2){
715 requestStatus = testEvent.requestStatusData[2];
719 if (testEvent.requestStatusData.size() > 2){
721 requestTokens = testEvent.requestStatusTokens[2];
725 ASSERT_EQ("3.7;Invalid calendar user", requestStatus);
726 ASSERT_EQ("USER=MISSING", requestTokens);
728 // Get the first RELATED-TO.
730 std::string relatedTo;
732 if (testEvent.relatedToData.begin() != testEvent.relatedToData.end()){
734 relatedTo = testEvent.relatedToData[0];
738 ASSERT_EQ("person.1@example.com", relatedTo);
740 // Get the second RELATED-TO.
744 std::string relatedToType;
746 if (testEvent.relatedToData.size() > 1){
748 relatedTo = testEvent.relatedToData[1];
752 if (testEvent.relatedToData.size() > 1){
754 relatedToType = testEvent.relatedToDataRelationType[1];
758 ASSERT_EQ("person.2@example.com", relatedTo);
759 ASSERT_EQ("PARENT", relatedToType);
761 // Get the third RELATED-TO.
765 std::string relatedToTokens;
767 if (testEvent.relatedToData.size() > 2){
769 relatedTo = testEvent.relatedToData[2];
773 if (testEvent.relatedToData.size() > 2){
775 relatedToTokens = testEvent.relatedToDataTokens[2];
779 ASSERT_EQ("person.3@example.com", relatedTo);
780 ASSERT_EQ("SCHOOL=MEETING", relatedToTokens);
782 // Get the first RESOURCES.
784 std::string resources;
786 if (testEvent.resourcesData.begin() != testEvent.resourcesData.end()){
788 resources = testEvent.resourcesData[0];
792 ASSERT_EQ("DMAC RECEIVER", resources);
794 // Get the second RESOURCES.
798 std::string resourcesLanguage;
800 if (testEvent.resourcesData.size() > 1){
802 resources = testEvent.resourcesData[1];
806 if (testEvent.resourcesData.size() > 1){
808 resourcesLanguage = testEvent.resourcesDataLanguage[1];
812 ASSERT_EQ("PAL-I TELEVISION SET", resources);
813 ASSERT_EQ("en", resourcesLanguage);
815 // Get the third RESOURCES.
819 std::string resourcesAltRep;
820 std::string resourcesTokens;
822 if (testEvent.resourcesData.size() > 2){
824 resources = testEvent.resourcesData[2];
828 if (testEvent.resourcesData.size() > 2){
830 resourcesAltRep = testEvent.resourcesDataAltRep[2];
834 if (testEvent.resourcesData.size() > 2){
836 resourcesTokens = testEvent.resourcesDataTokens[2];
840 ASSERT_EQ("PAL/SECAM VCR", resources);
841 ASSERT_EQ("null:nodata", resourcesAltRep);
842 ASSERT_EQ("STATUS=BROKEN", resourcesTokens);
844 // Get the first RDATE.
846 std::string recurrenceDate;
848 if (testEvent.recurranceDateData.begin() != testEvent.recurranceDateData.end()){
850 recurrenceDate = testEvent.recurranceDateData[0];
854 ASSERT_EQ("20160120", recurrenceDate);
856 // Get the second RDATE.
858 recurrenceDate.clear();
860 std::string recurrenceDateTimeZoneParam;
861 std::string recurrenceDateValue;
863 if (testEvent.recurranceDateData.size() > 1){
865 recurrenceDate = testEvent.recurranceDateData[1];
869 if (testEvent.recurranceDateData.size() > 1){
871 recurrenceDateTimeZoneParam = testEvent.recurranceDateDataTimeZoneParam[1];
875 if (testEvent.recurranceDateData.size() > 1){
877 recurrenceDateValue = testEvent.recurranceDateDataValue[1];
881 ASSERT_EQ("20160121", recurrenceDate);
882 ASSERT_EQ("DATE", recurrenceDateValue);
883 ASSERT_EQ("Europe/Truro", recurrenceDateTimeZoneParam);
885 // Get the third RDATE.
887 recurrenceDate.clear();
889 std::string recurrenceTokens;
891 if (testEvent.recurranceDateData.size() > 2){
893 recurrenceDate = testEvent.recurranceDateData[2];
897 if (testEvent.recurranceDateData.size() > 2){
899 recurrenceTokens = testEvent.recurranceDateDataTokens[2];
903 ASSERT_EQ("20160520", recurrenceDate);
904 ASSERT_EQ("ZILCH=DATA", recurrenceTokens);
906 // Get the first X-EXAMPLE1 token.
908 std::string xTokenName;
909 std::string xTokenData;
911 if (testEvent.xTokensData.size() != 0 ){
913 xTokenData = testEvent.xTokensData[0];
917 if (testEvent.xTokensData.size() != 0){
919 xTokenName = testEvent.xTokensDataTokens[0];
923 ASSERT_EQ("Moo", xTokenData);
924 ASSERT_EQ("X-EXAMPLE1", xTokenName);
926 // Get the second X-EXAMPLE1 token.
931 if (testEvent.xTokensData.size() > 1){
933 xTokenData = testEvent.xTokensData[1];
937 if (testEvent.xTokensData.size() > 1){
939 xTokenName = testEvent.xTokensDataTokens[1];
943 ASSERT_EQ("Meep", xTokenData);
944 ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", xTokenName);
946 // Get the third X-EXAMPLE1 token.
951 if (testEvent.xTokensData.size() > 2){
953 xTokenData = testEvent.xTokensData[2];
957 if (testEvent.xTokensData.size() > 2){
959 xTokenName = testEvent.xTokensDataTokens[2];
963 ASSERT_EQ("Meow", xTokenData);
964 ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", xTokenName);
966 // Get the first X-EXAMPLE2 token.
971 if (testEvent.xTokensData.size() > 3){
973 xTokenData = testEvent.xTokensData[3];
977 if (testEvent.xTokensData.size() > 3){
979 xTokenName = testEvent.xTokensDataTokens[3];
983 ASSERT_EQ("Dish", xTokenData);
984 ASSERT_EQ("X-EXAMPLE2", xTokenName);
986 // Get the second X-EXAMPLE2 token.
991 if (testEvent.xTokensData.size() > 4){
993 xTokenData = testEvent.xTokensData[4];
997 if (testEvent.xTokensData.size() > 4){
999 xTokenName = testEvent.xTokensDataTokens[4];
1003 ASSERT_EQ("Fork", xTokenData);
1004 ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", xTokenName);
1006 // Get the third X-EXAMPLE2 token.
1011 if (testEvent.xTokensData.size() > 5){
1013 xTokenData = testEvent.xTokensData[5];
1017 if (testEvent.xTokensData.size() > 5){
1019 xTokenName = testEvent.xTokensDataTokens[5];
1023 ASSERT_EQ("Table", xTokenData);
1024 ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", xTokenName);
1026 // Get the X-STATUS token.
1031 if (testEvent.xTokensData.size() > 6){
1033 xTokenData = testEvent.xTokensData[6];
1037 if (testEvent.xTokensData.size() > 6){
1039 xTokenName = testEvent.xTokensDataTokens[6];
1043 ASSERT_EQ("Idle", xTokenData);
1044 ASSERT_EQ("X-STATUS;HOLIDAY=YES", xTokenName);
1046 // Get the X-TRANSPORT token.
1051 if (testEvent.xTokensData.size() > 7){
1053 xTokenData = testEvent.xTokensData[7];
1057 if (testEvent.xTokensData.size() > 7){
1059 xTokenName = testEvent.xTokensDataTokens[7];
1063 ASSERT_EQ("Private Hire", xTokenData);
1064 ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", xTokenName);
1066 // Get the X-PHANTOM-STATUS token.
1071 if (testEvent.xTokensData.size() > 8){
1073 xTokenData = testEvent.xTokensData[8];
1077 if (testEvent.xTokensData.size() > 8){
1079 xTokenName = testEvent.xTokensDataTokens[8];
1083 ASSERT_EQ("None", xTokenData);
1084 ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", xTokenName);
1088 TEST_F(iCalendarEventLoadTests, AlarmTests){
1090 CalendarEventObject testEvent;
1091 ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
1092 ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
1094 // Tests for the first VALARM property.
1096 std::string actionData;
1097 std::string actionDataTokens;
1099 std::string triggerData;
1100 std::string triggerRelated;
1101 std::string triggerValue;
1102 std::string triggerTokens;
1104 std::string durationData;
1105 std::string durationTokens;
1107 std::string repeatData;
1108 std::string repeatTokens;
1110 std::string xTokenData;
1111 std::string xTokenName;
1113 if (testEvent.calendarAlarmData.size() > 0){
1115 actionData = testEvent.calendarAlarmData[0].alarmAction;
1116 actionDataTokens = testEvent.calendarAlarmData[0].alarmActionTokens;
1118 triggerData = testEvent.calendarAlarmData[0].triggerData;
1119 triggerRelated = testEvent.calendarAlarmData[0].triggerRelated;
1120 triggerValue = testEvent.calendarAlarmData[0].triggerValue;
1121 triggerTokens = testEvent.calendarAlarmData[0].triggerTokens;
1123 durationData = testEvent.calendarAlarmData[0].durationData;
1124 durationTokens = testEvent.calendarAlarmData[0].durationTokens;
1126 repeatData = testEvent.calendarAlarmData[0].repeatData;
1127 repeatTokens = testEvent.calendarAlarmData[0].repeatTokens;
1131 ASSERT_EQ("AUDIO", actionData);
1132 ASSERT_EQ("FUNKY=SOUNDS", actionDataTokens);
1134 ASSERT_EQ("20160220T160000Z", triggerData);
1135 ASSERT_EQ("END", triggerRelated);
1136 ASSERT_EQ("DATE-TIME", triggerValue);
1137 ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1139 ASSERT_EQ("PT5H", durationData);
1140 ASSERT_EQ("FLYING=NO", durationTokens);
1142 ASSERT_EQ("PT5M", repeatData);
1143 ASSERT_EQ("NEVER=SLEEP", repeatTokens);
1145 // Tests for ATTACH. First ATTACH property.
1147 std::string attachData;
1148 std::string attachDataFormatType;
1149 std::string attachDataValue;
1150 std::string attachDataEncoding;
1151 std::string attachDataTokens;
1153 if (testEvent.calendarAlarmData[0].attachList.begin() != testEvent.calendarAlarmData[0].attachList.end()){
1155 attachData = testEvent.attachList[0];
1159 if (testEvent.calendarAlarmData[0].attachListFormatType.begin() != testEvent.calendarAlarmData[0].attachListFormatType.end()){
1161 attachDataFormatType = testEvent.attachListFormatType[0];
1165 ASSERT_EQ("http://www.example.com/", attachData);
1166 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1168 // Second ATTACH property.
1171 attachDataFormatType.clear();
1172 attachDataValue.clear();
1173 attachDataEncoding.clear();
1175 if (testEvent.calendarAlarmData[0].attachList.size() > 1){
1177 attachData = testEvent.calendarAlarmData[0].attachList[1];
1181 if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 1){
1183 attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[1];
1187 ASSERT_EQ("http://www.example.com/page2.html", attachData);
1188 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1190 // Third ATTACH property.
1193 attachDataFormatType.clear();
1194 attachDataValue.clear();
1195 attachDataEncoding.clear();
1196 attachDataTokens.clear();
1198 if (testEvent.calendarAlarmData[0].attachList.size() > 2){
1200 attachData = testEvent.calendarAlarmData[0].attachList[2];
1204 if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
1206 attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[2];
1210 if (testEvent.calendarAlarmData[0].attachListValue.size() > 2){
1212 attachDataValue = testEvent.calendarAlarmData[0].attachListValue[2];
1216 if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
1218 attachDataEncoding = testEvent.calendarAlarmData[0].attachListEncoding[2];
1222 if (testEvent.calendarAlarmData[0].attachListTokens.size() > 2){
1224 attachDataTokens = testEvent.calendarAlarmData[0].attachListTokens[2];
1228 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1229 ASSERT_EQ("text/plain", attachDataFormatType);
1230 ASSERT_EQ("BASE64", attachDataEncoding);
1231 ASSERT_EQ("BINARY", attachDataValue);
1232 ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1234 // Test the first X-Token.
1236 if (testEvent.calendarAlarmData[0].xTokensData.size() > 0){
1238 xTokenData = testEvent.calendarAlarmData[0].xTokensData[0];
1239 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[0];
1243 ASSERT_EQ("Example Data 1", xTokenData);
1244 ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1246 // Test the second X-Token.
1251 if (testEvent.calendarAlarmData[0].xTokensData.size() > 1){
1253 xTokenData = testEvent.calendarAlarmData[0].xTokensData[1];
1254 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[1];
1258 ASSERT_EQ("Example Data 2", xTokenData);
1259 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1261 // Test the third X-Token.
1266 if (testEvent.calendarAlarmData[0].xTokensData.size() > 2){
1268 xTokenData = testEvent.calendarAlarmData[0].xTokensData[2];
1269 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[2];
1273 ASSERT_EQ("Example Data 3", xTokenData);
1274 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1276 // Tests for the second VALARM property.
1279 actionDataTokens.clear();
1281 triggerData.clear();
1282 triggerRelated.clear();
1283 triggerValue.clear();
1284 triggerTokens.clear();
1286 durationData.clear();
1287 durationTokens.clear();
1290 repeatTokens.clear();
1295 string descriptionData;
1296 string descriptionAltRep;
1297 string descriptionLanguage;
1298 string descriptionTokens;
1300 if (testEvent.calendarAlarmData.size() > 1){
1302 actionData = testEvent.calendarAlarmData[1].alarmAction;
1303 actionDataTokens = testEvent.calendarAlarmData[1].alarmActionTokens;
1305 triggerData = testEvent.calendarAlarmData[1].triggerData;
1306 triggerRelated = testEvent.calendarAlarmData[1].triggerRelated;
1307 triggerValue = testEvent.calendarAlarmData[1].triggerValue;
1308 triggerTokens = testEvent.calendarAlarmData[1].triggerTokens;
1310 durationData = testEvent.calendarAlarmData[1].durationData;
1311 durationTokens = testEvent.calendarAlarmData[1].durationTokens;
1313 repeatData = testEvent.calendarAlarmData[1].repeatData;
1314 repeatTokens = testEvent.calendarAlarmData[1].repeatTokens;
1316 descriptionData = testEvent.calendarAlarmData[1].descriptionData;
1317 descriptionAltRep = testEvent.calendarAlarmData[1].descriptionAltRep;
1318 descriptionLanguage = testEvent.calendarAlarmData[1].descriptionLanguage;
1319 descriptionTokens = testEvent.calendarAlarmData[1].descriptionTokens;
1323 ASSERT_EQ("DISPLAY", actionData);
1324 ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1326 ASSERT_EQ("20160230T110000Z", triggerData);
1327 ASSERT_EQ("END", triggerRelated);
1328 ASSERT_EQ("DATE-TIME", triggerValue);
1329 ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1331 ASSERT_EQ("PT7H", durationData);
1332 ASSERT_EQ("FLYING=YES", durationTokens);
1334 ASSERT_EQ("PT3M", repeatData);
1335 ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1337 ASSERT_EQ("This is the second alarm.", descriptionData);
1338 ASSERT_EQ("null:nodata", descriptionAltRep);
1339 ASSERT_EQ("kw", descriptionLanguage);
1340 ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1342 // Test the first X-Token.
1344 if (testEvent.calendarAlarmData[1].xTokensData.size() > 0){
1346 xTokenData = testEvent.calendarAlarmData[1].xTokensData[0];
1347 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[0];
1351 ASSERT_EQ("Example Data 1", xTokenData);
1352 ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1354 // Test the second X-Token.
1359 if (testEvent.calendarAlarmData[1].xTokensData.size() > 1){
1361 xTokenData = testEvent.calendarAlarmData[1].xTokensData[1];
1362 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[1];
1366 ASSERT_EQ("Example Data 2", xTokenData);
1367 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1369 // Test the third X-Token.
1374 if (testEvent.calendarAlarmData[1].xTokensData.size() > 2){
1376 xTokenData = testEvent.calendarAlarmData[1].xTokensData[2];
1377 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[2];
1381 ASSERT_EQ("Example Data 3", xTokenData);
1382 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1384 // Tests for the third VALARM property.
1387 actionDataTokens.clear();
1389 triggerData.clear();
1390 triggerRelated.clear();
1391 triggerValue.clear();
1392 triggerTokens.clear();
1394 durationData.clear();
1395 durationTokens.clear();
1398 repeatTokens.clear();
1403 descriptionData.clear();
1404 descriptionAltRep.clear();
1405 descriptionLanguage.clear();
1406 descriptionTokens.clear();
1409 string summaryAltRep;
1410 string summaryLanguage;
1411 string summaryTokens;
1413 string attendeeDataMember;
1414 string attendeeDataDelegatedFrom;
1415 string attendeeDataDelegatedTo;
1416 string attendeeDataRole;
1417 string attendeeDataRSVP;
1418 string attendeeDataDirectoryEntry;
1419 string attendeeDataSentBy;
1420 string attendeeDataCommonName;
1421 string attendeeDataCalendarUserType;
1422 string attendeeDataParticipationStatus;
1423 string attendeeDataLanguage;
1424 string attendeeDataTokens;
1425 string attendeeData;
1428 attachDataFormatType.clear();
1429 attachDataValue.clear();
1430 attachDataEncoding.clear();
1431 attachDataTokens.clear();
1433 if (testEvent.calendarAlarmData.size() > 2){
1435 actionData = testEvent.calendarAlarmData[2].alarmAction;
1436 actionDataTokens = testEvent.calendarAlarmData[2].alarmActionTokens;
1438 triggerData = testEvent.calendarAlarmData[2].triggerData;
1439 triggerRelated = testEvent.calendarAlarmData[2].triggerRelated;
1440 triggerValue = testEvent.calendarAlarmData[2].triggerValue;
1441 triggerTokens = testEvent.calendarAlarmData[2].triggerTokens;
1443 durationData = testEvent.calendarAlarmData[2].durationData;
1444 durationTokens = testEvent.calendarAlarmData[2].durationTokens;
1446 repeatData = testEvent.calendarAlarmData[2].repeatData;
1447 repeatTokens = testEvent.calendarAlarmData[2].repeatTokens;
1449 descriptionData = testEvent.calendarAlarmData[2].descriptionData;
1450 descriptionAltRep = testEvent.calendarAlarmData[2].descriptionAltRep;
1451 descriptionLanguage = testEvent.calendarAlarmData[2].descriptionLanguage;
1452 descriptionTokens = testEvent.calendarAlarmData[2].descriptionTokens;
1454 summaryData = testEvent.calendarAlarmData[2].summaryData;
1455 summaryAltRep = testEvent.calendarAlarmData[2].summaryAltRep;
1456 summaryLanguage = testEvent.calendarAlarmData[2].summaryLanguage;
1457 summaryTokens = testEvent.calendarAlarmData[2].summaryTokens;
1461 ASSERT_EQ("EMAIL", actionData);
1462 ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1464 ASSERT_EQ("20160230T120000Z", triggerData);
1465 ASSERT_EQ("END", triggerRelated);
1466 ASSERT_EQ("DATE-TIME", triggerValue);
1467 ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1469 ASSERT_EQ("PT7H", durationData);
1470 ASSERT_EQ("FLYING=YES", durationTokens);
1472 ASSERT_EQ("PT3M", repeatData);
1473 ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1475 ASSERT_EQ("This is the third alarm.", descriptionData);
1476 ASSERT_EQ("null:nodata", descriptionAltRep);
1477 ASSERT_EQ("kw", descriptionLanguage);
1478 ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1480 ASSERT_EQ("This is the summary of the third alarm.", summaryData);
1481 ASSERT_EQ("null:nodata", summaryAltRep);
1482 ASSERT_EQ("en", summaryLanguage);
1483 ASSERT_EQ("MEEP=MOOP", summaryTokens);
1485 // Tests for ATTENDEE. First ATTENDEE property.
1487 if (testEvent.calendarAlarmData[2].attendeeList.begin() != testEvent.calendarAlarmData[2].attendeeList.end()){
1489 attendeeData = testEvent.calendarAlarmData[2].attendeeList[0];
1493 ASSERT_EQ("Attendee One", attendeeData);
1495 // Second ATTENDEE property.
1497 attendeeData.clear();
1499 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1501 attendeeData = testEvent.calendarAlarmData[2].attendeeList[1];
1505 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1507 attendeeDataDelegatedFrom = testEvent.calendarAlarmData[2].attendeeListDelegatedFrom[1];
1511 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1513 attendeeDataDelegatedTo = testEvent.calendarAlarmData[2].attendeeListDelegatedTo[1];
1517 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1519 attendeeDataRole = testEvent.calendarAlarmData[2].attendeeListRole[1];
1523 if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1525 attendeeDataRSVP = testEvent.calendarAlarmData[2].attendeeListRSVP[1];
1529 ASSERT_EQ("Attendee Two", attendeeData);
1530 ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
1531 ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
1532 ASSERT_EQ("CHAIR", attendeeDataRole);
1533 ASSERT_EQ("TRUE", attendeeDataRSVP);
1535 // Third ATTENDEE property.
1537 attendeeData.clear();
1539 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1541 attendeeData = testEvent.calendarAlarmData[2].attendeeList[2];
1545 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1547 attendeeDataDirectoryEntry = testEvent.calendarAlarmData[2].attendeeListDirectoryEntry[2];
1551 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1553 attendeeDataSentBy = testEvent.calendarAlarmData[2].attendeeListSentBy[2];
1557 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1559 attendeeDataCommonName = testEvent.calendarAlarmData[2].attendeeListCommonName[2];
1563 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1565 attendeeDataCalendarUserType = testEvent.calendarAlarmData[2].attendeeListCalendarUserType[2];
1569 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1571 attendeeDataParticipationStatus = testEvent.calendarAlarmData[2].attendeeListParticipationStatus[2];
1575 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1577 attendeeDataLanguage = testEvent.calendarAlarmData[2].attendeeListLanguage[2];
1581 if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1583 attendeeDataTokens = testEvent.calendarAlarmData[2].attendeeListTokens[2];
1587 ASSERT_EQ("Attendee Three", attendeeData);
1588 ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
1589 ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
1590 ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
1591 ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
1592 ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
1593 ASSERT_EQ("kw", attendeeDataLanguage);
1594 ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
1596 // Tests for ATTACH. First ATTACH property.
1598 if (testEvent.calendarAlarmData[2].attachList.begin() != testEvent.calendarAlarmData[2].attachList.end()){
1600 attachData = testEvent.calendarAlarmData[2].attachList[0];
1604 if (testEvent.calendarAlarmData[2].attachListFormatType.begin() != testEvent.calendarAlarmData[2].attachListFormatType.end()){
1606 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[0];
1610 ASSERT_EQ("http://www.example.com/", attachData);
1611 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1613 // Second ATTACH property.
1616 attachDataFormatType.clear();
1617 attachDataValue.clear();
1618 attachDataEncoding.clear();
1620 if (testEvent.calendarAlarmData[2].attachList.size() > 1){
1622 attachData = testEvent.calendarAlarmData[2].attachList[1];
1626 if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 1){
1628 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[1];
1632 ASSERT_EQ("http://www.example.com/page2.html", attachData);
1633 ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1635 // Third ATTACH property.
1638 attachDataFormatType.clear();
1639 attachDataValue.clear();
1640 attachDataEncoding.clear();
1641 attachDataTokens.clear();
1643 if (testEvent.calendarAlarmData[2].attachList.size() > 2){
1645 attachData = testEvent.calendarAlarmData[2].attachList[2];
1649 if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
1651 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[2];
1655 if (testEvent.calendarAlarmData[2].attachListValue.size() > 2){
1657 attachDataValue = testEvent.calendarAlarmData[2].attachListValue[2];
1661 if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
1663 attachDataEncoding = testEvent.calendarAlarmData[2].attachListEncoding[2];
1667 if (testEvent.calendarAlarmData[2].attachListTokens.size() > 2){
1669 attachDataTokens = testEvent.calendarAlarmData[2].attachListTokens[2];
1673 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1674 ASSERT_EQ("text/plain", attachDataFormatType);
1675 ASSERT_EQ("BASE64", attachDataEncoding);
1676 ASSERT_EQ("BINARY", attachDataValue);
1677 ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1679 // Test the first X-Token.
1681 if (testEvent.calendarAlarmData[2].xTokensData.size() > 0){
1683 xTokenData = testEvent.calendarAlarmData[2].xTokensData[0];
1684 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[0];
1688 ASSERT_EQ("Example Data 1", xTokenData);
1689 ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1691 // Test the second X-Token.
1696 if (testEvent.calendarAlarmData[2].xTokensData.size() > 1){
1698 xTokenData = testEvent.calendarAlarmData[2].xTokensData[1];
1699 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[1];
1703 ASSERT_EQ("Example Data 2", xTokenData);
1704 ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1706 // Test the third X-Token.
1711 if (testEvent.calendarAlarmData[2].xTokensData.size() > 2){
1713 xTokenData = testEvent.calendarAlarmData[2].xTokensData[2];
1714 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[2];
1718 ASSERT_EQ("Example Data 3", xTokenData);
1719 ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);