author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 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 the License "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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// SYSTEM INCLUDE FILES |
|
22 |
#include <e32base.h> |
|
23 |
#include <f32file.h> //for RFile and Rfs |
|
24 |
#include <calentry.h>//for CCalEntry |
|
25 |
#include <calinstance.h> |
|
26 |
||
27 |
#include "teststartconsolealarmserver.h" |
|
28 |
||
29 |
// USER INCLUDE FILES |
|
30 |
#include "calexptestcases.h" |
|
31 |
#include "calendarheader.h" |
|
32 |
#include "calendarservice.h" |
|
33 |
||
34 |
||
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
35 |
#include<ascliclientutils.h> |
19 | 36 |
|
37 |
||
38 |
||
39 |
_LIT(KCalName ,"c:Calendar"); |
|
40 |
||
41 |
_LIT(KTestCal1Name ,"c:testcal1"); |
|
42 |
_LIT(KTestCal2Name ,"c:testcal2"); |
|
43 |
||
44 |
||
45 |
_LIT(KExportAllFileName ,"C:\\exportAll.txt"); |
|
46 |
_LIT(KExportAllAsyncFileName ,"C:\\exportAllAsync.txt"); |
|
47 |
||
48 |
_LIT(KExportGuidsFileName ,"C:\\exportForGuids.txt"); |
|
49 |
_LIT(KExportGuidsAsyncFileName,"C:\\exportForGuidsAsync.txt"); |
|
50 |
||
51 |
_LIT(KExportLuidsFileName ,"C:\\exportForLuids.txt"); |
|
52 |
_LIT(KExportLuidsAsyncFileName,"C:\\exportForLuidsAsync.txt"); |
|
53 |
||
54 |
_LIT(KICALExportAllFileName ,"C:\\icalexportAll.txt"); |
|
55 |
_LIT(KICALExportAllAsyncFileName ,"C:\\icalexportAllAsync.txt"); |
|
56 |
||
57 |
_LIT(KICALExportGuidsFileName ,"C:\\icalexportForGuids.txt"); |
|
58 |
_LIT(KICALExportGuidsAsyncFileName,"C:\\icalexportForGuidsAsync.txt"); |
|
59 |
||
60 |
_LIT(KICALExportLuidsFileName ,"C:\\icalexportForLuids.txt"); |
|
61 |
_LIT(KICALExportLuidsAsyncFileName,"C:\\icalexportForLuidsAsync.txt"); |
|
62 |
||
63 |
||
64 |
||
65 |
CCalExpTestCases* CCalExpTestCases::NewL(TInt& aResult, TInt aVCalOrICal) //1 means VCal else ICal |
|
66 |
{ |
|
67 |
CCalExpTestCases* self = new(ELeave)CCalExpTestCases(aResult, aVCalOrICal); //1 means VCal else ICal; |
|
68 |
||
69 |
self->ConstructL(); |
|
70 |
||
71 |
return self; |
|
72 |
} |
|
73 |
||
74 |
CCalExpTestCases::~CCalExpTestCases() |
|
75 |
{ |
|
76 |
Cancel(); |
|
77 |
||
78 |
if(iWaitSchedular->IsStarted()) |
|
79 |
iWaitSchedular->AsyncStop(); |
|
80 |
||
81 |
if(iCalendarService) |
|
82 |
delete iCalendarService; |
|
83 |
||
84 |
if(iWaitSchedular) |
|
85 |
delete iWaitSchedular; |
|
86 |
||
87 |
iArruids.ResetAndDestroy(); |
|
88 |
} |
|
89 |
||
90 |
||
91 |
// |
|
92 |
//Whats done here? |
|
93 |
// Export all the entries of default system calendar to exportall.txt file |
|
94 |
// |
|
95 |
TInt CCalExpTestCases::TestExportAllL() |
|
96 |
{ |
|
97 |
//No need to set it but for the sake of semanitics set to sync value |
|
98 |
iTestCaseType = KExportSync; |
|
99 |
||
100 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
101 |
||
102 |
iResult = AddCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
103 |
||
104 |
if(iResult != KErrNone) |
|
105 |
return iResult ; |
|
106 |
||
107 |
RPointerArray<TUIDSet> arruids(5); |
|
108 |
||
109 |
TUIDSet* uids = NULL; |
|
110 |
||
111 |
if(AddAppointment(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
112 |
{ |
|
113 |
arruids.Append(uids); |
|
114 |
uids = NULL; |
|
115 |
} |
|
116 |
||
117 |
if(AddEvent(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
118 |
{ |
|
119 |
arruids.Append(uids); |
|
120 |
uids = NULL; |
|
121 |
} |
|
122 |
||
123 |
if(AddReminder(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
124 |
{ |
|
125 |
arruids.Append(uids); |
|
126 |
uids = NULL; |
|
127 |
} |
|
128 |
||
129 |
if(AddAnny(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
130 |
{ |
|
131 |
arruids.Append(uids); |
|
132 |
uids = NULL; |
|
133 |
} |
|
134 |
||
135 |
if(AddToDo(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
136 |
{ |
|
137 |
arruids.Append(uids); |
|
138 |
uids = NULL; |
|
139 |
} |
|
140 |
||
141 |
||
142 |
CCalendarExportParams *expParams = CCalendarExportParams::NewL(); |
|
143 |
||
144 |
HBufC8* buffer = NULL; |
|
145 |
if( iVCalOrICal == 1) |
|
146 |
{ |
|
147 |
TRAP( iResult ,iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatVCal.operator()() , expParams ,buffer ) ); |
|
148 |
} |
|
149 |
else |
|
150 |
{ |
|
151 |
TRAP( iResult ,iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatICal.operator()() , expParams ,buffer ) ); |
|
152 |
} |
|
153 |
||
154 |
delete expParams; |
|
155 |
||
156 |
if(iResult != KErrNone) |
|
157 |
{ |
|
158 |
delete buffer; |
|
159 |
arruids.ResetAndDestroy(); |
|
160 |
return iResult; |
|
161 |
} |
|
162 |
||
163 |
||
164 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
165 |
||
166 |
iResult = AddCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
167 |
||
168 |
if(iResult != KErrNone) |
|
169 |
return iResult ; |
|
170 |
||
171 |
RPointerArray<TUIDSet> uIDSet(5); |
|
172 |
||
173 |
if( iVCalOrICal == 1) |
|
174 |
{ |
|
175 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatVCal.operator()() , *buffer ,uIDSet ) ); |
|
176 |
} |
|
177 |
else |
|
178 |
{ |
|
179 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatICal.operator()() , *buffer ,uIDSet ) ); |
|
180 |
} |
|
181 |
||
182 |
||
183 |
if(iResult != KErrNone) |
|
184 |
{ |
|
185 |
delete buffer; |
|
186 |
arruids.ResetAndDestroy(); |
|
187 |
uIDSet.ResetAndDestroy(); |
|
188 |
return iResult; |
|
189 |
} |
|
190 |
||
191 |
if ( arruids.Count() != uIDSet.Count() ) |
|
192 |
iResult = KErrGeneral; |
|
193 |
||
194 |
delete buffer; |
|
195 |
arruids.ResetAndDestroy(); |
|
196 |
uIDSet.ResetAndDestroy(); |
|
197 |
||
198 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
199 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
200 |
||
201 |
return iResult; |
|
202 |
||
203 |
} |
|
204 |
||
205 |
||
206 |
||
207 |
// |
|
208 |
//Whats done here? |
|
209 |
// Get the List of GUIDS of entries of the Default system Calender Using GetList of CCalendarService |
|
210 |
// Then Export the entries corresponding to GUIDS to exportforguids.txt |
|
211 |
// |
|
212 |
TInt CCalExpTestCases::TestExportForGuidsL() |
|
213 |
{ |
|
214 |
//No need to set it but for the sake of semanitics set to sync value |
|
215 |
iTestCaseType = KExportSync; |
|
216 |
||
217 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
218 |
||
219 |
iResult = AddCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
220 |
||
221 |
if(iResult != KErrNone) |
|
222 |
return iResult ; |
|
223 |
||
224 |
RPointerArray<TUIDSet> arruids(5); |
|
225 |
||
226 |
TUIDSet* uids = NULL; |
|
227 |
||
228 |
if(AddAppointment(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
229 |
{ |
|
230 |
arruids.Append(uids); |
|
231 |
uids = NULL; |
|
232 |
} |
|
233 |
||
234 |
if(AddEvent(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
235 |
{ |
|
236 |
arruids.Append(uids); |
|
237 |
uids = NULL; |
|
238 |
} |
|
239 |
||
240 |
if(AddReminder(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
241 |
{ |
|
242 |
arruids.Append(uids); |
|
243 |
uids = NULL; |
|
244 |
} |
|
245 |
||
246 |
if(AddAnny(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
247 |
{ |
|
248 |
arruids.Append(uids); |
|
249 |
uids = NULL; |
|
250 |
} |
|
251 |
||
252 |
if(AddToDo(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
253 |
{ |
|
254 |
arruids.Append(uids); |
|
255 |
uids = NULL; |
|
256 |
} |
|
257 |
||
258 |
||
259 |
CCalendarExportParams *expParams = CCalendarExportParams::NewL(); |
|
260 |
||
261 |
TInt count = arruids.Count(); |
|
262 |
for(TInt index = 0; index < count; ++index) |
|
263 |
{ |
|
264 |
expParams->AddGuidL( (arruids[index]->iGlobalUID)->Des() ); |
|
265 |
} |
|
266 |
HBufC8* buffer = NULL; |
|
267 |
if( iVCalOrICal == 1) |
|
268 |
{ |
|
269 |
TRAP( iResult ,iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatVCal.operator()() , expParams ,buffer ) ); |
|
270 |
} |
|
271 |
else |
|
272 |
{ |
|
273 |
TRAP( iResult ,iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatICal.operator()() , expParams ,buffer ) ); |
|
274 |
} |
|
275 |
||
276 |
delete expParams; |
|
277 |
||
278 |
if(iResult != KErrNone) |
|
279 |
{ |
|
280 |
delete buffer; |
|
281 |
arruids.ResetAndDestroy(); |
|
282 |
return iResult; |
|
283 |
} |
|
284 |
||
285 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
286 |
||
287 |
iResult = AddCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
288 |
||
289 |
if(iResult != KErrNone) |
|
290 |
return iResult ; |
|
291 |
||
292 |
RPointerArray<TUIDSet> uIDSet(5); |
|
293 |
||
294 |
if( iVCalOrICal == 1) |
|
295 |
{ |
|
296 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatVCal.operator()() , *buffer ,uIDSet ) ); |
|
297 |
} |
|
298 |
else |
|
299 |
{ |
|
300 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatICal.operator()() , *buffer ,uIDSet ) ); |
|
301 |
} |
|
302 |
||
303 |
||
304 |
if(iResult != KErrNone) |
|
305 |
{ |
|
306 |
delete buffer; |
|
307 |
arruids.ResetAndDestroy(); |
|
308 |
uIDSet.ResetAndDestroy(); |
|
309 |
return iResult; |
|
310 |
} |
|
311 |
||
312 |
if ( arruids.Count() != uIDSet.Count() ) |
|
313 |
iResult = KErrGeneral; |
|
314 |
||
315 |
delete buffer; |
|
316 |
arruids.ResetAndDestroy(); |
|
317 |
uIDSet.ResetAndDestroy(); |
|
318 |
||
319 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
320 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
321 |
||
322 |
return iResult; |
|
323 |
} |
|
324 |
||
325 |
||
326 |
||
327 |
// |
|
328 |
//Whats done here? |
|
329 |
// Get the List of LUIDS of entries of the Default system Calender Using GetList of CCalendarService |
|
330 |
// Then Export the entries corresponding to LUIDS to exportforluids.txt |
|
331 |
// |
|
332 |
TInt CCalExpTestCases::TestExportForLuidsL() |
|
333 |
{ |
|
334 |
//No need to set it but for the sake of semanitics set to sync value |
|
335 |
iTestCaseType = KExportSync; |
|
336 |
||
337 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
338 |
||
339 |
iResult = AddCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
340 |
||
341 |
if(iResult != KErrNone) |
|
342 |
return iResult ; |
|
343 |
||
344 |
RPointerArray<TUIDSet> arruids(5); |
|
345 |
||
346 |
TUIDSet* uids = NULL; |
|
347 |
||
348 |
if(AddAppointment(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
349 |
{ |
|
350 |
arruids.Append(uids); |
|
351 |
uids = NULL; |
|
352 |
} |
|
353 |
||
354 |
if(AddEvent(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
355 |
{ |
|
356 |
arruids.Append(uids); |
|
357 |
uids = NULL; |
|
358 |
} |
|
359 |
||
360 |
if(AddReminder(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
361 |
{ |
|
362 |
arruids.Append(uids); |
|
363 |
uids = NULL; |
|
364 |
} |
|
365 |
||
366 |
if(AddAnny(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
367 |
{ |
|
368 |
arruids.Append(uids); |
|
369 |
uids = NULL; |
|
370 |
} |
|
371 |
||
372 |
if(AddToDo(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
373 |
{ |
|
374 |
arruids.Append(uids); |
|
375 |
uids = NULL; |
|
376 |
} |
|
377 |
||
378 |
||
379 |
CCalendarExportParams *expParams = CCalendarExportParams::NewL(); |
|
380 |
||
381 |
TInt count = arruids.Count(); |
|
382 |
for(TInt index = 0; index < count; ++index) |
|
383 |
{ |
|
384 |
expParams->AddLocalUid( (arruids[index]->iLocalUID) ); |
|
385 |
} |
|
386 |
HBufC8* buffer = NULL; |
|
387 |
if( iVCalOrICal == 1) |
|
388 |
{ |
|
389 |
TRAP( iResult ,iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatVCal.operator()() , expParams ,buffer ) ); |
|
390 |
} |
|
391 |
else |
|
392 |
{ |
|
393 |
TRAP( iResult ,iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatICal.operator()() , expParams ,buffer ) ); |
|
394 |
} |
|
395 |
||
396 |
delete expParams; |
|
397 |
||
398 |
if(iResult != KErrNone) |
|
399 |
{ |
|
400 |
delete buffer; |
|
401 |
arruids.ResetAndDestroy(); |
|
402 |
return iResult; |
|
403 |
} |
|
404 |
||
405 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
406 |
||
407 |
iResult = AddCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
408 |
||
409 |
if(iResult != KErrNone) |
|
410 |
return iResult ; |
|
411 |
||
412 |
RPointerArray<TUIDSet> uIDSet(5); |
|
413 |
||
414 |
if( iVCalOrICal == 1) |
|
415 |
{ |
|
416 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatVCal.operator()() , *buffer ,uIDSet ) ); |
|
417 |
} |
|
418 |
else |
|
419 |
{ |
|
420 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatICal.operator()() , *buffer ,uIDSet ) ); |
|
421 |
} |
|
422 |
||
423 |
||
424 |
if(iResult != KErrNone) |
|
425 |
{ |
|
426 |
delete buffer; |
|
427 |
arruids.ResetAndDestroy(); |
|
428 |
uIDSet.ResetAndDestroy(); |
|
429 |
return iResult; |
|
430 |
} |
|
431 |
||
432 |
if ( arruids.Count() != uIDSet.Count() ) |
|
433 |
iResult = KErrGeneral; |
|
434 |
||
435 |
delete buffer; |
|
436 |
arruids.ResetAndDestroy(); |
|
437 |
uIDSet.ResetAndDestroy(); |
|
438 |
||
439 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
440 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
441 |
||
442 |
return iResult; |
|
443 |
} |
|
444 |
||
445 |
||
446 |
||
447 |
// |
|
448 |
//Whats done here? |
|
449 |
// Get the List of GUIDS of entries of the Default system Calender Using GetList of CCalendarService |
|
450 |
// Then Export the entries aynchronously corresponding to GUIDS to exportforguidsasync.txt |
|
451 |
// |
|
452 |
//Asynchronous test case so setting the iTestCaseType as it is to be handled in RunL |
|
453 |
void CCalExpTestCases::TestExportForGuidsAsyncL() |
|
454 |
{ |
|
455 |
iTestCaseType = KExportForGuidsAsync; |
|
456 |
Start(); |
|
457 |
||
458 |
} |
|
459 |
||
460 |
// |
|
461 |
//Whats done here? |
|
462 |
// Export all the entries of default system calendar asynchronously to exportallaync.txt file |
|
463 |
// |
|
464 |
//Asynchronous test case so setting the iTestCaseType as it is to be handled in RunL |
|
465 |
void CCalExpTestCases::TestExportAllAsyncL() |
|
466 |
{ |
|
467 |
iTestCaseType = KExportAllAsync; |
|
468 |
Start(); |
|
469 |
} |
|
470 |
||
471 |
||
472 |
// |
|
473 |
//Whats done here? |
|
474 |
// Get the List of GUIDS of entries of the Default system Calender Using GetList of CCalendarService |
|
475 |
// Then Export the entries aynchronously corresponding to GUIDS to exportforguidsasync.txt |
|
476 |
// |
|
477 |
//Asynchronous test case so setting the iTestCaseType as it is to be handled in RunL |
|
478 |
void CCalExpTestCases::TestExportForLuidsAsyncL() |
|
479 |
{ |
|
480 |
iTestCaseType = KExportForLuidsAsync; |
|
481 |
Start(); |
|
482 |
} |
|
483 |
||
484 |
||
485 |
||
486 |
||
487 |
TInt CCalExpTestCases::Result() |
|
488 |
{ |
|
489 |
return iResult; |
|
490 |
} |
|
491 |
||
492 |
void CCalExpTestCases::ConstructL() |
|
493 |
{ |
|
494 |
iCalendarService = CCalendarService::NewL(); |
|
495 |
||
496 |
iWaitSchedular = new(ELeave) CActiveSchedulerWait(); |
|
497 |
} |
|
498 |
||
499 |
CCalExpTestCases::CCalExpTestCases(TInt& aResult, TInt aVCalOrICal ) : |
|
500 |
CActive(EPriorityStandard), iResult( aResult ) , |
|
501 |
iVCalOrICal(aVCalOrICal) |
|
502 |
{ |
|
503 |
||
504 |
} |
|
505 |
||
506 |
//for the sake of ActiveObject |
|
507 |
void CCalExpTestCases::DoCancel() |
|
508 |
{ |
|
509 |
||
510 |
} |
|
511 |
||
512 |
void CCalExpTestCases::RunL() |
|
513 |
{ |
|
514 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
515 |
||
516 |
iResult = AddCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
517 |
||
518 |
if(iResult != KErrNone) |
|
519 |
goto Final; |
|
520 |
||
521 |
TUIDSet* uids = NULL; |
|
522 |
||
523 |
if(AddAppointment(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
524 |
{ |
|
525 |
iArruids.Append(uids); |
|
526 |
uids = NULL; |
|
527 |
} |
|
528 |
||
529 |
if(AddEvent(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
530 |
{ |
|
531 |
iArruids.Append(uids); |
|
532 |
uids = NULL; |
|
533 |
} |
|
534 |
||
535 |
if(AddReminder(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
536 |
{ |
|
537 |
iArruids.Append(uids); |
|
538 |
uids = NULL; |
|
539 |
} |
|
540 |
||
541 |
if(AddAnny(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
542 |
{ |
|
543 |
iArruids.Append(uids); |
|
544 |
uids = NULL; |
|
545 |
} |
|
546 |
||
547 |
if(AddToDo(iCalendarService, KTestCal1Name.operator()(), uids) == KErrNone && uids) |
|
548 |
{ |
|
549 |
iArruids.Append(uids); |
|
550 |
uids = NULL; |
|
551 |
} |
|
552 |
||
553 |
||
554 |
CCalendarExportParams *expParams = CCalendarExportParams::NewL(); |
|
555 |
||
556 |
TInt count; |
|
557 |
||
558 |
switch( iTestCaseType ) |
|
559 |
{ |
|
560 |
case KExportAllAsync: |
|
561 |
if( iVCalOrICal == 1) |
|
562 |
{ |
|
563 |
TRAP( iResult, iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatVCal.operator()() , expParams , this )); |
|
564 |
} |
|
565 |
else |
|
566 |
{ |
|
567 |
TRAP( iResult, iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatICal.operator()() , expParams , this )); |
|
568 |
} |
|
569 |
||
570 |
break; |
|
571 |
||
572 |
case KExportForGuidsAsync: |
|
573 |
count = iArruids.Count(); |
|
574 |
for(TInt index = 0; index < count; ++index) |
|
575 |
{ |
|
576 |
expParams->AddGuidL( (iArruids[index]->iGlobalUID)->Des() ); |
|
577 |
} |
|
578 |
||
579 |
if( iVCalOrICal == 1) |
|
580 |
{ |
|
581 |
TRAP( iResult, iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatVCal.operator()() , expParams, this ) ); |
|
582 |
} |
|
583 |
else |
|
584 |
{ |
|
585 |
TRAP( iResult, iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatICal.operator()() , expParams, this ) ); |
|
586 |
} |
|
587 |
||
588 |
break; |
|
589 |
||
590 |
case KExportForLuidsAsync: |
|
591 |
count = iArruids.Count(); |
|
592 |
for(TInt index = 0; index < count; ++index) |
|
593 |
{ |
|
594 |
expParams->AddLocalUid( (iArruids[index]->iLocalUID) ); |
|
595 |
} |
|
596 |
if( iVCalOrICal == 1) |
|
597 |
{ |
|
598 |
TRAP( iResult, iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatVCal.operator()() , expParams, this ) ); |
|
599 |
} |
|
600 |
else |
|
601 |
{ |
|
602 |
TRAP( iResult, iCalendarService->ExportL( KTestCal1Name.operator()() , KFormatICal.operator()() , expParams, this ) ); |
|
603 |
} |
|
604 |
||
605 |
break; |
|
606 |
||
607 |
} |
|
608 |
delete expParams; |
|
609 |
Final: ; |
|
610 |
} |
|
611 |
||
612 |
void CCalExpTestCases::Start() |
|
613 |
{ |
|
614 |
CActiveScheduler::Add(this); |
|
615 |
||
616 |
SetActive(); |
|
617 |
||
618 |
TRequestStatus* temp = &iStatus; |
|
619 |
||
620 |
User::RequestComplete(temp, KErrNone); |
|
621 |
||
622 |
iWaitSchedular->Start(); |
|
623 |
} |
|
624 |
||
625 |
||
626 |
void CCalExpTestCases::NotifyResultL(TInt aErrCode, TAny* aResult) |
|
627 |
{ |
|
628 |
//******************* set iResult **************************** |
|
629 |
iResult = aErrCode; |
|
630 |
||
631 |
if(iResult != KErrNone) |
|
632 |
goto EndPoint; |
|
633 |
||
634 |
//******************* set iResult **************************** |
|
635 |
||
636 |
||
637 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
638 |
||
639 |
iResult = AddCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
640 |
||
641 |
if(iResult != KErrNone) |
|
642 |
goto EndPoint; |
|
643 |
||
644 |
RPointerArray<TUIDSet> uSet(5); |
|
645 |
||
646 |
if( iVCalOrICal == 1) |
|
647 |
{ |
|
648 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatVCal.operator()() , *(HBufC8*)aResult ,uSet ) ); |
|
649 |
} |
|
650 |
else |
|
651 |
{ |
|
652 |
TRAP( iResult ,iCalendarService->ImportL( KTestCal2Name.operator()() , KFormatICal.operator()() , *(HBufC8*)aResult ,uSet ) ); |
|
653 |
} |
|
654 |
||
655 |
||
656 |
if(iResult != KErrNone) |
|
657 |
{ |
|
658 |
uSet.ResetAndDestroy(); |
|
659 |
goto EndPoint; |
|
660 |
} |
|
661 |
||
662 |
if ( iArruids.Count() != uSet.Count() ) |
|
663 |
iResult = KErrGeneral; |
|
664 |
||
665 |
||
666 |
uSet.ResetAndDestroy(); |
|
667 |
||
668 |
||
669 |
EndPoint: |
|
670 |
RemoveCalendarFile(iCalendarService, KTestCal1Name.operator()()); |
|
671 |
RemoveCalendarFile(iCalendarService, KTestCal2Name.operator()()); |
|
672 |
||
673 |
iWaitSchedular->AsyncStop(); |
|
674 |
} |