Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Implemented UTF8 support in DeleteCalendar function
[xestiacalendar/.git] / source / tests / xestiacalendar_icaltaskload.h
1 // xestiacalendar_icaltaskload.h - Xestia Calendar iCalendar Task Component Unit Tests
2 //
3 // (c) 2016-2017 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
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.
10 //
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.
15 //
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/calendartask/CalendarTask.h"
21 TEST(iCalendarTask, BasicTests){
23         CalendarTaskObject testTask;
24         
25         ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, testTask.LoadFile("iCalendarTask-Missing.vcf"));
26         ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, testTask.LoadFile("iCalendarTask-InvalidPermissions.vcf"));
27         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTask.LoadFile("iCalendarTask-Load1.vcf"));
28         
29 }
31 TEST(iCalendarTask, ObjectDataTests){
33         CalendarTaskObject testTask;
34         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTask.LoadFile("iCalendarTask-Load2.vcf"));
35         ASSERT_EQ(CALENDAROBJECTVALID_OK, testTask.ValidBaseObject());
36         
37         // Tests for DTSTAMP.
38         
39         ASSERT_EQ("20160131T104500Z", testTask.dateTimeStampData);
40         ASSERT_EQ("OTHER=PARAM", testTask.dateTimeStampTokens);
41         
42         // Tests for UID.
43         
44         ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e1", testTask.uniqueID);
45         ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", testTask.uniqueIDTokens);
46         
47         // Tests for CLASS.
48         
49         ASSERT_EQ("PUBLIC", testTask.classData);
50         ASSERT_EQ("CHOCOLATE=NONE", testTask.classDataTokens);
51         
52         // Tests for COMPLETED.
53         
54         ASSERT_EQ("20160131T110100Z", testTask.completedData);
55         ASSERT_EQ("LYING=NEVER", testTask.completedDataTokens);
56         
57         // Tests for CREATED.
59         ASSERT_EQ("20160131T080000Z", testTask.dateTimeCreatedData);
60         ASSERT_EQ("CARAMEL=PLEASE", testTask.dateTimeCreatedTokens);
61         
62         // Tests for DESCRIPTION.
63         
64         std::string descriptionData;
65         std::string descriptionAltRep;
66         std::string descriptionLanguage;
67         std::string descriptionTokens;
68         
69         if (testTask.descriptionList.begin() != testTask.descriptionList.end()){
70                 descriptionData = testTask.descriptionList[0];
71         }
73         if (testTask.descriptionListAltRep.begin() != testTask.descriptionListAltRep.end()){
74                 descriptionAltRep = testTask.descriptionListAltRep[0];
75         }
77         if (testTask.descriptionListLanguage.begin() != testTask.descriptionListLanguage.end()){
78                 descriptionLanguage = testTask.descriptionListLanguage[0];
79         }
81         if (testTask.descriptionListTokens.begin() != testTask.descriptionListTokens.end()){
82                 descriptionTokens = testTask.descriptionListTokens[0];
83         }
84         
85         ASSERT_EQ("This is a description of the todo.", descriptionData);
86         ASSERT_EQ("null:nodata", descriptionAltRep);
87         ASSERT_EQ("kw", descriptionLanguage);
88         ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", descriptionTokens);
89         
90         // Tests for DTSTART.
91         
92         ASSERT_EQ("20160131T103000Z", testTask.dateTimeStartData);
93         ASSERT_EQ("DATE-TIME", testTask.dateTimeStartDataValue);
94         ASSERT_EQ("Europe/Truro", testTask.dateTimeStartDataTimeZoneID);
95         ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", testTask.dateTimeStartDataTokens);
96         
97         // Tests for GEO.
98         
99         ASSERT_EQ("20.0;20.0", testTask.geographicData);
100         ASSERT_EQ("EXAMPLE=MOOP", testTask.geographicTokens);
101         
102         // Tests for LAST-MODIFIED.
103         
104         ASSERT_EQ("20160131T114200Z", testTask.lastModifiedData);
105         ASSERT_EQ("FUTURE=EVEN", testTask.lastModifiedTokens);
106         
107         // Tests for LOCATION.
109         ASSERT_EQ("The Crystal Ceiling, Truro", testTask.locationData);
110         ASSERT_EQ("null:nodata", testTask.locationDataAltRep);
111         ASSERT_EQ("kw", testTask.locationDataLanguage);
112         ASSERT_EQ("EXACT=YES", testTask.locationDataTokens);
113         
114         // Tests for ORGANIZER.
115         
116         ASSERT_EQ("mailto:organiser@example.com", testTask.organiserData);
117         ASSERT_EQ("ExampleOrganiser", testTask.organiserDataCommonName);
118         ASSERT_EQ("null:nodata", testTask.organiserDataDirectoryEntry);
119         ASSERT_EQ("mailto:organiser.noreply@example.com", testTask.organiserDataSentByParam);
120         ASSERT_EQ("kw", testTask.organiserDataLanguage);
121         ASSERT_EQ("HAPPY=WEEKS", testTask.organiserDataTokens);
122         
123         // Tests for PERCENT-COMPLETE.
124         
125         ASSERT_EQ("42", testTask.percentCompleteData);
126         ASSERT_EQ("DEEP=THOUGHT", testTask.percentCompleteTokens);
127         
128         // Tests for PRIORITY.
129         
130         ASSERT_EQ(5, testTask.priorityData);
131         ASSERT_EQ("STATUS=DEFAULT", testTask.priorityTokens);
132         
133         // Tests for RECURRENCE-ID.
134         
135         ASSERT_EQ("20160131", testTask.recurranceIDData);
136         ASSERT_EQ("Europe/Truro", testTask.recurranceIDDataTimeZoneParam);
137         ASSERT_EQ("THISANDFUTURE", testTask.recurranceIDDataRangeParam);
138         ASSERT_EQ("DATE", testTask.recurranceIDDataValue);
139         ASSERT_EQ("EXAMPLE=DATA", testTask.recurranceIDDataTokens);
140         
141         // Tests for SEQUENCE.
142         
143         ASSERT_EQ(3, testTask.sequenceData);
144         ASSERT_EQ("TEST=YAY", testTask.sequenceTokens);
145         
146         // Tests for STATUS.
147         
148         ASSERT_EQ("2.0;Success", testTask.statusData);
149         ASSERT_EQ("kw", testTask.statusLanguage);
150         ASSERT_EQ("FAVOURITE=BEANS;NOTLIKE=UNKNOWN", testTask.statusTokens);
151         
152         // Tests for SUMMARY.
153         
154         ASSERT_EQ("A summary of the todo.", testTask.summaryData);
155         ASSERT_EQ("null:nodata", testTask.summaryDataAltRep);
156         ASSERT_EQ("kw", testTask.summaryDataLanguage);
157         ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", testTask.summaryDataTokens);
158         
159         // Tests for URL.
161         ASSERT_EQ("http://www.example.com/", testTask.urlData);
162         ASSERT_EQ("EXTERNAL=YES", testTask.urlDataTokens);
163         
164         // Tests for RRULE.
165         
166         ASSERT_EQ("FREQ=DAILY;COUNT=10", testTask.recurranceRuleData);
167         ASSERT_EQ("TEST=DATA", testTask.recurranceRuleDataTokens);
168         
169         // Tests for DUE.
170         
171         ASSERT_EQ("20160131T150000Z", testTask.dueData);
172         ASSERT_EQ("Europe/Truro", testTask.dueDataTimeZoneID);
173         ASSERT_EQ("DATE-TIME", testTask.dueDataValue);
174         ASSERT_EQ("TEST=YES", testTask.dueDataTokens);
175         
176         // Tests for DURATION.
177         
178         CalendarTaskObject testTask2;
179         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTask2.LoadFile("iCalendarTask-Load3.vcf"));
180         ASSERT_EQ(CALENDAROBJECTVALID_OK, testTask2.ValidBaseObject());
181         
182         ASSERT_EQ("PT15M", testTask2.durationData);
183         ASSERT_EQ("TEST=YES", testTask2.durationDataTokens);
184         
185         // Tests for ATTACH. First ATTACH property.
187         std::string attachData;
188         std::string attachDataFormatType;
189         std::string attachDataValue;
190         std::string attachDataEncoding;
191         std::string attachDataTokens;
193         if (testTask.attachList.begin() != testTask.attachList.end()){
194                 
195                 attachData = testTask.attachList[0];
196                 
197         }
198         
199         if (testTask.attachListFormatType.begin() != testTask.attachListFormatType.end()){
200                 
201                 attachDataFormatType = testTask.attachListFormatType[0];
202                 
203         }
205         ASSERT_EQ("http://www.example.com/", attachData);
206         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
207         
208         // Second ATTACH property.
209         
210         attachData.clear();
211         attachDataFormatType.clear();
212         attachDataValue.clear();
213         attachDataEncoding.clear();
214         
215         if (testTask.attachList.size() > 1){
216                 
217                 attachData = testTask.attachList[1];
218                 
219         }
220         
221         if (testTask.attachListFormatType.size() > 1){
222                 
223                 attachDataFormatType = testTask.attachListFormatType[1];
224                 
225         }
227         ASSERT_EQ("http://www.example.com/page2.html", attachData);
228         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
229         
230         // Third ATTACH property.
232         attachData.clear();
233         attachDataFormatType.clear();
234         attachDataValue.clear();
235         attachDataEncoding.clear();
236         attachDataTokens.clear();
237         
238         if (testTask.attachList.size() > 2){
239                 
240                 attachData = testTask.attachList[2];
241                 
242         }
243         
244         if (testTask.attachListFormatType.size() > 2){
245                 
246                 attachDataFormatType = testTask.attachListFormatType[2];
247                 
248         }
249         
250         if (testTask.attachListValue.size() > 2){
251                 
252                 attachDataValue = testTask.attachListValue[2];
253                 
254         }
255         
256         if (testTask.attachListFormatType.size() > 2){
257                 
258                 attachDataEncoding = testTask.attachListEncoding[2];
259                 
260         }
262         if (testTask.attachListTokens.size() > 2){
263                 
264                 attachDataTokens = testTask.attachListTokens[2];
265                 
266         }
267         
268         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
269         ASSERT_EQ("text/plain", attachDataFormatType);
270         ASSERT_EQ("BASE64", attachDataEncoding);
271         ASSERT_EQ("BINARY", attachDataValue);
272         ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
273         
274         // Tests for ATTENDEE. First ATTENDEE property.
276         std::string attendeeDataMember;
277         std::string attendeeDataDelegatedFrom;
278         std::string attendeeDataDelegatedTo;
279         std::string attendeeDataRole;
280         std::string attendeeDataRSVP;
281         std::string attendeeDataDirectoryEntry;
282         std::string attendeeDataSentBy;
283         std::string attendeeDataCommonName;
284         std::string attendeeDataCalendarUserType;
285         std::string attendeeDataParticipationStatus;
286         std::string attendeeDataLanguage;
287         std::string attendeeDataTokens;
288         std::string attendeeData;
290         if (testTask.attendeeList.begin() != testTask.attendeeList.end()){
291                 
292                 attendeeData = testTask.attendeeList[0];
293                 
294         }
295         
296         ASSERT_EQ("Attendee One", attendeeData);
297         
298         // Second ATTENDEE property.
299         
300         attendeeData.clear();
301         
302         if (testTask.attendeeList.size() > 1){
303                 
304                 attendeeData = testTask.attendeeList[1];
305                 
306         }
308         if (testTask.attendeeList.size() > 1){
309                 
310                 attendeeDataDelegatedFrom = testTask.attendeeListDelegatedFrom[1];
311                 
312         }
313         
314         if (testTask.attendeeList.size() > 1){
315                 
316                 attendeeDataDelegatedTo = testTask.attendeeListDelegatedTo[1];
317                 
318         }
320         if (testTask.attendeeList.size() > 1){
321                 
322                 attendeeDataRole = testTask.attendeeListRole[1];
323                 
324         }
325         
326         if (testTask.attendeeList.size() > 1){
327                 
328                 attendeeDataRSVP = testTask.attendeeListRSVP[1];
329                 
330         }
331         
332         ASSERT_EQ("Attendee Two", attendeeData);
333         ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
334         ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
335         ASSERT_EQ("CHAIR", attendeeDataRole);
336         ASSERT_EQ("TRUE", attendeeDataRSVP);
338         // Third ATTENDEE property.
339         
340         attendeeData.clear();
341         
342         if (testTask.attendeeList.size() > 2){
343                 
344                 attendeeData = testTask.attendeeList[2];
345                 
346         }
348         if (testTask.attendeeList.size() > 2){
349                 
350                 attendeeDataDirectoryEntry = testTask.attendeeListDirectoryEntry[2];
351                 
352         }
353         
354         if (testTask.attendeeList.size() > 2){
355                 
356                 attendeeDataSentBy = testTask.attendeeListSentBy[2];
357                 
358         }
360         if (testTask.attendeeList.size() > 2){
361                 
362                 attendeeDataCommonName = testTask.attendeeListCommonName[2];
363                 
364         }
365         
366         if (testTask.attendeeList.size() > 2){
367                 
368                 attendeeDataCalendarUserType = testTask.attendeeListCalendarUserType[2];
369                 
370         }
372         if (testTask.attendeeList.size() > 2){
373                 
374                 attendeeDataParticipationStatus = testTask.attendeeListParticipationStatus[2];
375                 
376         }
378         if (testTask.attendeeList.size() > 2){
379                 
380                 attendeeDataLanguage = testTask.attendeeListLanguage[2];
381                 
382         }
383         
384         if (testTask.attendeeList.size() > 2){
385                 
386                 attendeeDataTokens = testTask.attendeeListTokens[2];
387                 
388         }
389         
390         ASSERT_EQ("Attendee Three", attendeeData);
391         ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
392         ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
393         ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
394         ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
395         ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
396         ASSERT_EQ("kw", attendeeDataLanguage);
397         ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
398         
399         // Get the first CATEGORIES.
400         
401         std::string categoryData;
402         
403         if (testTask.categoriesList.begin() != testTask.categoriesList.end()){
404                 
405                 categoryData = testTask.categoriesList[0];
406                 
407         }
408         
409         ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", categoryData);
410         
411         categoryData.clear();
413         std::string categoryLanguage;
414         
415         // Get the second CATEGORIES.
416         
417         if (testTask.categoriesList.size() > 1){
418                 
419                 categoryData = testTask.categoriesList[1];
420                 
421         }
422         
423         if (testTask.categoriesList.size() > 1){
424                 
425                 categoryLanguage = testTask.categoriesListLanguage[1];
426                 
427         }
428                 
429         ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", categoryData);
430         ASSERT_EQ("en", categoryLanguage);
431         
432         categoryData.clear();
433         categoryLanguage.clear();
434         
435         // Get the third CATEGORIES.
436         
437         std::string categoryTokens;
438         
439         if (testTask.categoriesList.size() > 2){
440                 
441                 categoryData = testTask.categoriesList[2];
442                 
443         }
444         
445         if (testTask.categoriesList.size() > 2){
446                 
447                 categoryLanguage = testTask.categoriesListLanguage[2];
448                 
449         }
450         
451         if (testTask.categoriesList.size() > 2){
452                 
453                 categoryTokens = testTask.categoriesListTokens[2];
454                 
455         }
456                 
457         ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", categoryData);
458         ASSERT_EQ("en-GB", categoryLanguage);
459         ASSERT_EQ("SAMPLE=TOKEN", categoryTokens);
460         
461         // Get the first COMMENT.
462         
463         std::string commentData;
464         
465         if (testTask.commentList.begin() != testTask.commentList.end()){
466                 
467                 commentData = testTask.commentList[0];
468                 
469         }
470         
471         ASSERT_EQ("This is the first comment.", commentData);
472         
473         // Get the second COMMENT.
474         
475         commentData.clear();
476         
477         std::string commentDataAltRep;
478         std::string commentDataLanguage;
479         
480         if (testTask.commentList.size() > 1){
481                 
482                 commentData = testTask.commentList[1];
483                 
484         }
485         
486         if (testTask.commentList.size() > 1){
487                 
488                 commentDataAltRep = testTask.commentListAltRep[1];
489                 
490         }
491         
492         if (testTask.commentList.size() > 1){
493                 
494                 commentDataLanguage = testTask.commentListLanguage[1];
495                 
496         }
497         
498         ASSERT_EQ("This is the second comment.", commentData);
499         ASSERT_EQ("null:nodata", commentDataAltRep);
500         ASSERT_EQ("en", commentDataLanguage);
501         
502         // Get the third COMMENT.
503         
504         commentData.clear();
505         
506         std::string commentDataTokens;
507         
508         if (testTask.commentList.size() > 2){
509                 
510                 commentData = testTask.commentList[2];
511                 
512         }
513         
514         if (testTask.commentList.size() > 2){
515                 
516                 commentDataTokens = testTask.commentListTokens[2];
517                 
518         }
519         
520         ASSERT_EQ("This is the third comment.", commentData);
521         ASSERT_EQ("ZEBRAS=YES", commentDataTokens);
523         // Get the first CONTACT.
524         
525         std::string contactData;
526         
527         if (testTask.contactList.begin() != testTask.contactList.end()){
528                 
529                 contactData = testTask.contactList[0];
530                 
531         }
532         
533         ASSERT_EQ("First Contact", contactData);
534         
535         // Get the second CONTACT.
536         
537         contactData.clear();
538         
539         std::string contactDataAltRep;
540         std::string contactDataLanguage;
541         
542         if (testTask.contactList.size() > 1){
543                 
544                 contactData = testTask.contactList[1];
545                 
546         }
547         
548         if (testTask.contactList.size() > 1){
549                 
550                 contactDataAltRep = testTask.contactListAltRep[1];
551                 
552         }
553         
554         if (testTask.contactList.size() > 1){
555                 
556                 contactDataLanguage = testTask.contactListLanguage[1];
557                 
558         }
559         
560         ASSERT_EQ("Second Contact", contactData);
561         ASSERT_EQ("null:nodata", contactDataAltRep);
562         ASSERT_EQ("en-GB", contactDataLanguage);
563         
564         // Get the third CONTACT.
565         
566         contactData.clear();
567         
568         std::string contactDataTokens;
569         
570         if (testTask.contactList.size() > 2){
571                 
572                 contactData = testTask.contactList[2];
573                 
574         }
575         
576         if (testTask.contactList.size() > 2){
577                 
578                 contactDataTokens = testTask.contactListTokens[2];
579                 
580         }
581         
582         ASSERT_EQ("Third Contact", contactData);
583         ASSERT_EQ("ZEBRAS=NO", contactDataTokens);
585         // Get the first EXDATE.
586         
587         std::string excludeDate;
588         
589         if (testTask.excludeDateData.begin() != testTask.excludeDateData.end()){
590                 
591                 excludeDate = testTask.excludeDateData[0];
592                 
593         }
594         
595         ASSERT_EQ("20160125T120000Z", excludeDate);
596         
597         // Get the second EXDATE.
599         excludeDate.clear();
600         
601         std::string excludeDataTimeZoneParam;
602         std::string excludeDataValue;
603         
604         if (testTask.contactList.size() > 1){
605                 
606                 excludeDate = testTask.excludeDateData[1];
607                 
608         }
609         
610         if (testTask.contactList.size() > 1){
611                 
612                 excludeDataTimeZoneParam = testTask.excludeDateDataTimeZoneParam[1];
613                 
614         }
615         
616         if (testTask.contactList.size() > 1){
617                 
618                 excludeDataValue = testTask.excludeDateDataValue[1];
619                 
620         }
621         
622         ASSERT_EQ("20160125T130000Z", excludeDate);
623         ASSERT_EQ("DATE-TIME", excludeDataValue);
624         ASSERT_EQ("Europe/Truro", excludeDataTimeZoneParam);
625         
626         // Get the third EXDATE.
627         
628         excludeDate.clear();
629         
630         std::string excludeDataTokens;
631         
632         if (testTask.contactList.size() > 2){
633                 
634                 excludeDate = testTask.excludeDateData[2];
635                 
636         }
637         
638         if (testTask.contactList.size() > 2){
639                 
640                 excludeDataTokens = testTask.excludeDateDataTokens[2];
641                 
642         }
643         
644         ASSERT_EQ("20160125T133000Z", excludeDate);
645         ASSERT_EQ("ZOOP=ZIPPO", excludeDataTokens);
646         
647         // Get the first REQUEST-STATUS.
649         std::string requestStatus;
650         
651         if (testTask.requestStatusData.begin() != testTask.requestStatusData.end()){
652                 
653                 requestStatus = testTask.requestStatusData[0];
654                 
655         }
656         
657         ASSERT_EQ("2.0;Success", requestStatus);
658         
659         // Get the second REQUEST-STATUS.
660         
661         requestStatus.clear();
662         
663         std::string requestLanguage;
664         
665         if (testTask.contactList.size() > 1){
666                 
667                 requestStatus = testTask.requestStatusData[1];
668                 
669         }
670         
671         if (testTask.contactList.size() > 1){
672                 
673                 requestLanguage = testTask.requestStatusLanguage[1];
674                 
675         }
676         
677         ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", requestStatus);
678         ASSERT_EQ("en", requestLanguage);
679         
680         // Get the third REQUEST-STATUS.
681         
682         requestStatus.clear();
683         
684         std::string requestTokens;
685         
686         if (testTask.contactList.size() > 2){
687                 
688                 requestStatus = testTask.requestStatusData[2];
689                 
690         }
691         
692         if (testTask.contactList.size() > 2){
693                 
694                 requestTokens = testTask.requestStatusTokens[2];
695                 
696         }
697         
698         ASSERT_EQ("3.7;Invalid calendar user", requestStatus);
699         ASSERT_EQ("USER=MISSING", requestTokens);
700         
701         // Get the first RELATED-TO.
702         
703         std::string relatedTo;
704         
705         if (testTask.relatedToData.begin() != testTask.relatedToData.end()){
706                 
707                 relatedTo = testTask.relatedToData[0];
708                 
709         }
710         
711         ASSERT_EQ("person.1@example.com", relatedTo);
712         
713         // Get the second RELATED-TO.
714         
715         relatedTo.clear();
716         
717         std::string relatedToType;
718         
719         if (testTask.relatedToData.size() > 1){
720                 
721                 relatedTo = testTask.relatedToData[1];
722                 
723         }
724         
725         if (testTask.relatedToData.size() > 1){
726                 
727                 relatedToType = testTask.relatedToDataRelationType[1];
728                 
729         }
730         
731         ASSERT_EQ("person.2@example.com", relatedTo);
732         ASSERT_EQ("PARENT", relatedToType);
733         
734         // Get the third RELATED-TO.
735         
736         relatedTo.clear();
737         
738         std::string relatedToTokens;
739         
740         if (testTask.relatedToData.size() > 2){
741                 
742                 relatedTo = testTask.relatedToData[2];
743                 
744         }
745         
746         if (testTask.relatedToData.size() > 2){
747                 
748                 relatedToTokens = testTask.relatedToDataTokens[2];
749                 
750         }
751         
752         ASSERT_EQ("person.3@example.com", relatedTo);
753         ASSERT_EQ("SCHOOL=MEETING", relatedToTokens);
754         
755         // Get the first RESOURCES.
757         std::string resources;
758         
759         if (testTask.resourcesData.begin() != testTask.resourcesData.end()){
760                 
761                 resources = testTask.resourcesData[0];
762                 
763         }
764         
765         ASSERT_EQ("DMAC RECEIVER", resources);
766         
767         // Get the second RESOURCES.
768         
769         resources.clear();
770         
771         std::string resourcesLanguage;
772         
773         if (testTask.resourcesData.size() > 1){
774                 
775                 resources = testTask.resourcesData[1];
776                 
777         }
778         
779         if (testTask.resourcesData.size() > 1){
780                 
781                 resourcesLanguage = testTask.resourcesDataLanguage[1];
782                 
783         }
784         
785         ASSERT_EQ("PAL-I TELEVISION SET", resources);
786         ASSERT_EQ("en", resourcesLanguage);
787         
788         // Get the third RESOURCES.
789         
790         resources.clear();
791         
792         std::string resourcesAltRep;
793         std::string resourcesTokens;
794         
795         if (testTask.resourcesData.size() > 2){
796                 
797                 resources = testTask.resourcesData[2];
798                 
799         }
800                 
801         if (testTask.resourcesData.size() > 2){
802                 
803                 resourcesAltRep = testTask.resourcesDataAltRep[2];
804                 
805         }
806         
807         if (testTask.resourcesData.size() > 2){
808                 
809                 resourcesTokens = testTask.resourcesDataTokens[2];
810                 
811         }
812         
813         ASSERT_EQ("PAL/SECAM VCR", resources);
814         ASSERT_EQ("null:nodata", resourcesAltRep);
815         ASSERT_EQ("STATUS=BROKEN", resourcesTokens);
816         
817         // Get the first RDATE.
819         std::string recurrenceDate;
820         
821         if (testTask.recurranceDateData.begin() != testTask.recurranceDateData.end()){
822                 
823                 recurrenceDate = testTask.recurranceDateData[0];
824                 
825         }
826         
827         ASSERT_EQ("20160120", recurrenceDate);
828         
829         // Get the second RDATE.
830         
831         recurrenceDate.clear();
832         
833         std::string recurrenceDateTimeZoneParam;
834         std::string recurrenceDateValue;
835         
836         if (testTask.recurranceDateData.size() > 1){
837                 
838                 recurrenceDate = testTask.recurranceDateData[1];
839                 
840         }
841         
842         if (testTask.recurranceDateData.size() > 1){
843                 
844                 recurrenceDateTimeZoneParam = testTask.recurranceDateDataTimeZoneParam[1];
845                 
846         }
847         
848         if (testTask.recurranceDateData.size() > 1){
849                 
850                 recurrenceDateValue = testTask.recurranceDateDataValue[1];
851                 
852         }
853         
854         ASSERT_EQ("20160121", recurrenceDate);
855         ASSERT_EQ("DATE", recurrenceDateValue);
856         ASSERT_EQ("Europe/Truro", recurrenceDateTimeZoneParam);
857         
858         // Get the third RDATE.
859         
860         recurrenceDate.clear();
861         
862         std::string recurrenceTokens;
863         
864         if (testTask.recurranceDateData.size() > 2){
865                 
866                 recurrenceDate = testTask.recurranceDateData[2];
867                 
868         }
869         
870         if (testTask.recurranceDateData.size() > 2){
871                 
872                 recurrenceTokens = testTask.recurranceDateDataTokens[2];
873                 
874         }
875         
876         ASSERT_EQ("20160520", recurrenceDate);
877         ASSERT_EQ("ZILCH=DATA", recurrenceTokens);
878         
879         // Get the first X-EXAMPLE1 token.
880         
881         std::string xTokenName;
882         std::string xTokenData;
883         
884         if (testTask.xTokensData.size() != 0 ){
885         
886                 xTokenData = testTask.xTokensData[0];
887                 
888         }
890         if (testTask.xTokensData.size() != 0){
891         
892                 xTokenName = testTask.xTokensDataTokens[0];
893                 
894         }
895         
896         ASSERT_EQ("Moo", xTokenData);
897         ASSERT_EQ("X-EXAMPLE1", xTokenName);
898         
899         // Get the second X-EXAMPLE1 token.
901         xTokenName.clear();
902         xTokenData.clear();
903         
904         if (testTask.xTokensData.size() > 1){
905         
906                 xTokenData = testTask.xTokensData[1];
907                 
908         }
910         if (testTask.xTokensData.size() > 1){
911         
912                 xTokenName = testTask.xTokensDataTokens[1];
913                 
914         }
915         
916         ASSERT_EQ("Meep", xTokenData);
917         ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", xTokenName);
918         
919         // Get the third X-EXAMPLE1 token.
921         xTokenName.clear();
922         xTokenData.clear();
923         
924         if (testTask.xTokensData.size() > 2){
925         
926                 xTokenData = testTask.xTokensData[2];
927                 
928         }
930         if (testTask.xTokensData.size() > 2){
931         
932                 xTokenName = testTask.xTokensDataTokens[2];
933                 
934         }
935         
936         ASSERT_EQ("Meow", xTokenData);
937         ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", xTokenName);
938         
939         // Get the first X-EXAMPLE2 token.
940         
941         xTokenName.clear();
942         xTokenData.clear();
943         
944         if (testTask.xTokensData.size() > 3){
945         
946                 xTokenData = testTask.xTokensData[3];
947                 
948         }
950         if (testTask.xTokensData.size() > 3){
951         
952                 xTokenName = testTask.xTokensDataTokens[3];
953                 
954         }
955         
956         ASSERT_EQ("Dish", xTokenData);
957         ASSERT_EQ("X-EXAMPLE2", xTokenName);
958         
959         // Get the second X-EXAMPLE2 token.
960         
961         xTokenName.clear();
962         xTokenData.clear();
963         
964         if (testTask.xTokensData.size() > 4){
965         
966                 xTokenData = testTask.xTokensData[4];
967                 
968         }
970         if (testTask.xTokensData.size() > 4){
971         
972                 xTokenName = testTask.xTokensDataTokens[4];
973                 
974         }
975         
976         ASSERT_EQ("Fork", xTokenData);
977         ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", xTokenName);
978         
979         // Get the third X-EXAMPLE2 token.
980         
981         xTokenName.clear();
982         xTokenData.clear();
983         
984         if (testTask.xTokensData.size() > 5){
985         
986                 xTokenData = testTask.xTokensData[5];
987                 
988         }
990         if (testTask.xTokensData.size() > 5){
991         
992                 xTokenName = testTask.xTokensDataTokens[5];
993                 
994         }
995         
996         ASSERT_EQ("Table", xTokenData);
997         ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", xTokenName);
998         
999         // Get the X-STATUS token.
1000         
1001         xTokenName.clear();
1002         xTokenData.clear();
1003         
1004         if (testTask.xTokensData.size() > 6){
1005         
1006                 xTokenData = testTask.xTokensData[6];
1007                 
1008         }
1010         if (testTask.xTokensData.size() > 6){
1011         
1012                 xTokenName = testTask.xTokensDataTokens[6];
1013                 
1014         }
1015         
1016         ASSERT_EQ("Idle", xTokenData);
1017         ASSERT_EQ("X-STATUS;HOLIDAY=YES", xTokenName);
1018         
1019         // Get the X-TRANSPORT token.
1020         
1021         xTokenName.clear();
1022         xTokenData.clear();
1023         
1024         if (testTask.xTokensData.size() > 7){
1025         
1026                 xTokenData = testTask.xTokensData[7];
1027                 
1028         }
1030         if (testTask.xTokensData.size() > 7){
1031         
1032                 xTokenName = testTask.xTokensDataTokens[7];
1033                 
1034         }
1035         
1036         ASSERT_EQ("Private Hire", xTokenData);
1037         ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", xTokenName);
1038         
1039         // Get the X-PHANTOM-STATUS token.
1040         
1041         xTokenName.clear();
1042         xTokenData.clear();
1043         
1044         if (testTask.xTokensData.size() > 8){
1045         
1046                 xTokenData = testTask.xTokensData[8];
1047                 
1048         }
1050         if (testTask.xTokensData.size() > 8){
1051         
1052                 xTokenName = testTask.xTokensDataTokens[8];
1053                 
1054         }
1055         
1056         ASSERT_EQ("None", xTokenData);
1057         ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", xTokenName);
1058         
1061 TEST(iCalendarTask, AlarmTests){
1063         CalendarTaskObject testTask;
1064         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTask.LoadFile("iCalendarTask-Load2.vcf"));
1065         ASSERT_EQ(CALENDAROBJECTVALID_OK, testTask.ValidBaseObject());
1066         
1067         // Tests for the first VALARM property.
1068         
1069         std::string actionData;
1070         std::string actionDataTokens;
1071         
1072         std::string triggerData;
1073         std::string triggerRelated;
1074         std::string triggerValue;
1075         std::string triggerTokens;
1076         
1077         std::string durationData;
1078         std::string durationTokens;
1079         
1080         std::string repeatData;
1081         std::string repeatTokens;
1082         
1083         std::string xTokenData;
1084         std::string xTokenName;
1085         
1086         if (testTask.calendarAlarmData.size() > 0){
1087         
1088                 actionData = testTask.calendarAlarmData[0].alarmAction;
1089                 actionDataTokens = testTask.calendarAlarmData[0].alarmActionTokens;
1090                 
1091                 triggerData = testTask.calendarAlarmData[0].triggerData;
1092                 triggerRelated = testTask.calendarAlarmData[0].triggerRelated;
1093                 triggerValue = testTask.calendarAlarmData[0].triggerValue;
1094                 triggerTokens = testTask.calendarAlarmData[0].triggerTokens;
1095                 
1096                 durationData = testTask.calendarAlarmData[0].durationData;
1097                 durationTokens = testTask.calendarAlarmData[0].durationTokens;
1098                 
1099                 repeatData = testTask.calendarAlarmData[0].repeatData;
1100                 repeatTokens = testTask.calendarAlarmData[0].repeatTokens;
1101                 
1102         }
1103         
1104         ASSERT_EQ("AUDIO", actionData);
1105         ASSERT_EQ("FUNKY=SOUNDS", actionDataTokens);
1106         
1107         ASSERT_EQ("20160220T160000Z", triggerData);
1108         ASSERT_EQ("END", triggerRelated);
1109         ASSERT_EQ("DATE-TIME", triggerValue);
1110         ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1112         ASSERT_EQ("PT5H", durationData);
1113         ASSERT_EQ("FLYING=NO", durationTokens);
1115         ASSERT_EQ("PT5M", repeatData);
1116         ASSERT_EQ("NEVER=SLEEP", repeatTokens);
1117         
1118         // Tests for ATTACH. First ATTACH property.
1120         std::string attachData;
1121         std::string attachDataFormatType;
1122         std::string attachDataValue;
1123         std::string attachDataEncoding;
1124         std::string attachDataTokens;
1126         if (testTask.calendarAlarmData[0].attachList.begin() != testTask.calendarAlarmData[0].attachList.end()){
1127                 
1128                 attachData = testTask.attachList[0];
1129                 
1130         }
1131         
1132         if (testTask.calendarAlarmData[0].attachListFormatType.begin() != testTask.calendarAlarmData[0].attachListFormatType.end()){
1133                 
1134                 attachDataFormatType = testTask.attachListFormatType[0];
1135                 
1136         }
1138         ASSERT_EQ("http://www.example.com/", attachData);
1139         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1140         
1141         // Second ATTACH property.
1142         
1143         attachData.clear();
1144         attachDataFormatType.clear();
1145         attachDataValue.clear();
1146         attachDataEncoding.clear();
1147         
1148         if (testTask.calendarAlarmData[0].attachList.size() > 1){
1149                 
1150                 attachData = testTask.calendarAlarmData[0].attachList[1];
1151                 
1152         }
1153         
1154         if (testTask.calendarAlarmData[0].attachListFormatType.size() > 1){
1155                 
1156                 attachDataFormatType = testTask.calendarAlarmData[0].attachListFormatType[1];
1157                 
1158         }
1160         ASSERT_EQ("http://www.example.com/page2.html", attachData);
1161         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1162         
1163         // Third ATTACH property.
1165         attachData.clear();
1166         attachDataFormatType.clear();
1167         attachDataValue.clear();
1168         attachDataEncoding.clear();
1169         attachDataTokens.clear();
1170         
1171         if (testTask.calendarAlarmData[0].attachList.size() > 2){
1172                 
1173                 attachData = testTask.calendarAlarmData[0].attachList[2];
1174                 
1175         }
1176         
1177         if (testTask.calendarAlarmData[0].attachListFormatType.size() > 2){
1178                 
1179                 attachDataFormatType = testTask.calendarAlarmData[0].attachListFormatType[2];
1180                 
1181         }
1182         
1183         if (testTask.calendarAlarmData[0].attachListValue.size() > 2){
1184                 
1185                 attachDataValue = testTask.calendarAlarmData[0].attachListValue[2];
1186                 
1187         }
1188         
1189         if (testTask.calendarAlarmData[0].attachListFormatType.size() > 2){
1190                 
1191                 attachDataEncoding = testTask.calendarAlarmData[0].attachListEncoding[2];
1192                 
1193         }
1195         if (testTask.calendarAlarmData[0].attachListTokens.size() > 2){
1196                 
1197                 attachDataTokens = testTask.calendarAlarmData[0].attachListTokens[2];
1198                 
1199         }
1200         
1201         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1202         ASSERT_EQ("text/plain", attachDataFormatType);
1203         ASSERT_EQ("BASE64", attachDataEncoding);
1204         ASSERT_EQ("BINARY", attachDataValue);
1205         ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1206         
1207         // Test the first X-Token.
1208         
1209         if (testTask.calendarAlarmData[0].xTokensData.size() > 0){
1210                 
1211                 xTokenData = testTask.calendarAlarmData[0].xTokensData[0];
1212                 xTokenName = testTask.calendarAlarmData[0].xTokensDataTokens[0];
1213                 
1214         }
1215         
1216         ASSERT_EQ("Example Data 1", xTokenData);
1217         ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1218         
1219         // Test the second X-Token.
1220         
1221         xTokenData.clear();
1222         xTokenName.clear();
1223         
1224         if (testTask.calendarAlarmData[0].xTokensData.size() > 1){
1225                 
1226                 xTokenData = testTask.calendarAlarmData[0].xTokensData[1];
1227                 xTokenName = testTask.calendarAlarmData[0].xTokensDataTokens[1];
1228                 
1229         }
1230         
1231         ASSERT_EQ("Example Data 2", xTokenData);
1232         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1233         
1234         // Test the third X-Token.
1236         xTokenData.clear();
1237         xTokenName.clear();
1238         
1239         if (testTask.calendarAlarmData[0].xTokensData.size() > 2){
1240                 
1241                 xTokenData = testTask.calendarAlarmData[0].xTokensData[2];
1242                 xTokenName = testTask.calendarAlarmData[0].xTokensDataTokens[2];
1243                 
1244         }
1245         
1246         ASSERT_EQ("Example Data 3", xTokenData);
1247         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1248         
1249         // Tests for the second VALARM property.
1250         
1251         actionData.clear();
1252         actionDataTokens.clear();
1253         
1254         triggerData.clear();
1255         triggerRelated.clear();
1256         triggerValue.clear();
1257         triggerTokens.clear();
1258         
1259         durationData.clear();
1260         durationTokens.clear();
1261         
1262         repeatData.clear();
1263         repeatTokens.clear();
1264         
1265         xTokenData.clear();
1266         xTokenName.clear();
1267         
1268         string descriptionData;
1269         string descriptionAltRep;
1270         string descriptionLanguage;
1271         string descriptionTokens;
1272         
1273         if (testTask.calendarAlarmData.size() > 1){
1274                 
1275                 actionData = testTask.calendarAlarmData[1].alarmAction;
1276                 actionDataTokens = testTask.calendarAlarmData[1].alarmActionTokens;
1277                 
1278                 triggerData = testTask.calendarAlarmData[1].triggerData;
1279                 triggerRelated = testTask.calendarAlarmData[1].triggerRelated;
1280                 triggerValue = testTask.calendarAlarmData[1].triggerValue;
1281                 triggerTokens = testTask.calendarAlarmData[1].triggerTokens;
1282                 
1283                 durationData = testTask.calendarAlarmData[1].durationData;
1284                 durationTokens = testTask.calendarAlarmData[1].durationTokens;
1285                 
1286                 repeatData = testTask.calendarAlarmData[1].repeatData;
1287                 repeatTokens = testTask.calendarAlarmData[1].repeatTokens;
1288                 
1289                 descriptionData = testTask.calendarAlarmData[1].descriptionData;
1290                 descriptionAltRep = testTask.calendarAlarmData[1].descriptionAltRep;
1291                 descriptionLanguage = testTask.calendarAlarmData[1].descriptionLanguage;
1292                 descriptionTokens = testTask.calendarAlarmData[1].descriptionTokens;
1293                 
1294         }
1295         
1296         ASSERT_EQ("DISPLAY", actionData);
1297         ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1298         
1299         ASSERT_EQ("20160230T110000Z", triggerData);
1300         ASSERT_EQ("END", triggerRelated);
1301         ASSERT_EQ("DATE-TIME", triggerValue);
1302         ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1304         ASSERT_EQ("PT7H", durationData);
1305         ASSERT_EQ("FLYING=YES", durationTokens);
1307         ASSERT_EQ("PT3M", repeatData);
1308         ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1309         
1310         ASSERT_EQ("This is the second alarm.", descriptionData);
1311         ASSERT_EQ("null:nodata", descriptionAltRep);
1312         ASSERT_EQ("kw", descriptionLanguage);
1313         ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1314         
1315         // Test the first X-Token.
1316         
1317         if (testTask.calendarAlarmData[1].xTokensData.size() > 0){
1318                 
1319                 xTokenData = testTask.calendarAlarmData[1].xTokensData[0];
1320                 xTokenName = testTask.calendarAlarmData[1].xTokensDataTokens[0];
1321                 
1322         }
1323         
1324         ASSERT_EQ("Example Data 1", xTokenData);
1325         ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1326         
1327         // Test the second X-Token.
1328         
1329         xTokenData.clear();
1330         xTokenName.clear();
1331         
1332         if (testTask.calendarAlarmData[1].xTokensData.size() > 1){
1333                 
1334                 xTokenData = testTask.calendarAlarmData[1].xTokensData[1];
1335                 xTokenName = testTask.calendarAlarmData[1].xTokensDataTokens[1];
1336                 
1337         }
1338         
1339         ASSERT_EQ("Example Data 2", xTokenData);
1340         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1341         
1342         // Test the third X-Token.
1344         xTokenData.clear();
1345         xTokenName.clear();
1346         
1347         if (testTask.calendarAlarmData[1].xTokensData.size() > 2){
1348                 
1349                 xTokenData = testTask.calendarAlarmData[1].xTokensData[2];
1350                 xTokenName = testTask.calendarAlarmData[1].xTokensDataTokens[2];
1351                 
1352         }
1353         
1354         ASSERT_EQ("Example Data 3", xTokenData);
1355         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1356         
1357         // Tests for the third VALARM property.
1358         
1359         actionData.clear();
1360         actionDataTokens.clear();
1361         
1362         triggerData.clear();
1363         triggerRelated.clear();
1364         triggerValue.clear();
1365         triggerTokens.clear();
1366         
1367         durationData.clear();
1368         durationTokens.clear();
1369         
1370         repeatData.clear();
1371         repeatTokens.clear();
1372         
1373         xTokenData.clear();
1374         xTokenName.clear();
1375         
1376         descriptionData.clear();
1377         descriptionAltRep.clear();
1378         descriptionLanguage.clear();
1379         descriptionTokens.clear();
1381         string summaryData;
1382         string summaryAltRep;
1383         string summaryLanguage;
1384         string summaryTokens;
1385         
1386         string attendeeDataMember;
1387         string attendeeDataDelegatedFrom;
1388         string attendeeDataDelegatedTo;
1389         string attendeeDataRole;
1390         string attendeeDataRSVP;
1391         string attendeeDataDirectoryEntry;
1392         string attendeeDataSentBy;
1393         string attendeeDataCommonName;
1394         string attendeeDataCalendarUserType;
1395         string attendeeDataParticipationStatus;
1396         string attendeeDataLanguage;
1397         string attendeeDataTokens;
1398         string attendeeData;
1399         
1400         attachData.clear();
1401         attachDataFormatType.clear();
1402         attachDataValue.clear();
1403         attachDataEncoding.clear();
1404         attachDataTokens.clear();
1405         
1406         if (testTask.calendarAlarmData.size() > 2){
1407                 
1408                 actionData = testTask.calendarAlarmData[2].alarmAction;
1409                 actionDataTokens = testTask.calendarAlarmData[2].alarmActionTokens;
1410                 
1411                 triggerData = testTask.calendarAlarmData[2].triggerData;
1412                 triggerRelated = testTask.calendarAlarmData[2].triggerRelated;
1413                 triggerValue = testTask.calendarAlarmData[2].triggerValue;
1414                 triggerTokens = testTask.calendarAlarmData[2].triggerTokens;
1415                 
1416                 durationData = testTask.calendarAlarmData[2].durationData;
1417                 durationTokens = testTask.calendarAlarmData[2].durationTokens;
1418                 
1419                 repeatData = testTask.calendarAlarmData[2].repeatData;
1420                 repeatTokens = testTask.calendarAlarmData[2].repeatTokens;
1421                 
1422                 descriptionData = testTask.calendarAlarmData[2].descriptionData;
1423                 descriptionAltRep = testTask.calendarAlarmData[2].descriptionAltRep;
1424                 descriptionLanguage = testTask.calendarAlarmData[2].descriptionLanguage;
1425                 descriptionTokens = testTask.calendarAlarmData[2].descriptionTokens;
1426                 
1427                 summaryData = testTask.calendarAlarmData[2].summaryData;
1428                 summaryAltRep = testTask.calendarAlarmData[2].summaryAltRep;
1429                 summaryLanguage = testTask.calendarAlarmData[2].summaryLanguage;
1430                 summaryTokens = testTask.calendarAlarmData[2].summaryTokens;
1431                 
1432         }
1433         
1434         ASSERT_EQ("EMAIL", actionData);
1435         ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1436         
1437         ASSERT_EQ("20160230T120000Z", triggerData);
1438         ASSERT_EQ("END", triggerRelated);
1439         ASSERT_EQ("DATE-TIME", triggerValue);
1440         ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1442         ASSERT_EQ("PT7H", durationData);
1443         ASSERT_EQ("FLYING=YES", durationTokens);
1445         ASSERT_EQ("PT3M", repeatData);
1446         ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1447         
1448         ASSERT_EQ("This is the third alarm.", descriptionData);
1449         ASSERT_EQ("null:nodata", descriptionAltRep);
1450         ASSERT_EQ("kw", descriptionLanguage);
1451         ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1453         ASSERT_EQ("This is the summary of the third alarm.", summaryData);
1454         ASSERT_EQ("null:nodata", summaryAltRep);
1455         ASSERT_EQ("en", summaryLanguage);
1456         ASSERT_EQ("MEEP=MOOP", summaryTokens);
1458         // Tests for ATTENDEE. First ATTENDEE property.
1460         if (testTask.calendarAlarmData[2].attendeeList.begin() != testTask.calendarAlarmData[2].attendeeList.end()){
1461                 
1462                 attendeeData = testTask.calendarAlarmData[2].attendeeList[0];
1463                 
1464         }
1465         
1466         ASSERT_EQ("Attendee One", attendeeData);
1467         
1468         // Second ATTENDEE property.
1469         
1470         attendeeData.clear();
1471         
1472         if (testTask.calendarAlarmData[2].attendeeList.size() > 1){
1473                 
1474                 attendeeData = testTask.calendarAlarmData[2].attendeeList[1];
1475                 
1476         }
1478         if (testTask.calendarAlarmData[2].attendeeList.size() > 1){
1479                 
1480                 attendeeDataDelegatedFrom = testTask.calendarAlarmData[2].attendeeListDelegatedFrom[1];
1481                 
1482         }
1483         
1484         if (testTask.calendarAlarmData[2].attendeeList.size() > 1){
1485                 
1486                 attendeeDataDelegatedTo = testTask.calendarAlarmData[2].attendeeListDelegatedTo[1];
1487                 
1488         }
1490         if (testTask.calendarAlarmData[2].attendeeList.size() > 1){
1491                 
1492                 attendeeDataRole = testTask.calendarAlarmData[2].attendeeListRole[1];
1493                 
1494         }
1495         
1496         if (testTask.calendarAlarmData[2].attendeeList.size() > 1){
1497                 
1498                 attendeeDataRSVP = testTask.calendarAlarmData[2].attendeeListRSVP[1];
1499                 
1500         }
1501         
1502         ASSERT_EQ("Attendee Two", attendeeData);
1503         ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
1504         ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
1505         ASSERT_EQ("CHAIR", attendeeDataRole);
1506         ASSERT_EQ("TRUE", attendeeDataRSVP);
1508         // Third ATTENDEE property.
1509         
1510         attendeeData.clear();
1511         
1512         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1513                 
1514                 attendeeData = testTask.calendarAlarmData[2].attendeeList[2];
1515                 
1516         }
1518         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1519                 
1520                 attendeeDataDirectoryEntry = testTask.calendarAlarmData[2].attendeeListDirectoryEntry[2];
1521                 
1522         }
1523         
1524         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1525                 
1526                 attendeeDataSentBy = testTask.calendarAlarmData[2].attendeeListSentBy[2];
1527                 
1528         }
1530         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1531                 
1532                 attendeeDataCommonName = testTask.calendarAlarmData[2].attendeeListCommonName[2];
1533                 
1534         }
1535         
1536         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1537                 
1538                 attendeeDataCalendarUserType = testTask.calendarAlarmData[2].attendeeListCalendarUserType[2];
1539                 
1540         }
1542         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1543                 
1544                 attendeeDataParticipationStatus = testTask.calendarAlarmData[2].attendeeListParticipationStatus[2];
1545                 
1546         }
1548         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1549                 
1550                 attendeeDataLanguage = testTask.calendarAlarmData[2].attendeeListLanguage[2];
1551                 
1552         }
1553         
1554         if (testTask.calendarAlarmData[2].attendeeList.size() > 2){
1555                 
1556                 attendeeDataTokens = testTask.calendarAlarmData[2].attendeeListTokens[2];
1557                 
1558         }
1559         
1560         ASSERT_EQ("Attendee Three", attendeeData);
1561         ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
1562         ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
1563         ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
1564         ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
1565         ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
1566         ASSERT_EQ("kw", attendeeDataLanguage);
1567         ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
1569         // Tests for ATTACH. First ATTACH property.
1571         if (testTask.calendarAlarmData[2].attachList.begin() != testTask.calendarAlarmData[2].attachList.end()){
1572                 
1573                 attachData = testTask.calendarAlarmData[2].attachList[0];
1574                 
1575         }
1576         
1577         if (testTask.calendarAlarmData[2].attachListFormatType.begin() != testTask.calendarAlarmData[2].attachListFormatType.end()){
1578                 
1579                 attachDataFormatType = testTask.calendarAlarmData[2].attachListFormatType[0];
1580                 
1581         }
1583         ASSERT_EQ("http://www.example.com/", attachData);
1584         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1585         
1586         // Second ATTACH property.
1587         
1588         attachData.clear();
1589         attachDataFormatType.clear();
1590         attachDataValue.clear();
1591         attachDataEncoding.clear();
1592         
1593         if (testTask.calendarAlarmData[2].attachList.size() > 1){
1594                 
1595                 attachData = testTask.calendarAlarmData[2].attachList[1];
1596                 
1597         }
1598         
1599         if (testTask.calendarAlarmData[2].attachListFormatType.size() > 1){
1600                 
1601                 attachDataFormatType = testTask.calendarAlarmData[2].attachListFormatType[1];
1602                 
1603         }
1605         ASSERT_EQ("http://www.example.com/page2.html", attachData);
1606         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1607         
1608         // Third ATTACH property.
1610         attachData.clear();
1611         attachDataFormatType.clear();
1612         attachDataValue.clear();
1613         attachDataEncoding.clear();
1614         attachDataTokens.clear();
1615         
1616         if (testTask.calendarAlarmData[2].attachList.size() > 2){
1617                 
1618                 attachData = testTask.calendarAlarmData[2].attachList[2];
1619                 
1620         }
1621         
1622         if (testTask.calendarAlarmData[2].attachListFormatType.size() > 2){
1623                 
1624                 attachDataFormatType = testTask.calendarAlarmData[2].attachListFormatType[2];
1625                 
1626         }
1627         
1628         if (testTask.calendarAlarmData[2].attachListValue.size() > 2){
1629                 
1630                 attachDataValue = testTask.calendarAlarmData[2].attachListValue[2];
1631                 
1632         }
1633         
1634         if (testTask.calendarAlarmData[2].attachListFormatType.size() > 2){
1635                 
1636                 attachDataEncoding = testTask.calendarAlarmData[2].attachListEncoding[2];
1637                 
1638         }
1640         if (testTask.calendarAlarmData[2].attachListTokens.size() > 2){
1641                 
1642                 attachDataTokens = testTask.calendarAlarmData[2].attachListTokens[2];
1643                 
1644         }
1645         
1646         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1647         ASSERT_EQ("text/plain", attachDataFormatType);
1648         ASSERT_EQ("BASE64", attachDataEncoding);
1649         ASSERT_EQ("BINARY", attachDataValue);
1650         ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1651         
1652         // Test the first X-Token.
1653         
1654         if (testTask.calendarAlarmData[2].xTokensData.size() > 0){
1655                 
1656                 xTokenData = testTask.calendarAlarmData[2].xTokensData[0];
1657                 xTokenName = testTask.calendarAlarmData[2].xTokensDataTokens[0];
1658                 
1659         }
1660         
1661         ASSERT_EQ("Example Data 1", xTokenData);
1662         ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1663         
1664         // Test the second X-Token.
1665         
1666         xTokenData.clear();
1667         xTokenName.clear();
1668         
1669         if (testTask.calendarAlarmData[2].xTokensData.size() > 1){
1670                 
1671                 xTokenData = testTask.calendarAlarmData[2].xTokensData[1];
1672                 xTokenName = testTask.calendarAlarmData[2].xTokensDataTokens[1];
1673                 
1674         }
1675         
1676         ASSERT_EQ("Example Data 2", xTokenData);
1677         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1678         
1679         // Test the third X-Token.
1681         xTokenData.clear();
1682         xTokenName.clear();
1683         
1684         if (testTask.calendarAlarmData[2].xTokensData.size() > 2){
1685                 
1686                 xTokenData = testTask.calendarAlarmData[2].xTokensData[2];
1687                 xTokenName = testTask.calendarAlarmData[2].xTokensDataTokens[2];
1688                 
1689         }
1690         
1691         ASSERT_EQ("Example Data 3", xTokenData);
1692         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1693         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy