|
1 /* |
|
2 * Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: MR Entry unit and module tests |
|
15 * Version : %version: e002sa33#3 % |
|
16 * |
|
17 * Copyright ? 2008-2008 Nokia. All rights reserved. |
|
18 */ |
|
19 |
|
20 |
|
21 #include "ut_cesmrmeetingrequestentry.h" |
|
22 |
|
23 |
|
24 // SYSTEM INCLUDES |
|
25 #include <EUnitMacros.h> |
|
26 #include <EUnitDecorators.h> |
|
27 |
|
28 #include <aknutils.h> |
|
29 |
|
30 #include <caleninterimutils2.h> |
|
31 #include <calentry.h> |
|
32 #include <calsession.h> |
|
33 #include <caluser.h> |
|
34 #include <calrrule.h> |
|
35 #include <calalarm.h> |
|
36 #include <calrrule.h> |
|
37 #include <cmrmailboxutils.h> |
|
38 #include <calinstanceview.h> |
|
39 #include <calinstance.h> |
|
40 #include <mesmrcalentry.h> |
|
41 #include <gulicon.h> |
|
42 |
|
43 // USER INCLUDES |
|
44 #include "cesmrmeetingrequestentry.h" |
|
45 #include "cesmrcaldbmgr.h" |
|
46 #include "esmrentryhelper.h" |
|
47 |
|
48 |
|
49 |
|
50 // CONSTANTS |
|
51 |
|
52 // LOCAL DEFINITIONS |
|
53 |
|
54 namespace { |
|
55 |
|
56 // Default Calendar database path "Calendar_test");// |
|
57 _LIT( KCalendarDatabaseFilePath, "c:Calendar_test" ); |
|
58 |
|
59 |
|
60 _LIT( KUser1, "foo1@bar.com" ); |
|
61 _LIT( KUser2, "foo2@bar.com" ); |
|
62 _LIT( KUser3, "foo3@bar.com" ); |
|
63 _LIT( KUser4, "foo4@bar.com" ); |
|
64 _LIT( KUser5, "foo5@bar.com" ); |
|
65 _LIT( KUser6, "foo6@bar.com" ); |
|
66 _LIT( KOrg, "foo7@bar.com"); |
|
67 _LIT( KAtOrg, "cayenne2@digia.com"); |
|
68 |
|
69 |
|
70 CCalEntry* CreateEntryL( CCalEntry::TType aType, |
|
71 TCalTime aStartCalTime, |
|
72 TCalTime aEndCalTime ) |
|
73 { |
|
74 CCalenInterimUtils2* utils = CCalenInterimUtils2::NewL(); |
|
75 CleanupStack::PushL( utils ); |
|
76 // Create unique ID. |
|
77 HBufC8* guid = utils->GlobalUidL(); |
|
78 CleanupStack::PushL(guid); |
|
79 CCalEntry* entry = CCalEntry::NewL( aType, guid, CCalEntry::EMethodNone, 0 ); |
|
80 CleanupStack::Pop( guid ); |
|
81 CleanupStack::PushL( entry ); |
|
82 |
|
83 //TEST DATA |
|
84 TDateTime start = aStartCalTime.TimeLocalL().DateTime(); |
|
85 TDateTime end = aEndCalTime.TimeLocalL().DateTime(); |
|
86 |
|
87 entry->SetStartAndEndTimeL( aStartCalTime, aEndCalTime ); |
|
88 CleanupStack::Pop( entry ); |
|
89 CleanupStack::PopAndDestroy( utils ); |
|
90 |
|
91 return entry; |
|
92 } |
|
93 |
|
94 CCalAttendee* CreateAttendeeLC( const TDesC& aAddress, CCalAttendee::TCalRole aRole ) |
|
95 { |
|
96 CCalAttendee* attendee = CCalAttendee::NewL(aAddress); |
|
97 CleanupStack::PushL(attendee); |
|
98 attendee->SetRoleL(aRole); |
|
99 |
|
100 return attendee; |
|
101 } |
|
102 |
|
103 CCalAttendee* SetAttendeeLC( CCalEntry& aEntry, const TDesC& aAddress, CCalAttendee::TCalRole aRole ) |
|
104 { |
|
105 CCalAttendee* attendee = CreateAttendeeLC( aAddress, aRole ); |
|
106 aEntry.AddAttendeeL( attendee ); |
|
107 |
|
108 return attendee; |
|
109 } |
|
110 |
|
111 |
|
112 } //namespace |
|
113 |
|
114 // - Construction ------------------------------------------------------------ |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // UT_CESMRMeetingRequestEntryImpl::NewL |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 UT_CESMRMeetingRequestEntry* UT_CESMRMeetingRequestEntry::NewL() |
|
121 { |
|
122 UT_CESMRMeetingRequestEntry* self = UT_CESMRMeetingRequestEntry::NewLC(); |
|
123 CleanupStack::Pop(); |
|
124 return self; |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // UT_CESMRMeetingRequestEntry::NewLC |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 UT_CESMRMeetingRequestEntry* UT_CESMRMeetingRequestEntry::NewLC() |
|
132 { |
|
133 UT_CESMRMeetingRequestEntry* self = new( ELeave ) UT_CESMRMeetingRequestEntry(); |
|
134 CleanupStack::PushL( self ); |
|
135 self->ConstructL(); |
|
136 return self; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // UT_CESMRMeetingRequestEntry::~UT_CESMRMeetingRequestEntry |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 UT_CESMRMeetingRequestEntry::~UT_CESMRMeetingRequestEntry() |
|
144 { |
|
145 delete iMRMailboxUtils; iMRMailboxUtils = NULL; |
|
146 delete iEntry; iEntry = NULL; |
|
147 delete iCtrlSyncher; iCtrlSyncher = NULL; |
|
148 delete iCalDbMgr; iCalDbMgr = NULL; |
|
149 delete iCalSession; iCalSession = NULL; |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // UT_CESMRMeetingRequestEntry::UT_CESMRMeetingRequestEntry |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 UT_CESMRMeetingRequestEntry::UT_CESMRMeetingRequestEntry() |
|
157 { |
|
158 } |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // UT_CESMRMeetingRequestEntry::ConstructL |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 void UT_CESMRMeetingRequestEntry::ConstructL() |
|
165 { |
|
166 CEUnitTestSuiteClass::ConstructL(); |
|
167 |
|
168 } |
|
169 |
|
170 |
|
171 // - Utility functions ----------------------------------------------------------- |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // UT_CESMRMeetingRequestEntry::SetupL |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 void UT_CESMRMeetingRequestEntry::SetupL() |
|
178 { |
|
179 // Creating mailbox utils |
|
180 iMRMailboxUtils = CMRMailboxUtils::NewL( NULL ); |
|
181 |
|
182 // Creating calSession to calendar database |
|
183 iCalSession = CCalSession::NewL(); |
|
184 |
|
185 TRAP_IGNORE( iCalSession->DeleteCalFileL( KCalendarDatabaseFilePath )); |
|
186 |
|
187 TRAPD( err, iCalSession->OpenL( KCalendarDatabaseFilePath )); |
|
188 if ( err == KErrNotFound ) |
|
189 { |
|
190 iCalSession->CreateCalFileL( KCalendarDatabaseFilePath ); |
|
191 iCalSession->OpenL( KCalendarDatabaseFilePath ); |
|
192 } |
|
193 else |
|
194 { |
|
195 User::LeaveIfError( err ); |
|
196 } |
|
197 |
|
198 iCalDbMgr = CESMRCalDbMgr::NewL( *iCalSession, *this ); |
|
199 |
|
200 iConflictsExists = EFalse; |
|
201 |
|
202 ExecuteL(); |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------------------------- |
|
206 // UT_CESMRMeetingRequestEntry::Teardown |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 void UT_CESMRMeetingRequestEntry::Teardown() |
|
210 { |
|
211 delete iMrEntry; iMrEntry = NULL; |
|
212 delete iMRMailboxUtils; iMRMailboxUtils = NULL; |
|
213 delete iEntry; iEntry = NULL; |
|
214 delete iCtrlSyncher; iCtrlSyncher = NULL; |
|
215 delete iCalDbMgr; iCalDbMgr = NULL; |
|
216 delete iCalSession; iCalSession = NULL; |
|
217 } |
|
218 |
|
219 // --------------------------------------------------------------------------- |
|
220 // UT_CESMRMeetingRequestEntry::CreateCalEntryL |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 void UT_CESMRMeetingRequestEntry::CreateCalEntryL() |
|
224 { |
|
225 TTime time; |
|
226 time.HomeTime(); |
|
227 TCalTime initialCalTime; initialCalTime.SetTimeLocalL( time ); |
|
228 TTimeIntervalHours hour( 1 ); |
|
229 TCalTime initialCalEndTime; time += hour; initialCalEndTime.SetTimeLocalL( time ); |
|
230 |
|
231 iEntry = CreateEntryL( CCalEntry::EAppt, initialCalTime, initialCalEndTime ); |
|
232 |
|
233 // Location |
|
234 _LIT( KLocation, "Meeting Room data 123" ); |
|
235 iEntry->SetLocationL( KLocation() ); |
|
236 // Method for 'remove from cal' option test |
|
237 // iEntry->SetMethodL( CCalEntry::EMethodCancel ); |
|
238 |
|
239 // Description |
|
240 _LIT( KDesc, "Description field data" ); |
|
241 iEntry->SetDescriptionL( KDesc() ); |
|
242 |
|
243 // Subject |
|
244 _LIT( KSummary, "Summary field data" ); |
|
245 iEntry->SetSummaryL( KSummary() ); |
|
246 |
|
247 // Setting alarm |
|
248 CCalAlarm* alarm = CCalAlarm::NewL(); |
|
249 TTimeIntervalMinutes offset(60); |
|
250 alarm->SetTimeOffset( offset ); |
|
251 iEntry->SetAlarmL( alarm ); |
|
252 delete alarm; alarm = NULL; |
|
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // UT_CESMRMeetingRequestEntry::CalEntryL |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 CCalEntry* UT_CESMRMeetingRequestEntry::CCalEntryL() |
|
260 { |
|
261 TTime time; |
|
262 time.HomeTime(); |
|
263 TCalTime initialCalTime; initialCalTime.SetTimeLocalL( time ); |
|
264 TTimeIntervalHours hour( 1 ); |
|
265 TCalTime initialCalEndTime; time += hour; initialCalEndTime.SetTimeLocalL( time ); |
|
266 |
|
267 CCalEntry* entry = CreateEntryL( CCalEntry::EAppt, initialCalTime, initialCalEndTime ); |
|
268 |
|
269 // Location |
|
270 _LIT( KLocation, "Meeting Room data 123" ); |
|
271 entry->SetLocationL( KLocation() ); |
|
272 |
|
273 // Description |
|
274 _LIT( KDesc, "Description field data" ); |
|
275 entry->SetDescriptionL( KDesc() ); |
|
276 |
|
277 // Subject |
|
278 _LIT( KSummary, "Summary field data" ); |
|
279 entry->SetSummaryL( KSummary() ); |
|
280 |
|
281 // Setting alarm |
|
282 CCalAlarm* alarm = CCalAlarm::NewL(); |
|
283 TTimeIntervalMinutes offset(60); |
|
284 alarm->SetTimeOffset( offset ); |
|
285 entry->SetAlarmL( alarm ); |
|
286 delete alarm; alarm = NULL; |
|
287 |
|
288 return entry; |
|
289 } |
|
290 |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // UT_CESMRMeetingRequestEntry::HandleCalEngStatus |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 void UT_CESMRMeetingRequestEntry::HandleCalEngStatus( TMRUtilsCalEngStatus /*aStatus*/ ) |
|
297 { |
|
298 if ( iCtrlSyncher->CanStopNow() ) |
|
299 { |
|
300 iCtrlSyncher->AsyncStop(); |
|
301 } |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // UT_CESMRMeetingRequestEntry::HandleOperation |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 void UT_CESMRMeetingRequestEntry::HandleOperation( |
|
309 TInt /*aType*/, |
|
310 TInt /*aPercentageCompleted*/, |
|
311 TInt /*aStatus*/ ) |
|
312 { |
|
313 // Do nothing |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // UT_CESMRMeetingRequestEntry::ExecuteL |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 void UT_CESMRMeetingRequestEntry::ExecuteL() |
|
321 { |
|
322 iExecutionError = KErrNone; |
|
323 |
|
324 iCtrlSyncher = new (ELeave) CActiveSchedulerWait; |
|
325 |
|
326 iCtrlSyncher->Start(); |
|
327 } |
|
328 |
|
329 // ----------------------------------------------------------------------------- |
|
330 // UT_CESMRMeetingRequestEntry::CreateMREntryL |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 void UT_CESMRMeetingRequestEntry::CreateMREntryL() |
|
334 { |
|
335 iMrEntry = CESMRMeetingRequestEntry::NewL( |
|
336 *iEntry, |
|
337 *iMRMailboxUtils, |
|
338 *iCalDbMgr, |
|
339 iConflictsExists, |
|
340 NULL ); |
|
341 } |
|
342 |
|
343 // - Test methods ----------------------------------------------------------- |
|
344 |
|
345 |
|
346 // --------------------------------------------------------------------------- |
|
347 // UT_CESMRMeetingRequestEntry::T_Global_CESMRMeetingRequestEntry_NewL |
|
348 // --------------------------------------------------------------------------- |
|
349 // |
|
350 void UT_CESMRMeetingRequestEntry::T_Global_CESMRMeetingRequestEntry_NewL() |
|
351 { |
|
352 CreateCalEntryL(); // Creating iEntry |
|
353 |
|
354 iMrEntry = CESMRMeetingRequestEntry::NewL( |
|
355 *iEntry, |
|
356 *iMRMailboxUtils, |
|
357 *iCalDbMgr, |
|
358 iConflictsExists, |
|
359 NULL ); |
|
360 |
|
361 EUNIT_ASSERT_DESC( iMrEntry, "CESMRMeetingRequestEntry::NewL failed" ); |
|
362 } |
|
363 |
|
364 // --------------------------------------------------------------------------- |
|
365 // UT_CESMRMeetingRequestEntry::T_ValidateEntryL_1 |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 void UT_CESMRMeetingRequestEntry::T_ValidateEntryL_1() |
|
369 { |
|
370 // entry1 = Normal once occuring entry |
|
371 CCalEntry* entry1 = CCalEntryL(); |
|
372 |
|
373 // Saving entry to caldb |
|
374 MESMRCalDbMgr& mgr = *iCalDbMgr; |
|
375 mgr.StoreEntryL( *entry1, ETrue ); |
|
376 |
|
377 iEntry = entry1; //ownership transfered to iEntry |
|
378 |
|
379 CreateMREntryL(); |
|
380 CCalEntry* validatedEntry1 = iMrEntry->ValidateEntryL(); |
|
381 |
|
382 TCalLocalUid entry1uid = entry1->LocalUidL(); |
|
383 TCalLocalUid validateuid = validatedEntry1->LocalUidL(); |
|
384 |
|
385 /* |
|
386 EUNIT_ASSERT_DESC( validateuid == entry1uid, |
|
387 "Entry1 local uid should be the same as validated entrys!" ); |
|
388 */ |
|
389 |
|
390 EUNIT_ASSERT_DESC( validatedEntry1->UidL() == entry1->UidL(), |
|
391 "Entry1 local uid should be the same as validated entrys!" ); |
|
392 |
|
393 EUNIT_ASSERT_DESC( validatedEntry1->RecurrenceIdL().TimeLocalL() == |
|
394 entry1->RecurrenceIdL().TimeLocalL(), |
|
395 "Entry1 recurrence id should be the same as validated entrys!" ); |
|
396 |
|
397 |
|
398 delete validatedEntry1; validatedEntry1 = NULL; |
|
399 } |
|
400 |
|
401 // --------------------------------------------------------------------------- |
|
402 // UT_CESMRMeetingRequestEntry::T_ValidateEntryL_2 |
|
403 // --------------------------------------------------------------------------- |
|
404 // |
|
405 void UT_CESMRMeetingRequestEntry::T_ValidateEntryL_2() |
|
406 { |
|
407 // entry2 = recurring entry |
|
408 CCalEntry* entry2 = CCalEntryL(); |
|
409 |
|
410 // Adjusting entry2 start and end time |
|
411 TCalTime newStartTime; |
|
412 TCalTime newEndTime; |
|
413 TTime newStart = entry2->StartTimeL().TimeLocalL() + TTimeIntervalDays(10); |
|
414 TTime newEnd = entry2->EndTimeL().TimeLocalL() + TTimeIntervalDays(10); |
|
415 newStartTime.SetTimeLocalL( newStart ); |
|
416 newEndTime.SetTimeLocalL( newEnd ); |
|
417 entry2->SetStartAndEndTimeL( newStartTime , newEndTime ); |
|
418 |
|
419 // Adding recurrence to entry2 |
|
420 TCalTime meetingStartTime = entry2->StartTimeL(); |
|
421 TCalRRule rRule; |
|
422 rRule.SetType( TCalRRule::EDaily ); |
|
423 rRule.SetCount( 5 ); |
|
424 rRule.SetDtStart( meetingStartTime ); |
|
425 entry2->SetRRuleL( rRule ); |
|
426 |
|
427 // Saving entries to caldb |
|
428 MESMRCalDbMgr& mgr = *iCalDbMgr; |
|
429 mgr.StoreEntryL( *entry2, ETrue ); |
|
430 |
|
431 // If all went well, entry2 has been saved to db correctly, so let's use that |
|
432 iEntry = entry2; // ownership transfered |
|
433 |
|
434 // Creating iMrEntry based on this modifying entry |
|
435 CreateMREntryL(); |
|
436 |
|
437 iMrEntry->SetModifyingRuleL( MESMRCalEntry::EESMRThisOnly ); |
|
438 |
|
439 CCalEntry* validatedEntry2 = iMrEntry->ValidateEntryL(); |
|
440 |
|
441 // Verification |
|
442 if( validatedEntry2->EntryTypeL() != iEntry->EntryTypeL() ) |
|
443 { |
|
444 EUNIT_FAIL_TEST( "Validated entrys type has changed!" ); |
|
445 } |
|
446 else if( validatedEntry2->UidL().Compare( iEntry->UidL() )) |
|
447 { |
|
448 EUNIT_FAIL_TEST( "Validated entrys uid is no longer the original one!" ); |
|
449 } |
|
450 else if ( validatedEntry2->LocalUidL() != 0 ) |
|
451 { |
|
452 EUNIT_FAIL_TEST( "Validated entrys local uid is not zero!" ); |
|
453 } |
|
454 else if ( validatedEntry2->SequenceNumberL() != 0 ) |
|
455 { |
|
456 EUNIT_FAIL_TEST( "Validated entrys sequence number is not zero!" ); |
|
457 } |
|
458 else if( validatedEntry2->SummaryL().Compare( iEntry->SummaryL() )) |
|
459 { |
|
460 EUNIT_FAIL_TEST( "Validated entrys summary is no longer the original one!" ); |
|
461 } |
|
462 else if ( validatedEntry2->RecurrenceRangeL() != CalCommon::EThisOnly ) |
|
463 { |
|
464 EUNIT_FAIL_TEST( "Validated entrys recurrence range is not EThisOnly!" ); |
|
465 } |
|
466 else if ( validatedEntry2->StartTimeL().TimeLocalL() != iEntry->StartTimeL().TimeLocalL() ) |
|
467 { |
|
468 EUNIT_FAIL_TEST( "Validated entrys start time has changed from original!" ); |
|
469 } |
|
470 else |
|
471 { |
|
472 EUNIT_ASSERT_DESC( validatedEntry2, "Enrty validated correctly" ) |
|
473 } |
|
474 |
|
475 delete validatedEntry2; validatedEntry2 = NULL; |
|
476 } |
|
477 |
|
478 |
|
479 // --------------------------------------------------------------------------- |
|
480 // UT_CESMRMeetingRequestEntry::T_EntryAttendeeInfoL |
|
481 // --------------------------------------------------------------------------- |
|
482 // |
|
483 void UT_CESMRMeetingRequestEntry::T_EntryAttendeeInfoL() |
|
484 { |
|
485 CreateCalEntryL(); // Creating iEntry |
|
486 |
|
487 CCalAttendee* organizer = CreateAttendeeLC( KAtOrg(), CCalAttendee::EChair ); |
|
488 iEntry->SetOrganizerL( organizer ); |
|
489 iEntry->SetPhoneOwnerL( organizer ); |
|
490 CleanupStack::Pop( organizer ); |
|
491 |
|
492 SetAttendeeLC( *iEntry, KUser1(), CCalAttendee::EReqParticipant ); |
|
493 CleanupStack::Pop(); |
|
494 |
|
495 SetAttendeeLC( *iEntry, KUser2(), CCalAttendee::EReqParticipant ); |
|
496 CleanupStack::Pop(); |
|
497 |
|
498 SetAttendeeLC( *iEntry, KUser3(), CCalAttendee::EReqParticipant ); |
|
499 CleanupStack::Pop(); |
|
500 |
|
501 SetAttendeeLC( *iEntry, KUser4(), CCalAttendee::EOptParticipant ); |
|
502 CleanupStack::Pop(); |
|
503 |
|
504 SetAttendeeLC( *iEntry, KUser5(), CCalAttendee::EOptParticipant ); |
|
505 CleanupStack::Pop(); |
|
506 |
|
507 SetAttendeeLC( *iEntry, KUser6(), CCalAttendee::EOptParticipant ); |
|
508 CleanupStack::Pop(); |
|
509 |
|
510 CCalUser* phoneOwner = iEntry->PhoneOwnerL(); |
|
511 CCalUser* org = iEntry->OrganizerL(); |
|
512 |
|
513 CreateMREntryL(); // Creating iMrEntry |
|
514 // Test data |
|
515 TESMRRole role = iMrEntry->RoleL(); |
|
516 |
|
517 // When entry is organizer, attendee info should leave with KErrNotSupported |
|
518 //EUNIT_ASSERT_SPECIFIC_LEAVE( iMrEntry->EntryAttendeeInfoL(), KErrNotSupported ); |
|
519 delete iMrEntry; iMrEntry = NULL; |
|
520 |
|
521 // PhoneOwner is set different than organizer, so that AttendeeInfo gives valid value |
|
522 CCalAttendee* attendee = SetAttendeeLC( *iEntry, KUser1(), CCalAttendee::EReqParticipant ); |
|
523 iEntry->SetPhoneOwnerL( attendee ); |
|
524 CleanupStack::Pop( attendee ); |
|
525 |
|
526 // Setting entry to occure in the past so that return value is EESMREntryInfoOccursInPast |
|
527 TCalTime newStartTime; |
|
528 TCalTime newEndTime; |
|
529 TTime newStart = iEntry->StartTimeL().TimeLocalL() - TTimeIntervalDays(10); |
|
530 TTime newEnd = iEntry->EndTimeL().TimeLocalL() - TTimeIntervalDays(10); |
|
531 newStartTime.SetTimeLocalL( newStart ); |
|
532 newEndTime.SetTimeLocalL( newEnd ); |
|
533 iEntry->SetStartAndEndTimeL( newStartTime , newEndTime ); |
|
534 |
|
535 CreateMREntryL(); // Creating iMrEntry |
|
536 // Test data |
|
537 role = iMrEntry->RoleL(); |
|
538 |
|
539 MESMRMeetingRequestEntry::TESMREntryInfo attendeeInfo = iMrEntry->EntryAttendeeInfoL(); |
|
540 |
|
541 EUNIT_ASSERT_DESC( attendeeInfo == MESMRMeetingRequestEntry::EESMREntryInfoOccursInPast, |
|
542 "Entrys attendee info should be EESMREntryInfoOccursInPast" ); |
|
543 |
|
544 } |
|
545 |
|
546 // --------------------------------------------------------------------------- |
|
547 // UT_CESMRMeetingRequestEntry::T_GetRecurrenceL |
|
548 // --------------------------------------------------------------------------- |
|
549 // |
|
550 void UT_CESMRMeetingRequestEntry::T_GetRecurrenceL() |
|
551 { |
|
552 CreateCalEntryL(); // Creating iEntry |
|
553 |
|
554 // Setting recurrence |
|
555 TCalTime meetingStartTime = iEntry->StartTimeL(); |
|
556 TCalRRule rRule; |
|
557 rRule.SetType( TCalRRule::EDaily ); |
|
558 rRule.SetCount( 5 ); |
|
559 //rRule.SetInterval( 1 ); |
|
560 rRule.SetDtStart( meetingStartTime ); |
|
561 iEntry->SetRRuleL( rRule ); |
|
562 // Entry is repeating 5 times every day from today onwards |
|
563 |
|
564 CreateMREntryL(); // Creating iMrEntry |
|
565 |
|
566 TESMRRecurrenceValue recurrence; |
|
567 TTime until; |
|
568 iMrEntry->GetRecurrenceL( recurrence, until ); |
|
569 |
|
570 TTime recurrenceUntil = meetingStartTime.TimeUtcL() + TTimeIntervalDays(4); |
|
571 |
|
572 // Test data |
|
573 TDateTime start = meetingStartTime.TimeLocalL().DateTime(); |
|
574 TDateTime givenUntil = recurrenceUntil.DateTime(); |
|
575 TDateTime fetchedUntil = until.DateTime(); |
|
576 |
|
577 EUNIT_ASSERT_DESC( recurrence == ERecurrenceDaily, "Entry should be recurring daily" ); |
|
578 EUNIT_ASSERT_DESC( until == recurrenceUntil, "Entrys until time is not 5 days from now" ); |
|
579 } |
|
580 |
|
581 |
|
582 // - EUnit test table -------------------------------------------------------- |
|
583 |
|
584 EUNIT_BEGIN_TEST_TABLE( |
|
585 UT_CESMRMeetingRequestEntry, |
|
586 "MRMeetingRequestEntry unit and module tests.", |
|
587 "UNIT" ) |
|
588 |
|
589 EUNIT_TEST( |
|
590 "Class creation (NewL)", |
|
591 "CESMRMeetingRequestEntry", |
|
592 "NewL", |
|
593 "FUNCTIONALITY", |
|
594 SetupL, T_Global_CESMRMeetingRequestEntry_NewL, Teardown ) |
|
595 |
|
596 EUNIT_TEST( |
|
597 "Validate Entry - 1", |
|
598 "CESMRMeetingRequestEntry", |
|
599 "ValidateEntryL", |
|
600 "FUNCTIONALITY", |
|
601 SetupL, T_ValidateEntryL_1, Teardown ) |
|
602 |
|
603 EUNIT_TEST( |
|
604 "Validate Entry - 2", |
|
605 "CESMRMeetingRequestEntry", |
|
606 "ValidateEntryL", |
|
607 "FUNCTIONALITY", |
|
608 SetupL, T_ValidateEntryL_2, Teardown ) |
|
609 |
|
610 EUNIT_TEST( |
|
611 "Entry Attendee Info", |
|
612 "CESMRMeetingRequestEntry", |
|
613 "EntryAttendeeInfoL", |
|
614 "FUNCTIONALITY", |
|
615 SetupL, T_EntryAttendeeInfoL, Teardown ) |
|
616 |
|
617 EUNIT_TEST( |
|
618 "Get recurrence", |
|
619 "CESMRMeetingRequestEntry", |
|
620 "GetRecurrenceL", |
|
621 "FUNCTIONALITY", |
|
622 SetupL, T_GetRecurrenceL, Teardown ) |
|
623 |
|
624 EUNIT_END_TEST_TABLE |