|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32std.h> |
|
17 #include <e32test.h> |
|
18 #include <e32math.h> |
|
19 #include <cntdb.h> |
|
20 #include <cntitem.h> |
|
21 #include <cntfldst.h> |
|
22 #include "t_utils2.h" |
|
23 #include "T_UTILS.H" |
|
24 #include "t_groupview_unfiled_profile.h" |
|
25 |
|
26 // |
|
27 // Macro's |
|
28 // |
|
29 #define CLEAR_ALL_CLOCKS CCntTest::ProfileReset(0, 30) |
|
30 #define START_CLOCK CCntTest::ProfileReset(macroTimer, 1); CCntTest::ProfileStart(macroTimer++) |
|
31 #define STOP_CLOCK CCntTest::ProfileEnd(--macroTimer) |
|
32 #define STOP_CLOCK_TIME( profile ) CCntTest::ProfileEnd(--macroTimer); CCntTest::ProfileResult(&(profile), macroTimer, 1) |
|
33 #define GET_LAST_CLOCK_TIME( profile ) CCntTest::ProfileResult(&profile, macroTimer, 1) |
|
34 |
|
35 // |
|
36 // Constants. |
|
37 // |
|
38 |
|
39 _LIT(KTestName,"t_groupview_unfiled_profile"); |
|
40 _LIT(KLogFileName,"t_groupview_unfiled_profile.log"); |
|
41 |
|
42 _LIT(KDbFileName,"c:t_groupview_unfiled_profile.cdb"); |
|
43 |
|
44 _LIT(KRemoteViewName,"RemoteView"); |
|
45 _LIT(KTextDefSeparator,""); |
|
46 |
|
47 RTest test(KTestName); |
|
48 |
|
49 |
|
50 const TInt KNumContacts=500; |
|
51 const TInt KNumContactsInGroupOne=250; |
|
52 const TInt KMaxContactsToAddInGroupTest = 50; |
|
53 const TInt KMaxContactsToRemoveInGroupTest = 50; |
|
54 |
|
55 _LIT(KGroupOneName,"GroupOne"); |
|
56 |
|
57 // |
|
58 // File scope variable |
|
59 // |
|
60 TInt macroTimer = 1; |
|
61 |
|
62 // |
|
63 // CTestConductor. |
|
64 // |
|
65 |
|
66 CTestConductor* CTestConductor::NewL() |
|
67 { |
|
68 CTestConductor* self=new(ELeave) CTestConductor(); |
|
69 CleanupStack::PushL(self); |
|
70 self->ConstructL(); |
|
71 self->RunTestsL(); |
|
72 CleanupStack::Pop(); |
|
73 return self; |
|
74 } |
|
75 |
|
76 CTestConductor::~CTestConductor() |
|
77 { |
|
78 delete iLog; |
|
79 delete iDb; |
|
80 delete iRandomGenerator; |
|
81 TRAP_IGNORE(CContactDatabase::DeleteDatabaseL(KDbFileName)); |
|
82 iFs.Close(); |
|
83 } |
|
84 |
|
85 CTestConductor::CTestConductor() {} |
|
86 |
|
87 void CTestConductor::ConstructL() |
|
88 { |
|
89 User::LeaveIfError(iFs.Connect()); |
|
90 iLog=CLog::NewL(test,KLogFileName); |
|
91 iDb=CContactDatabase::ReplaceL(KDbFileName); |
|
92 iRandomGenerator=CRandomContactGenerator::NewL(); |
|
93 iRandomGenerator->SetDbL(*iDb); |
|
94 AddContactsL(); |
|
95 } |
|
96 |
|
97 void CTestConductor::AddContactsL() |
|
98 { |
|
99 iTotalContacts=0; |
|
100 TInt ii; |
|
101 for (ii=0;ii<KNumContacts;ii++) |
|
102 { |
|
103 iRandomGenerator->AddTypicalRandomContactL(); |
|
104 iTotalContacts++; |
|
105 test.Printf(_L("Adding %d \n"),ii); |
|
106 } |
|
107 CreateGroupTestDataL(); |
|
108 } |
|
109 |
|
110 void CTestConductor::CreateGroupTestDataL() |
|
111 { |
|
112 CContactGroup* groupOne = static_cast<CContactGroup*>(iDb->CreateContactGroupL(KGroupOneName)); |
|
113 CContactIdArray* idsInGroupViewOne = NULL; |
|
114 |
|
115 CleanupStack::PushL(groupOne); |
|
116 |
|
117 iGroupOneId = groupOne->Id(); |
|
118 for (TInt ii=1;ii<=KNumContactsInGroupOne;++ii) |
|
119 { |
|
120 test.Printf(_L("Making Group Contact %d \n"),ii); |
|
121 iDb->AddContactToGroupL(ii,iGroupOneId); |
|
122 } |
|
123 |
|
124 CleanupStack::PopAndDestroy(groupOne); |
|
125 |
|
126 groupOne = static_cast<CContactGroup*>(iDb->ReadContactL(iGroupOneId)); |
|
127 CleanupStack::PushL(groupOne); |
|
128 |
|
129 idsInGroupViewOne = groupOne->ItemsContainedLC(); |
|
130 CleanupStack::PopAndDestroy(idsInGroupViewOne); |
|
131 CleanupStack::PopAndDestroy(groupOne); |
|
132 } |
|
133 |
|
134 void CTestConductor::AddSingleContactL() |
|
135 { |
|
136 test.Printf(_L("Adding Contact [%d] "), ++iTotalContacts); |
|
137 iRandomGenerator->AddTypicalRandomContactL(); |
|
138 test.Printf(_L(" \n")); |
|
139 } |
|
140 |
|
141 |
|
142 void CTestConductor::PrintTimeTaken(TInt aTime) |
|
143 { |
|
144 iLog->LogLine(_L(" Time Taken [%d.%dus] \n"), aTime/1000000, aTime%1000000); |
|
145 } |
|
146 |
|
147 void CTestConductor::RunTestsL() |
|
148 { |
|
149 CGroupViewTester* tester=CGroupViewTester::NewL(*iLog,*iDb, *this); |
|
150 CleanupStack::PushL(tester); |
|
151 CActiveScheduler::Start(); |
|
152 CleanupStack::Pop(tester); |
|
153 // error from CGroupViewTester? |
|
154 User::LeaveIfError(iTestError); |
|
155 } |
|
156 |
|
157 void CTestConductor::SetTestError(TInt aTestError) |
|
158 { |
|
159 iTestError = aTestError; |
|
160 } |
|
161 |
|
162 |
|
163 // |
|
164 // CGroupViewTester. |
|
165 // |
|
166 |
|
167 CGroupViewTester* CGroupViewTester::NewL(CLog& aLog,CContactDatabase& aDb, CTestConductor& aTestConductor) |
|
168 { |
|
169 CGroupViewTester* self=new(ELeave) CGroupViewTester(aLog,aDb, aTestConductor); |
|
170 CleanupStack::PushL(self); |
|
171 self->ConstructL(); |
|
172 CleanupStack::Pop(); |
|
173 return self; |
|
174 } |
|
175 |
|
176 CGroupViewTester::~CGroupViewTester() |
|
177 { |
|
178 iLocalView->Close(*this); |
|
179 iNamedRemoteView->Close(*this); |
|
180 iSortOrder_1.Close(); |
|
181 delete iTextDef; |
|
182 } |
|
183 |
|
184 CGroupViewTester::CGroupViewTester(CLog& aLog,CContactDatabase& aDb, CTestConductor& aTestConductor) |
|
185 : CActive(EPriorityStandard),iLog(aLog),iDb(aDb),iTestConductor(aTestConductor),iCurrentTest(EPreStartTest) |
|
186 { |
|
187 CActiveScheduler::Add(this); |
|
188 } |
|
189 |
|
190 void CGroupViewTester::ConstructL() |
|
191 { |
|
192 iSortOrder_1.AppendL(KUidContactFieldGivenName); |
|
193 iSortOrder_1.AppendL(KUidContactFieldFamilyName); |
|
194 iSortOrder_1.AppendL(KUidContactFieldCompanyName); |
|
195 |
|
196 iTextDef=CContactTextDef::NewL(); |
|
197 iTextDef->AppendL(TContactTextDefItem(KUidContactFieldGivenName,KTextDefSeparator)); |
|
198 iTextDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName,KTextDefSeparator)); |
|
199 iTextDef->AppendL(TContactTextDefItem(KUidContactFieldCompanyName,KTextDefSeparator)); |
|
200 |
|
201 NextTest(); |
|
202 } |
|
203 |
|
204 void CGroupViewTester::RunL() |
|
205 { |
|
206 TCntProfile profile; |
|
207 |
|
208 switch (iCurrentTest) |
|
209 { |
|
210 case ECreateLocalView: |
|
211 iLog.LogLine(_L("=== Create local view \n")); |
|
212 iLocalView=CContactLocalView::NewL(*this,iDb,iSortOrder_1,EContactAndGroups); |
|
213 break; |
|
214 |
|
215 case ECreateRemoteNamedView: |
|
216 iLog.LogLine(_L("=== Create Remote named view \n")); |
|
217 iNamedRemoteView = CContactNamedRemoteView::NewL(*this,KRemoteViewName,iDb,iSortOrder_1,EContactAndGroups); |
|
218 break; |
|
219 |
|
220 case EStartLocalTests: |
|
221 iLog.LogLine(_L("=== Start Local Tests \n")); |
|
222 CLEAR_ALL_CLOCKS; |
|
223 iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer); |
|
224 START_CLOCK; |
|
225 iTester = CUnfiledGroupViewTester::NewL(iLog, iDb, iTestConductor, *iLocalView, iStatus); |
|
226 SetActive(); |
|
227 iCurrentTest = EEndLocalTests; |
|
228 iTester->StartL(); |
|
229 break; |
|
230 |
|
231 case EEndLocalTests: |
|
232 STOP_CLOCK_TIME( profile ); |
|
233 iLog.LogLine(_L("<< Stop Clock [%d] \n"), macroTimer); |
|
234 iLog.LogLine(_L("== End Local Tests Time to complete \n")); |
|
235 delete iTester; iTester = NULL; |
|
236 iTestConductor.PrintTimeTaken(profile.iTime); |
|
237 NextTest(); |
|
238 break; |
|
239 |
|
240 case EStartRemoteTests: |
|
241 iLog.LogLine(_L("=== Start Remote Tests \n")); |
|
242 CLEAR_ALL_CLOCKS; |
|
243 iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer); |
|
244 START_CLOCK; |
|
245 iTester = CUnfiledGroupViewTester::NewL(iLog, iDb, iTestConductor, *iNamedRemoteView, iStatus); |
|
246 SetActive(); |
|
247 iCurrentTest = EEndRemoteTests; |
|
248 iTester->StartL(); |
|
249 break; |
|
250 |
|
251 case EEndRemoteTests: |
|
252 STOP_CLOCK_TIME( profile ); |
|
253 iLog.LogLine(_L("<< Stop Clock [%d] \n"), macroTimer); |
|
254 iLog.LogLine(_L("== End Remote Tests Time to complete\n")); |
|
255 delete iTester; iTester = NULL; |
|
256 iTestConductor.PrintTimeTaken(profile.iTime); |
|
257 NextTest(); |
|
258 break; |
|
259 |
|
260 |
|
261 case ENumTests: |
|
262 iLog.LogLine(_L("==== No Time to report, tests over ! \n")); |
|
263 iLog.LogLine(_L("==== Group View Tests Finished, All Passed...\n")); |
|
264 CActiveScheduler::Stop(); |
|
265 delete this; |
|
266 break; |
|
267 default: |
|
268 ASSERT(EFalse); |
|
269 break; |
|
270 } |
|
271 } |
|
272 |
|
273 TInt CGroupViewTester::RunError(TInt aError) |
|
274 { |
|
275 // propagate error |
|
276 iTestConductor.SetTestError(aError); |
|
277 |
|
278 switch (iCurrentTest) |
|
279 { |
|
280 case ECreateLocalView: test.Printf(_L("Test failed at step CreateLocalView (%i) with error %i"), iCurrentTest, aError); break; |
|
281 case ECreateRemoteNamedView: test.Printf(_L("Test failed at step CreateRemoteNamedView (%i) with error %i"), iCurrentTest, aError); break; |
|
282 case EStartLocalTests: test.Printf(_L("Test failed at step StartLocalTests (%i) with error %i"), iCurrentTest, aError); break; |
|
283 case EEndLocalTests: test.Printf(_L("Test failed at step EndLocalTests (%i) with error %i"), iCurrentTest, aError); break; |
|
284 case EStartRemoteTests: test.Printf(_L("Test failed at step StartRemoteTests (%i) with error %i"), iCurrentTest, aError); break; |
|
285 case EEndRemoteTests: test.Printf(_L("Test failed at step EndRemoteTests (%i) with error %i"), iCurrentTest, aError); break; |
|
286 |
|
287 case ENumTests: test.Printf(_L("Test failed at step NumTests (%i) with error %i"), iCurrentTest, aError); break; |
|
288 |
|
289 default: test.Printf(_L("Test failed at step %i with error %i"), iCurrentTest, aError); break; |
|
290 } |
|
291 |
|
292 CActiveScheduler::Stop(); |
|
293 return KErrNone; |
|
294 } |
|
295 |
|
296 void CGroupViewTester::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
297 { |
|
298 switch (iCurrentTest) |
|
299 { |
|
300 case ECreateLocalView: |
|
301 test(iLocalView==&aView); |
|
302 test(aEvent.iEventType==TContactViewEvent::EReady); |
|
303 NextTest(); |
|
304 break; |
|
305 case ECreateRemoteNamedView: |
|
306 test(iNamedRemoteView==&aView); |
|
307 test(aEvent.iEventType==TContactViewEvent::EReady); |
|
308 NextTest(); |
|
309 break; |
|
310 case EStartLocalTests: |
|
311 case EEndLocalTests: |
|
312 case EStartRemoteTests: |
|
313 case EEndRemoteTests: |
|
314 case ENumTests: |
|
315 break; |
|
316 default: |
|
317 test(EFalse); |
|
318 break; |
|
319 } |
|
320 |
|
321 } |
|
322 |
|
323 void CGroupViewTester::NextTest() |
|
324 { |
|
325 iCurrentTest = static_cast<TTest>( static_cast<TInt>(iCurrentTest) + 1 ) ; |
|
326 TRequestStatus *pS=&iStatus; |
|
327 User::RequestComplete(pS,KErrNone); |
|
328 SetActive(); |
|
329 } |
|
330 |
|
331 void CGroupViewTester::ExceriseViewL(CContactViewBase& aView) |
|
332 { |
|
333 TContactItemId lastId=0; |
|
334 const TInt numItems=aView.CountL(); |
|
335 for (TInt ii=0;ii<numItems;++ii) |
|
336 { |
|
337 if (ii==numItems-1) |
|
338 { |
|
339 lastId=aView.AtL(ii); |
|
340 } |
|
341 iDb.ReadContactTextDefL(aView.AtL(ii),iScratchBuf,iTextDef); |
|
342 iLog.LogLineNoEcho(iScratchBuf); |
|
343 iScratchBuf.SetLength(0); |
|
344 } |
|
345 |
|
346 test(aView.FindL(lastId)==numItems-1); |
|
347 } |
|
348 |
|
349 |
|
350 void CGroupViewTester::TestGroupViewSortOrderL(CContactGroupView& aView) |
|
351 { |
|
352 iLog.LogLine(_L("<TestGroupViewSortOrderL> ")); |
|
353 const TInt numItems=aView.CountL(); |
|
354 iLog.LogLine(_L("aView.CountL = [%d] \n"), numItems ); |
|
355 for (TInt ii=0;ii<numItems;++ii) |
|
356 { |
|
357 if(ii!=numItems-1)//not last item |
|
358 { |
|
359 TContactIdWithMapping first = (aView.iGroupContacts)[ii]; |
|
360 TContactIdWithMapping second = (aView.iGroupContacts)[ii+1]; |
|
361 test(first.iMapping < second.iMapping); |
|
362 } |
|
363 } |
|
364 } |
|
365 |
|
366 |
|
367 void CGroupViewTester::DoCancel() |
|
368 { |
|
369 } |
|
370 |
|
371 |
|
372 // |
|
373 // CUnfiledGroupViewTester |
|
374 // |
|
375 CUnfiledGroupViewTester* CUnfiledGroupViewTester::NewL(CLog& aLog, CContactDatabase& aDb, CTestConductor& aTestConductor, CContactViewBase& aView, TRequestStatus& aClientStatus) |
|
376 { |
|
377 CUnfiledGroupViewTester* self = new (ELeave) CUnfiledGroupViewTester(aLog, aDb, aTestConductor, aView, aClientStatus); |
|
378 CleanupStack::PushL(self); |
|
379 self->ConstructL(); |
|
380 CleanupStack::Pop(self); |
|
381 return self; |
|
382 } |
|
383 |
|
384 CUnfiledGroupViewTester::CUnfiledGroupViewTester(CLog& aLog, CContactDatabase& aDb, CTestConductor& aTestConductor, CContactViewBase& aView, TRequestStatus& aClientStatus) |
|
385 : CActive(EPriorityStandard), |
|
386 iLog(aLog), |
|
387 iDb(aDb), |
|
388 iView(aView), |
|
389 iTestConductor(aTestConductor), |
|
390 iClientStatus(aClientStatus) |
|
391 { |
|
392 CActiveScheduler::Add(this); |
|
393 iCurrentTest = EPreStartTest; |
|
394 } |
|
395 |
|
396 CUnfiledGroupViewTester::~CUnfiledGroupViewTester() |
|
397 { |
|
398 delete iGroupViewUnfiled; |
|
399 } |
|
400 |
|
401 void CUnfiledGroupViewTester::ConstructL() |
|
402 { |
|
403 } |
|
404 |
|
405 void CUnfiledGroupViewTester::DoCancel() |
|
406 { |
|
407 } |
|
408 |
|
409 void CUnfiledGroupViewTester::StartL() |
|
410 { |
|
411 iClientStatus = KRequestPending; |
|
412 NextTest(); |
|
413 } |
|
414 |
|
415 void CUnfiledGroupViewTester::NextTest() |
|
416 { |
|
417 iCurrentTest = static_cast<TTest>( static_cast<TInt>(iCurrentTest) + 1 ) ; |
|
418 TRequestStatus *pS=&iStatus; |
|
419 User::RequestComplete(pS,KErrNone); |
|
420 SetActive(); |
|
421 } |
|
422 |
|
423 void CUnfiledGroupViewTester::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
424 { |
|
425 TCntProfile profile; |
|
426 TInt sizeOfView = 0; |
|
427 |
|
428 switch (iCurrentTest) |
|
429 { |
|
430 case ECreateUnfiledGroupView: |
|
431 test(iGroupViewUnfiled==&aView); |
|
432 test(aEvent.iEventType==TContactViewEvent::EReady); |
|
433 // Stop timer. |
|
434 STOP_CLOCK_TIME( profile ); |
|
435 iLog.LogLine(_L("<< Stop Clock [%d] \n"), macroTimer); |
|
436 iLog.LogLine(_L("=== Time Taken to create view ")); |
|
437 iTestConductor.PrintTimeTaken(profile.iTime); |
|
438 NextTest(); |
|
439 break; |
|
440 |
|
441 case ETestAddUnfiledContacts: |
|
442 case ETestRemoveUnfiledContacts: |
|
443 TRAPD(err, sizeOfView = iGroupViewUnfiled->CountL() ); |
|
444 test(err == KErrNone); |
|
445 if (sizeOfView == iSizeOfViewToExpect) |
|
446 { |
|
447 // Stop timer. |
|
448 STOP_CLOCK_TIME( profile ); |
|
449 iLog.LogLine(_L("=== Time Taken handle all Messages ")); |
|
450 iLog.LogLine(_L("<< Stop Clock [%d] \n"), macroTimer); |
|
451 iTestConductor.PrintTimeTaken(profile.iTime); |
|
452 iSizeOfViewToExpect = 0; |
|
453 NextTest(); |
|
454 } |
|
455 break; |
|
456 |
|
457 |
|
458 case ENumTests: |
|
459 break; |
|
460 default: |
|
461 test(EFalse); |
|
462 break; |
|
463 } |
|
464 |
|
465 } |
|
466 |
|
467 void CUnfiledGroupViewTester::RunL() |
|
468 { |
|
469 TContactItemId deletedId; |
|
470 TCntProfile profile; |
|
471 TRequestStatus* clientStatus = &iClientStatus; |
|
472 TInt counter = 0; |
|
473 TInt currentSizeOfView = 0; |
|
474 |
|
475 switch (iCurrentTest) |
|
476 { |
|
477 case ECreateUnfiledGroupView: |
|
478 iLog.LogLine(_L("=== Create Unfiled group view")); |
|
479 iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer); |
|
480 START_CLOCK; |
|
481 iGroupViewUnfiled=CContactGroupView::NewL(iDb,iView,*this,KNullContactId,CContactGroupView::EShowContactsNotInAnyGroup); |
|
482 break; |
|
483 |
|
484 case ETestAddUnfiledContacts: |
|
485 iLog.LogLine(_L("==== Add Un-filed Contacts to group")); |
|
486 |
|
487 // Contact added here. |
|
488 // Start timer |
|
489 iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer); |
|
490 iSizeOfViewToExpect = iGroupViewUnfiled->CountL() + KMaxContactsToAddInGroupTest; |
|
491 |
|
492 START_CLOCK; |
|
493 for (counter= 0; counter< KMaxContactsToAddInGroupTest; counter++) |
|
494 { |
|
495 iTestConductor.AddSingleContactL(); |
|
496 } |
|
497 // Stop timer. |
|
498 STOP_CLOCK_TIME( profile ); |
|
499 iLog.LogLine(_L("<< Stop Clock [%d] \n"), macroTimer); |
|
500 iTestConductor.PrintTimeTaken(profile.iTime); |
|
501 // Start timer |
|
502 iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer); |
|
503 START_CLOCK; |
|
504 break; |
|
505 |
|
506 case ETestRemoveUnfiledContacts: |
|
507 iLog.LogLine(_L("==== Remove Un-filed Contacts to group")); |
|
508 |
|
509 // Contact added here. |
|
510 // Start timer |
|
511 currentSizeOfView = iGroupViewUnfiled->CountL(); |
|
512 iSizeOfViewToExpect = currentSizeOfView - KMaxContactsToRemoveInGroupTest; |
|
513 currentSizeOfView--; |
|
514 |
|
515 iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer); |
|
516 START_CLOCK; |
|
517 |
|
518 for (counter = 0; counter < KMaxContactsToRemoveInGroupTest; counter++) |
|
519 { |
|
520 deletedId = iGroupViewUnfiled->AtL( currentSizeOfView - counter ); |
|
521 iDb.DeleteContactL(deletedId); |
|
522 iLog.LogLine(_L("==== Removed contact from DB [%d]"), currentSizeOfView - counter); |
|
523 } |
|
524 // Stop timer. |
|
525 STOP_CLOCK_TIME( profile ); |
|
526 iLog.LogLine(_L("<< Stop Clock [%d] \n"), macroTimer); |
|
527 iTestConductor.PrintTimeTaken(profile.iTime); |
|
528 // Start timer |
|
529 iLog.LogLine(_L(">> Start Clock [%d] \n"), macroTimer); |
|
530 START_CLOCK; |
|
531 break; |
|
532 |
|
533 case ENumTests: |
|
534 iLog.LogLine(_L("==== Group View Tests Finished, All Passed...\n")); |
|
535 User::RequestComplete(clientStatus,KErrNone); |
|
536 break; |
|
537 default: |
|
538 ASSERT(EFalse); |
|
539 break; |
|
540 } |
|
541 } |
|
542 |
|
543 TInt CUnfiledGroupViewTester::RunError(TInt aError) |
|
544 { |
|
545 // propagate error |
|
546 iTestConductor.SetTestError(aError); |
|
547 |
|
548 switch (iCurrentTest) |
|
549 { |
|
550 case ECreateUnfiledGroupView: test.Printf(_L("Test failed at step CreateUnfiledGroupView (%i) with error %i"), iCurrentTest, aError); break; |
|
551 case ETestAddUnfiledContacts: test.Printf(_L("Test failed at step TestAddUnfiledContacts (%i) with error %i"), iCurrentTest, aError); break; |
|
552 case ETestRemoveUnfiledContacts: test.Printf(_L("Test failed at step TestRemoveUnfiledContacts (%i) with error %i"), iCurrentTest, aError); break; |
|
553 |
|
554 case ENumTests: test.Printf(_L("Test failed at step NumTests (%i) with error %i"), iCurrentTest, aError); break; |
|
555 |
|
556 default: test.Printf(_L("Test failed at step %i with error %i"), iCurrentTest, aError); break; |
|
557 } |
|
558 |
|
559 CActiveScheduler::Stop(); |
|
560 return KErrNone; |
|
561 } |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 // |
|
568 // Main. |
|
569 // |
|
570 /** |
|
571 |
|
572 @SYMTestCaseID PIM-T-GROUPVIEW-UNFILED-PROFILE-0001 |
|
573 |
|
574 */ |
|
575 |
|
576 GLDEF_C TInt E32Main() |
|
577 { |
|
578 __UHEAP_MARK; |
|
579 RProcess().SetPriority(EPriorityBackground); |
|
580 CActiveScheduler* scheduler=new CActiveScheduler; |
|
581 test.Start(_L("@SYMTESTCaseID:PIM-T-GROUPVIEW-UNFILED-PROFILE-0001 Test Groupview unfiled profile")); |
|
582 |
|
583 if (scheduler) |
|
584 { |
|
585 CActiveScheduler::Install(scheduler); |
|
586 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
587 if (cleanup) |
|
588 { |
|
589 CTestConductor* testConductor=NULL; |
|
590 TRAPD(err,testConductor=CTestConductor::NewL()); |
|
591 test(err == KErrNone); |
|
592 delete testConductor; |
|
593 delete cleanup; |
|
594 } |
|
595 delete scheduler; |
|
596 } |
|
597 test.End(); |
|
598 test.Close(); |
|
599 __UHEAP_MARKEND; |
|
600 return KErrNone; |
|
601 } |