|
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 <cntdb.h> |
|
19 #include <cntitem.h> |
|
20 #include <cntfldst.h> |
|
21 #include <cntviewbase.h> |
|
22 #include <cntview.h> |
|
23 #include "t_utils2.h" |
|
24 #include "T_UTILS.H" |
|
25 #include "t_filterview_matching_profile.h" |
|
26 #include "cfindtext.h" |
|
27 |
|
28 _LIT(KTestName,"t_filterview"); |
|
29 _LIT(KLogFileName,"t_filterview.log"); |
|
30 |
|
31 _LIT(KDbFileName,"c:t_filterview.cdb"); |
|
32 |
|
33 _LIT(KRemoteViewName,"RemoteView"); |
|
34 _LIT(KTextDefSeparator,""); |
|
35 |
|
36 const TInt KNumSmsContacts=250; |
|
37 const TInt KNumWorkEmailContacts=250; |
|
38 const TInt KNumHomeEmailContacts=250; |
|
39 const TInt KNumLandlineContacts=250; |
|
40 const TInt KNumFaxContacts=250; |
|
41 |
|
42 |
|
43 LOCAL_C void CleanupContactArray(TAny* aArray) |
|
44 { |
|
45 RPointerArray<CViewContact>* array=REINTERPRET_CAST(RPointerArray<CViewContact>*,aArray); |
|
46 if (array) |
|
47 array->ResetAndDestroy(); |
|
48 array->Close(); |
|
49 } |
|
50 |
|
51 CTestConductor* CTestConductor::NewL() |
|
52 { |
|
53 CTestConductor* self=new(ELeave) CTestConductor(); |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(); |
|
56 self->RunTestsL(); |
|
57 CleanupStack::Pop(); |
|
58 return self; |
|
59 } |
|
60 |
|
61 CTestConductor::~CTestConductor() |
|
62 { |
|
63 delete iLog; |
|
64 delete iDb; |
|
65 delete iRandomGenerator; |
|
66 iTest.End(); |
|
67 iTest.Close(); |
|
68 TRAP_IGNORE(CContactDatabase::DeleteDatabaseL(KDbFileName)); |
|
69 iFs.Close(); |
|
70 } |
|
71 |
|
72 CTestConductor::CTestConductor() : iTest(KTestName) |
|
73 { |
|
74 } |
|
75 |
|
76 void CTestConductor::ConstructL() |
|
77 { |
|
78 User::LeaveIfError(iFs.Connect()); |
|
79 iLog=CLog::NewL(iTest,KLogFileName); |
|
80 iDb=CContactDatabase::ReplaceL(KDbFileName); |
|
81 iRandomGenerator=CRandomContactGenerator::NewL(); |
|
82 iRandomGenerator->SetDbL(*iDb); |
|
83 AddContactsL(); |
|
84 } |
|
85 |
|
86 void CTestConductor::AddContactL(TInt aBitwiseFilterType) |
|
87 { |
|
88 iTest.Printf(_L("Adding Contact")); |
|
89 iRandomGenerator->AddTypicalContactForFilterL(aBitwiseFilterType); |
|
90 iTotalContacts++; |
|
91 } |
|
92 |
|
93 void CTestConductor::AddContactsL() |
|
94 { |
|
95 iTotalContacts=0; |
|
96 iTest.Printf(_L("Adding ")); |
|
97 TInt ii; |
|
98 for (ii=0;ii<KNumSmsContacts;ii++) |
|
99 { |
|
100 TInt bit=0; |
|
101 bit |= CContactDatabase::ESmsable; |
|
102 iRandomGenerator->AddTypicalContactForFilterL(bit); |
|
103 iTotalContacts++; |
|
104 } |
|
105 for (ii=0;ii<KNumWorkEmailContacts;ii++) |
|
106 { |
|
107 TInt bit=0; |
|
108 bit |= CContactDatabase::EMailable; |
|
109 iRandomGenerator->AddTypicalContactForFilterL(bit); |
|
110 iTotalContacts++; |
|
111 } |
|
112 for (ii=0;ii<KNumHomeEmailContacts;ii++) |
|
113 { |
|
114 TInt bit=0; |
|
115 bit |= CContactDatabase::EMailable; |
|
116 bit |= CContactDatabase::EHome; |
|
117 iRandomGenerator->AddTypicalContactForFilterL(bit); |
|
118 iTotalContacts++; |
|
119 } |
|
120 for (ii=0;ii<KNumLandlineContacts;ii++) |
|
121 { |
|
122 TInt bit=0; |
|
123 bit |= CContactDatabase::ELandLine; |
|
124 iRandomGenerator->AddTypicalContactForFilterL(bit); |
|
125 iTotalContacts++; |
|
126 } |
|
127 for (ii=0;ii<KNumFaxContacts;ii++) |
|
128 { |
|
129 TInt bit=0; |
|
130 bit |= CContactDatabase::EFaxable; |
|
131 iRandomGenerator->AddTypicalContactForFilterL(bit); |
|
132 iTotalContacts++; |
|
133 } |
|
134 } |
|
135 |
|
136 void CTestConductor::RunTestsL() |
|
137 { |
|
138 CViewTester* tester=CViewTester::NewL(*iLog,iTest,*iDb,this); |
|
139 CleanupStack::PushL(tester); |
|
140 CActiveScheduler::Start(); |
|
141 CleanupStack::Pop(tester); |
|
142 |
|
143 // error from active object |
|
144 iTest(iTestError == KErrNone); |
|
145 } |
|
146 |
|
147 void CTestConductor::SetTestError(TInt aTestError) |
|
148 { |
|
149 iTestError = aTestError; |
|
150 } |
|
151 |
|
152 // |
|
153 // CViewTester. |
|
154 // |
|
155 |
|
156 CViewTester* CViewTester::NewL(CLog& aLog,RTest& aTest,CContactDatabase& aDb,CTestConductor* aTestConductor) |
|
157 { |
|
158 CViewTester* self=new(ELeave) CViewTester(aLog,aTest,aDb,aTestConductor); |
|
159 CleanupStack::PushL(self); |
|
160 self->ConstructL(); |
|
161 CleanupStack::Pop(); |
|
162 return self; |
|
163 } |
|
164 |
|
165 CViewTester::~CViewTester() |
|
166 { |
|
167 iLandlineFilterView->Close(*this); |
|
168 iUnfilteredView->Close(*this); |
|
169 iNamedRemoteView->Close(*this); |
|
170 iSortOrder_1.Close(); |
|
171 iSortOrder_2.Close(); |
|
172 delete iTextDef; |
|
173 } |
|
174 |
|
175 CViewTester::CViewTester(CLog& aLog,RTest& aTest,CContactDatabase& aDb,CTestConductor* aTestConductor) |
|
176 : CActive(EPriorityStandard),iLog(aLog),iTest(aTest),iDb(aDb),iCurrentTest(-1),iTestConductor(aTestConductor) |
|
177 { |
|
178 CActiveScheduler::Add(this); |
|
179 } |
|
180 |
|
181 /** |
|
182 |
|
183 @SYMTestCaseID PIM-T-FILTERVIEW-MATCHING-PROFILE-0001 |
|
184 |
|
185 */ |
|
186 |
|
187 void CViewTester::ConstructL() |
|
188 { |
|
189 iSortOrder_1.AppendL(KUidContactFieldGivenName); |
|
190 iSortOrder_1.AppendL(KUidContactFieldFamilyName); |
|
191 iSortOrder_1.AppendL(KUidContactFieldCompanyName); |
|
192 |
|
193 iTextDef=CContactTextDef::NewL(); |
|
194 iTextDef->AppendL(TContactTextDefItem(KUidContactFieldGivenName,KTextDefSeparator)); |
|
195 iTextDef->AppendL(TContactTextDefItem(KUidContactFieldFamilyName,KTextDefSeparator)); |
|
196 iTextDef->AppendL(TContactTextDefItem(KUidContactFieldCompanyName,KTextDefSeparator)); |
|
197 |
|
198 iSortOrder_2.AppendL(KUidContactFieldCompanyName); |
|
199 iSortOrder_2.AppendL(KUidContactFieldFamilyName); |
|
200 iSortOrder_2.AppendL(KUidContactFieldGivenName); |
|
201 |
|
202 iTest.Start(_L("@SYMTESTCaseID:PIM-T-FILTERVIEW-MATCHING-PROFILE-0001 ")); |
|
203 |
|
204 NextTest(); |
|
205 } |
|
206 |
|
207 void CViewTester::PrintTimeTaken(TInt aTime) |
|
208 { |
|
209 iScratchBuf.Format(_L("** Test Took [%ds%dus] **\n"), aTime/1000000, aTime%1000000); |
|
210 iLog.LogLine(iScratchBuf); |
|
211 //TBuf<100> buffer; |
|
212 //buffer.Format(_L(" Test Took [%ds%dus]\n"), aProfile.iTime/1000000, aProfile.iTime%1000000); |
|
213 //iLog.LogLine(buffer); |
|
214 } |
|
215 |
|
216 |
|
217 void CViewTester::PrintTotalTimeTaken() |
|
218 { |
|
219 TInt counter; |
|
220 TInt totalTime = 0; |
|
221 |
|
222 for (counter = 0; counter < ENumTests; counter++) |
|
223 { |
|
224 totalTime += iTimeForTestsToComplete[counter]; |
|
225 } |
|
226 |
|
227 iScratchBuf.Format(_L("** Total amount of time taken [%ds%dus] **"), totalTime/1000000, totalTime%1000000); |
|
228 iLog.LogLine(iScratchBuf); |
|
229 |
|
230 } |
|
231 |
|
232 void CViewTester::RunL() |
|
233 { |
|
234 TInt counter = 0; |
|
235 switch (iCurrentTest) |
|
236 { |
|
237 case ECreateLocalView: |
|
238 iLog.LogLine(_L("=== Create Name Remote local view")); |
|
239 CCntTest::ProfileReset(0,1); |
|
240 CCntTest::ProfileStart(0); |
|
241 iNamedRemoteView=CContactNamedRemoteView::NewL(*this,KRemoteViewName,iDb,iSortOrder_1,EContactsOnly); |
|
242 break; |
|
243 |
|
244 case ECreateLandlineFilterView: |
|
245 iLog.LogLine(_L("=== Create Land line Filter View {CContactFilteredView}")); |
|
246 iFilter=0; |
|
247 iFilter|=CContactDatabase::ELandLine; |
|
248 CCntTest::ProfileReset(0,1); |
|
249 CCntTest::ProfileStart(0); |
|
250 iLandlineFilterView=CContactFilteredView::NewL(*this,iDb,*iNamedRemoteView,iFilter); |
|
251 break; |
|
252 |
|
253 case ECreateUnfilteredView: |
|
254 iLog.LogLine(_L("=== Create Unfilter View {CContactFilteredView}")); |
|
255 iFilter=0; |
|
256 CCntTest::ProfileReset(0,1); |
|
257 CCntTest::ProfileStart(0); |
|
258 iUnfilteredView=CContactFilteredView::NewL(*this,iDb,*iNamedRemoteView,iFilter); |
|
259 break; |
|
260 |
|
261 case ETestContactsMatchingPrefixL_LandLine: |
|
262 iLog.LogLine(_L("=== Testing ContactsMatchPrefixL - LandLine")); |
|
263 iTimeForTestsToComplete[ETestContactsMatchingPrefixL_LandLine] = 0; |
|
264 for (counter = 1; counter < 7; counter++) |
|
265 { |
|
266 CCntTest::ProfileReset(0,1); |
|
267 CCntTest::ProfileStart(0); |
|
268 ProfileContactMatchingPrefixL(counter, iLandlineFilterView); |
|
269 CCntTest::ProfileEnd(0); |
|
270 CCntTest::ProfileResult(&iProfile,0,1); |
|
271 iTimeForTestsToComplete[ETestContactsMatchingPrefixL_LandLine] += iProfile.iTime; |
|
272 PrintTimeTaken(iProfile.iTime); |
|
273 } |
|
274 // do stuff |
|
275 NextTest(); |
|
276 break; |
|
277 |
|
278 case ETestContactsMatchingPrefixL_Unfiltered: |
|
279 iLog.LogLine(_L("=== Testing ContactsMatchPrefixL - Unfiltered")); |
|
280 iTimeForTestsToComplete[ETestContactsMatchingPrefixL_Unfiltered] = 0; |
|
281 for (counter = 1; counter < 7; counter++) |
|
282 { |
|
283 CCntTest::ProfileReset(0,1); |
|
284 CCntTest::ProfileStart(0); |
|
285 ProfileContactMatchingPrefixL(counter, iUnfilteredView); |
|
286 CCntTest::ProfileEnd(0); |
|
287 CCntTest::ProfileResult(&iProfile,0,1); |
|
288 iTimeForTestsToComplete[ETestContactsMatchingPrefixL_Unfiltered] += iProfile.iTime; |
|
289 PrintTimeTaken(iProfile.iTime); |
|
290 } |
|
291 // do stuff |
|
292 NextTest(); |
|
293 break; |
|
294 |
|
295 case ETestContactsMatchingCriteriaL_LandLine: |
|
296 iLog.LogLine(_L("=== Testing ContactsMatchCriteriaL - LandLine")); |
|
297 iTimeForTestsToComplete[ETestContactsMatchingPrefixL_LandLine] = 0; |
|
298 for (counter = 1; counter < 7; counter++) |
|
299 { |
|
300 CCntTest::ProfileReset(0,1); |
|
301 CCntTest::ProfileStart(0); |
|
302 ProfileContactMatchingCriteriaL(counter, iLandlineFilterView); |
|
303 CCntTest::ProfileEnd(0); |
|
304 CCntTest::ProfileResult(&iProfile,0,1); |
|
305 iTimeForTestsToComplete[ETestContactsMatchingCriteriaL_LandLine] += iProfile.iTime; |
|
306 PrintTimeTaken(iProfile.iTime); |
|
307 } |
|
308 // do stuff |
|
309 NextTest(); |
|
310 break; |
|
311 |
|
312 case ETestContactsMatchingCriteriaL_Unfiltered: |
|
313 iLog.LogLine(_L("=== Testing ContactsMatchCriteriaL - Unfiltered")); |
|
314 iTimeForTestsToComplete[ETestContactsMatchingPrefixL_Unfiltered] = 0; |
|
315 for (counter = 1; counter < 7; counter++) |
|
316 { |
|
317 CCntTest::ProfileReset(0,1); |
|
318 CCntTest::ProfileStart(0); |
|
319 ProfileContactMatchingCriteriaL(counter, iUnfilteredView); |
|
320 CCntTest::ProfileEnd(0); |
|
321 CCntTest::ProfileResult(&iProfile,0,1); |
|
322 iTimeForTestsToComplete[ETestContactsMatchingCriteriaL_Unfiltered] += iProfile.iTime; |
|
323 PrintTimeTaken(iProfile.iTime); |
|
324 } |
|
325 // do stuff |
|
326 NextTest(); |
|
327 break; |
|
328 |
|
329 case ENumTests: |
|
330 iLog.LogLine(_L("==== Filter View Finished")); |
|
331 PrintTotalTimeTaken(); |
|
332 CActiveScheduler::Stop(); |
|
333 delete this; |
|
334 break; |
|
335 |
|
336 default: |
|
337 ASSERT(EFalse); |
|
338 break; |
|
339 } |
|
340 } |
|
341 |
|
342 TInt CViewTester::RunError(TInt aError) |
|
343 { |
|
344 // propagate error |
|
345 iTestConductor->SetTestError(aError); |
|
346 |
|
347 switch (iCurrentTest) |
|
348 { |
|
349 case ECreateLocalView: iTest.Printf(_L("test failed at step CreateLocalView (%i) with error %i"), iCurrentTest, aError); break; |
|
350 case ECreateLandlineFilterView: iTest.Printf(_L("test failed at step CreateLandlineFilterView (%i) with error %i"), iCurrentTest, aError); break; |
|
351 case ECreateUnfilteredView: iTest.Printf(_L("test failed at step CreateUnfilteredView (%i) with error %i"), iCurrentTest, aError); break; |
|
352 case ETestContactsMatchingPrefixL_LandLine: iTest.Printf(_L("test failed at step TestContactsMatchingPrefixL_LandLine (%i) with error %i"), iCurrentTest, aError); break; |
|
353 case ETestContactsMatchingPrefixL_Unfiltered: iTest.Printf(_L("test failed at step TestContactsMatchingPrefixL_Unfiltered (%i) with error %i"), iCurrentTest, aError); break; |
|
354 case ETestContactsMatchingCriteriaL_LandLine: iTest.Printf(_L("test failed at step TestContactsMatchingCriteriaL_LandLine (%i) with error %i"), iCurrentTest, aError); break; |
|
355 case ETestContactsMatchingCriteriaL_Unfiltered: iTest.Printf(_L("test failed at step TestContactsMatchingCriteriaL_Unfiltered (%i) with error %i"), iCurrentTest, aError); break; |
|
356 case ENumTests: iTest.Printf(_L("test failed at step NumTests (%i) with error %i"), iCurrentTest, aError); break; |
|
357 |
|
358 default: iTest.Printf(_L("test failed at step %i with error %i"), iCurrentTest, aError); break; |
|
359 } |
|
360 |
|
361 CActiveScheduler::Stop(); |
|
362 return KErrNone; |
|
363 } |
|
364 |
|
365 void CViewTester::ProfileContactMatchingPrefixL(TInt aNumberOfS, CContactFilteredView* aContactFilterView) |
|
366 { |
|
367 CFindText* findText = NULL; |
|
368 RPointerArray<CViewContact> contactArray; |
|
369 CleanupStack::PushL(TCleanupItem(CleanupContactArray, &contactArray)); |
|
370 switch(aNumberOfS) |
|
371 { |
|
372 case 1: |
|
373 findText = CFindText::NewLC(_L("S")); |
|
374 break; |
|
375 case 2: |
|
376 findText = CFindText::NewLC(_L("SS")); |
|
377 break; |
|
378 case 3: |
|
379 findText = CFindText::NewLC(_L("SSS")); |
|
380 break; |
|
381 case 4: |
|
382 findText = CFindText::NewLC(_L("SSSS")); |
|
383 break; |
|
384 case 5: |
|
385 findText = CFindText::NewLC(_L("SSSSS")); |
|
386 break; |
|
387 case 6: |
|
388 findText = CFindText::NewLC(_L("SSSSSS")); |
|
389 break; |
|
390 }; |
|
391 |
|
392 aContactFilterView->ContactsMatchingPrefixL(*findText, contactArray); |
|
393 |
|
394 CleanupStack::PopAndDestroy(findText); |
|
395 CleanupStack::PopAndDestroy(&contactArray); |
|
396 } |
|
397 |
|
398 void CViewTester::ProfileContactMatchingCriteriaL(TInt aNumberOfS, CContactFilteredView* aContactFilterView) |
|
399 { |
|
400 //_LIT(KFindString, "S"); |
|
401 //CPtrCArray* array = new (ELeave) CPtrC16Array(1); |
|
402 //CleanupStack::PushL(array); |
|
403 //array->AppendL(KFindString()); |
|
404 CFindText* findText = NULL; |
|
405 RPointerArray<CViewContact> contactArray; |
|
406 CleanupStack::PushL(TCleanupItem(CleanupContactArray, &contactArray)); |
|
407 switch(aNumberOfS) |
|
408 { |
|
409 case 1: |
|
410 findText = CFindText::NewLC(_L("S")); |
|
411 break; |
|
412 case 2: |
|
413 findText = CFindText::NewLC(_L("SS")); |
|
414 break; |
|
415 case 3: |
|
416 findText = CFindText::NewLC(_L("SSS")); |
|
417 break; |
|
418 case 4: |
|
419 findText = CFindText::NewLC(_L("SSSS")); |
|
420 break; |
|
421 case 5: |
|
422 findText = CFindText::NewLC(_L("SSSSS")); |
|
423 break; |
|
424 case 6: |
|
425 findText = CFindText::NewLC(_L("SSSSSS")); |
|
426 break; |
|
427 }; |
|
428 aContactFilterView->ContactsMatchingCriteriaL(*findText, contactArray); |
|
429 |
|
430 CleanupStack::PopAndDestroy(findText); |
|
431 CleanupStack::PopAndDestroy(&contactArray); |
|
432 } |
|
433 |
|
434 // Should always return true for a correct implementation of |
|
435 // CContactViewBase |
|
436 TBool CViewTester::ContactIdsEqualL(const CContactViewBase& aView, TInt aIndex) |
|
437 { |
|
438 TContactItemId viewId = aView.AtL(aIndex); |
|
439 RDebug::Print(_L("UnderLyingView viewId : %d"),viewId); |
|
440 TContactItemId contactId = aView.ContactAtL(aIndex).Id(); |
|
441 RDebug::Print(_L("Sub View Id contactId : %d"),contactId); |
|
442 return (contactId == viewId); |
|
443 } |
|
444 |
|
445 void CViewTester::TestViewIndiciesL(const CContactViewBase& aView) |
|
446 { |
|
447 for (TInt i=0; i < aView.CountL(); ++i) |
|
448 { |
|
449 iTest(ContactIdsEqualL(aView,i)!=EFalse); |
|
450 } |
|
451 } |
|
452 |
|
453 void CViewTester::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
454 { |
|
455 switch (iCurrentTest) |
|
456 { |
|
457 case ECreateLocalView: |
|
458 iTest(iNamedRemoteView==&aView); |
|
459 iTest(aEvent.iEventType==TContactViewEvent::EReady); |
|
460 CCntTest::ProfileEnd(0); |
|
461 CCntTest::ProfileResult(&iProfile,0,1); |
|
462 iTimeForTestsToComplete[ECreateLocalView] = iProfile.iTime; |
|
463 PrintTimeTaken(iProfile.iTime); |
|
464 break; |
|
465 case ECreateLandlineFilterView: |
|
466 iTest(iLandlineFilterView==&aView); |
|
467 iTest(aEvent.iEventType==TContactViewEvent::EReady); |
|
468 CCntTest::ProfileEnd(0); |
|
469 CCntTest::ProfileResult(&iProfile,0,1); |
|
470 iTimeForTestsToComplete[ECreateLandlineFilterView] = iProfile.iTime; |
|
471 PrintTimeTaken(iProfile.iTime); |
|
472 break; |
|
473 case ECreateUnfilteredView: |
|
474 iTest(iUnfilteredView==&aView); |
|
475 iTest(aEvent.iEventType==TContactViewEvent::EReady); |
|
476 CCntTest::ProfileEnd(0); |
|
477 CCntTest::ProfileResult(&iProfile,0,1); |
|
478 iTimeForTestsToComplete[ECreateUnfilteredView] = iProfile.iTime; |
|
479 PrintTimeTaken(iProfile.iTime); |
|
480 break; |
|
481 |
|
482 case ENumTests: |
|
483 default: |
|
484 iTest(EFalse); |
|
485 break; |
|
486 } |
|
487 if (--iNumNotificationExpected<=0) |
|
488 { |
|
489 NextTest(); |
|
490 iNumNotificationExpected=0; |
|
491 } |
|
492 } |
|
493 |
|
494 void CViewTester::TestViewNotificationsL(CContactViewBase& /*aView*/) |
|
495 { |
|
496 //Test just add some contacts for now... |
|
497 /* CRandomContactGenerator* generator=CRandomContactGenerator::NewL(); |
|
498 CleanupStack::PushL(generator); |
|
499 generator->SetDbL(iDb); |
|
500 for (TInt ii=0;ii<KInitialNumContacts;++ii) |
|
501 { |
|
502 generator->AddTypicalRandomContactL(); |
|
503 } |
|
504 CleanupStack::PopAndDestroy(); // generator. |
|
505 */ } |
|
506 |
|
507 void CViewTester::NextTest() |
|
508 { |
|
509 ++iCurrentTest; |
|
510 TRequestStatus *pS=&iStatus; |
|
511 User::RequestComplete(pS,KErrNone); |
|
512 SetActive(); |
|
513 } |
|
514 |
|
515 void CViewTester::ExceriseViewL(CContactViewBase& aView) |
|
516 { |
|
517 TContactItemId lastId=0; |
|
518 const TInt numItems=aView.CountL(); |
|
519 for (TInt ii=0;ii<numItems;++ii) |
|
520 { |
|
521 if (ii==numItems-1) |
|
522 { |
|
523 lastId=aView.AtL(ii); |
|
524 } |
|
525 iDb.ReadContactTextDefL(aView.AtL(ii),iScratchBuf,iTextDef); |
|
526 iLog.LogLineNoEcho(iScratchBuf); |
|
527 iScratchBuf.SetLength(0); |
|
528 } |
|
529 |
|
530 iTest(aView.FindL(lastId)==numItems-1); |
|
531 } |
|
532 |
|
533 void CViewTester::DoCancel() |
|
534 { |
|
535 } |
|
536 |
|
537 // |
|
538 // Main. |
|
539 // |
|
540 |
|
541 |
|
542 GLDEF_C TInt E32Main() |
|
543 { |
|
544 __UHEAP_MARK; |
|
545 CActiveScheduler* scheduler=new CActiveScheduler; |
|
546 if (scheduler) |
|
547 { |
|
548 CActiveScheduler::Install(scheduler); |
|
549 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
550 if (cleanup) |
|
551 { |
|
552 CTestConductor* testConductor=NULL; |
|
553 TRAP_IGNORE(testConductor=CTestConductor::NewL()); |
|
554 delete testConductor; |
|
555 delete cleanup; |
|
556 } |
|
557 delete scheduler; |
|
558 } |
|
559 __UHEAP_MARKEND; |
|
560 return KErrNone; |
|
561 } |