|
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 <collate.h> |
|
19 #include <cntdb.h> |
|
20 #include <cntitem.h> |
|
21 #include <cntfldst.h> |
|
22 #include "t_utils2.h" |
|
23 #include "t_view2.h" |
|
24 #include "T_UTILS.H" |
|
25 #include <badesca.h> |
|
26 |
|
27 //#define VERBOSE_LOGGING |
|
28 |
|
29 // Test Macro |
|
30 LOCAL_D RTest test(_L("t_view2")); |
|
31 |
|
32 // |
|
33 // Constants. |
|
34 // |
|
35 |
|
36 _LIT(KTestName,"@SYMTESTCaseID:PIM-T-VIEW2-0001 t_view2"); |
|
37 _LIT(KLogFileName,"t_view2.log"); |
|
38 |
|
39 _LIT(KDbFileName,"c:t_view2.cdb"); |
|
40 |
|
41 _LIT(KLocalViewName,"LocalView"); |
|
42 _LIT(KRemoteViewName,"RemoteView"); |
|
43 _LIT(KTextDefSeparator,""); |
|
44 _LIT8(KUnicodeLineEnd,"\x0D\x00\x0a\x00"); |
|
45 _LIT(KWhiteSpaces, " "); |
|
46 const TInt KNumberOfUnsortableContacts=10; |
|
47 |
|
48 // test files |
|
49 _LIT(KContactsFile1, "z:\\t_view2\\t_view2_initial_contacts.txt"); |
|
50 _LIT(KContactsFile2, "z:\\t_view2\\t_view2_more_contacts_1.txt"); |
|
51 _LIT(KContactsFile3, "z:\\t_view2\\t_view2_more_contacts_2.txt"); |
|
52 |
|
53 LOCAL_C void CleanupContactArray(TAny* aArray) |
|
54 { |
|
55 RPointerArray<CViewContact>* array=REINTERPRET_CAST(RPointerArray<CViewContact>*,aArray); |
|
56 if (array) |
|
57 array->ResetAndDestroy(); |
|
58 array->Close(); |
|
59 } |
|
60 |
|
61 // |
|
62 // CTestConductor. |
|
63 // |
|
64 |
|
65 CTestConductor* CTestConductor::NewL() |
|
66 { |
|
67 CTestConductor* self=new(ELeave) CTestConductor(); |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL(); |
|
70 CleanupStack::Pop(); |
|
71 return self; |
|
72 } |
|
73 |
|
74 CTestConductor::~CTestConductor() |
|
75 { |
|
76 iLocalView->Close(*this); |
|
77 iNamedLocalView->Close(*this); |
|
78 iRemoteView_1->Close(*this); |
|
79 iRemoteView_2->Close(*this); |
|
80 iNamedRemoteView_1->Close(*this); |
|
81 iNamedRemoteView_2->Close(*this); |
|
82 iLocalViewWithViewPreferences->Close(*this); |
|
83 iSubViewLessThanA->Close(*this); |
|
84 iSubViewAbc->Close(*this); |
|
85 iSubViewDef->Close(*this); |
|
86 iSubViewGhi->Close(*this); |
|
87 iSubViewJkl->Close(*this); |
|
88 iSubViewGreaterThanOrEqualToM->Close(*this); |
|
89 iConcatenatedView->Close(*this); |
|
90 iSortOrder_1.Close(); |
|
91 iSortOrder_2.Close(); |
|
92 iSortOrder_3.Close(); |
|
93 iSortOrder_4.Close(); |
|
94 iLocalFindView->Close(*this); |
|
95 iFreshLocalView->Close(*this); |
|
96 |
|
97 iRemoteFindView->Close(*this); |
|
98 |
|
99 if(iFindDesArray) |
|
100 { |
|
101 iFindDesArray->Reset(); |
|
102 delete iFindDesArray; |
|
103 } |
|
104 |
|
105 iFindDesArray2->Reset(); |
|
106 delete iFindDesArray2; |
|
107 |
|
108 delete iUnsortableAdder; |
|
109 delete iRandomGenerator; |
|
110 delete iSortChecker; |
|
111 delete iViewCreator; |
|
112 delete iContactAdder; |
|
113 delete iContactRemover; |
|
114 delete iViewExerciser; |
|
115 delete iSortOrderChanger; |
|
116 delete iOwnCardRemover; |
|
117 delete iOwnCardModifier; |
|
118 delete iLog; |
|
119 delete iDb; |
|
120 iTestIds.Reset(); |
|
121 iTestIds.Close(); |
|
122 |
|
123 TRAP_IGNORE(CContactDatabase::DeleteDatabaseL(KDbFileName)); |
|
124 iFs.Delete(KLogFileName()); |
|
125 iFs.RmDir(KLogFileName()); |
|
126 iFs.Close(); |
|
127 } |
|
128 |
|
129 CTestConductor::CTestConductor() : CActive(EPriorityIdle),iCurrentTestNumber(-1) |
|
130 { |
|
131 CActiveScheduler::Add(this); |
|
132 } |
|
133 |
|
134 void CTestConductor::ConstructL() |
|
135 { |
|
136 iSortOrder_1.AppendL(KUidContactFieldGivenName); |
|
137 iSortOrder_1.AppendL(KUidContactFieldFamilyName); |
|
138 iSortOrder_1.AppendL(KUidContactFieldCompanyName); |
|
139 |
|
140 iSortOrder_2.AppendL(KUidContactFieldFamilyName); |
|
141 iSortOrder_2.AppendL(KUidContactFieldGivenName); |
|
142 iSortOrder_2.AppendL(KUidContactFieldCompanyName); |
|
143 |
|
144 iSortOrder_3.AppendL(KUidContactFieldGivenName); |
|
145 iSortOrder_3.AppendL(KUidContactFieldFamilyName); |
|
146 iSortOrder_3.AppendL(KUidContactFieldEMail); |
|
147 iSortOrder_3.AppendL(KUidContactFieldCompanyName); |
|
148 iSortOrder_3.AppendL(KUidContactFieldPhoneNumber); |
|
149 |
|
150 iSortOrder_4.AppendL(KUidContactFieldGivenName); |
|
151 |
|
152 User::LeaveIfError(iFs.Connect()); |
|
153 iFs.MkDirAll(KLogFileName()); |
|
154 iLog=CLog::NewL(test,KLogFileName); |
|
155 iDb=CContactDatabase::ReplaceL(KDbFileName); |
|
156 |
|
157 iSortChecker=CSortChecker::NewL(*this); |
|
158 iViewCreator=CViewCreator::NewL(*this); |
|
159 iContactAdder=CContactAdder::NewL(*this); |
|
160 iContactRemover=CContactRemover::NewL(*this); |
|
161 iViewExerciser=CViewExerciser::NewL(*this); |
|
162 iSortOrderChanger=CSortOrderChanger::NewL(*this); |
|
163 iOwnCardRemover = new(ELeave) CContactOwnCardRemover(*this); |
|
164 iOwnCardModifier = new(ELeave) CContactOwnCardModifier(*this); |
|
165 |
|
166 iRandomGenerator=CRandomContactGenerator::NewL(); |
|
167 iRandomGenerator->SetDbL(*iDb); |
|
168 |
|
169 |
|
170 NextTest(); |
|
171 CActiveScheduler::Start(); |
|
172 // error from active object? |
|
173 User::LeaveIfError(iTestError); |
|
174 test.Printf(_L("\n")); |
|
175 } |
|
176 |
|
177 void CTestConductor::NextTest() |
|
178 { |
|
179 ++iCurrentTestNumber; |
|
180 TRequestStatus *pS=&iStatus; |
|
181 User::RequestComplete(pS,KErrNone); |
|
182 SetActive(); |
|
183 } |
|
184 |
|
185 void CTestConductor::RunL() |
|
186 { |
|
187 switch (iCurrentTestNumber) |
|
188 { |
|
189 case ECreateLocalView: |
|
190 iLog->LogLine(_L("=== Create local view")); |
|
191 iCurrentTestObject=iViewCreator; |
|
192 iLocalView=iViewCreator->CreateLocalViewL(iSortOrder_1); |
|
193 break; |
|
194 case EAddInitialContacts: |
|
195 iLog->LogLine(_L("=== Add initial contacts")); |
|
196 iCurrentTestObject=iContactAdder; |
|
197 iContactAdder->AddContactsL(KContactsFile1,1); |
|
198 break; |
|
199 case EExerciseLocalView_1: |
|
200 iLog->LogLine(_L("=== Exercise local view (1)")); |
|
201 iCurrentTestObject=iViewExerciser; |
|
202 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iLocalView); |
|
203 iLog->LogLine(_L("=== Profiling local view Contact At()(1)")); |
|
204 iViewExerciser->ProfileViewL(*iLocalView); |
|
205 break; |
|
206 case ECreateLocalNamedView: |
|
207 iLog->LogLine(_L("=== Create named local view")); |
|
208 iCurrentTestObject=iViewCreator; |
|
209 iNamedLocalView=iViewCreator->CreateNamedLocalViewL(KLocalViewName,iSortOrder_1); |
|
210 break; |
|
211 case EExerciseLocalNamedView_1: |
|
212 iLog->LogLine(_L("=== Exercise named local view (1)")); |
|
213 iCurrentTestObject=iViewExerciser; |
|
214 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iNamedLocalView); |
|
215 break; |
|
216 case EAddMoreContacts_1: |
|
217 iLog->LogLine(_L("=== Add more contacts (1)")); |
|
218 iCurrentTestObject=iContactAdder; |
|
219 iContactAdder->AddContactsL(KContactsFile2,2); |
|
220 break; |
|
221 case EExerciseLocalView_2: |
|
222 iLog->LogLine(_L("=== Exercise local view (2)")); |
|
223 iCurrentTestObject=iViewExerciser; |
|
224 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iLocalView); |
|
225 break; |
|
226 case EExerciseLocalNamedView_2: |
|
227 iLog->LogLine(_L("=== Exercise named local view (2)")); |
|
228 iCurrentTestObject=iViewExerciser; |
|
229 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iNamedLocalView); |
|
230 break; |
|
231 case ECreateRemoteView1: |
|
232 iLog->LogLine(_L("=== Create remote view")); |
|
233 iCurrentTestObject=iViewCreator; |
|
234 iRemoteView_1=iViewCreator->CreateRemoteViewL(iSortOrder_1); |
|
235 break; |
|
236 case EExerciseRemoteView1: |
|
237 { |
|
238 iLog->LogLine(_L("=== Exercise remote view")); |
|
239 iCurrentTestObject=iViewExerciser; |
|
240 |
|
241 iFindDesArray =new(ELeave)CPtrC16Array(1); |
|
242 iFindDesArray->AppendL(_L("Administrator")); |
|
243 iLocalFindView= CContactFindView::NewL(*iDb,*iLocalView,*this,iFindDesArray); |
|
244 iRemoteFindView = CContactFindView::NewL(*iDb,*iRemoteView_1,*this,iFindDesArray); |
|
245 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iRemoteView_1); |
|
246 iLog->LogLine(_L("=== Profiling Remote view Contact At()")); |
|
247 iViewExerciser->ProfileViewL(*iRemoteView_1); |
|
248 } |
|
249 break; |
|
250 case ECreateRemoteView2: |
|
251 iLog->LogLine(_L("=== Create remote view - view of same sort already exists")); |
|
252 iCurrentTestObject=iViewCreator; |
|
253 iRemoteView_2=iViewCreator->CreateRemoteViewL(iSortOrder_1); |
|
254 break; |
|
255 case EExerciseRemoteView2: |
|
256 { |
|
257 iLog->LogLine(_L("=== Exercise remote view - view of same sort already exists")); |
|
258 iFindDesArray2 =new(ELeave)CPtrC16Array(2); |
|
259 iFindDesArray2->AppendL(_L("Administrator")); |
|
260 iFindDesArray2->AppendL(_L("Notes")); |
|
261 iFindDesArray->Reset(); |
|
262 delete iFindDesArray; |
|
263 iLocalFindView->RefineFindViewL(iFindDesArray2); |
|
264 iRemoteFindView->RefineFindViewL(iFindDesArray2); |
|
265 iFindDesArray =new(ELeave)CPtrC16Array(1); |
|
266 iFindDesArray->AppendL(_L("Administrator")); |
|
267 iLocalFindView->RefineFindViewL(iFindDesArray); |
|
268 iRemoteFindView->RefineFindViewL(iFindDesArray); |
|
269 iCurrentTestObject=iViewExerciser; |
|
270 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iRemoteView_2); |
|
271 } |
|
272 break; |
|
273 case ECreateNamedRemoteView1: |
|
274 iLog->LogLine(_L("=== Create named remote view")); |
|
275 iCurrentTestObject=iViewCreator; |
|
276 iNamedRemoteView_1=iViewCreator->CreateNamedRemoteViewL(KRemoteViewName,iSortOrder_1); |
|
277 break; |
|
278 case EExerciseNamedRemoteView1: |
|
279 iLog->LogLine(_L("=== Exercise named remote view")); |
|
280 iCurrentTestObject=iViewExerciser; |
|
281 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iNamedRemoteView_1); |
|
282 break; |
|
283 case ECreateNamedRemoteView2: |
|
284 iLog->LogLine(_L("=== Create named remote view - view of same name already exists")); |
|
285 iCurrentTestObject=iViewCreator; |
|
286 iNamedRemoteView_2=iViewCreator->CreateNamedRemoteViewL(KRemoteViewName,iSortOrder_1); |
|
287 break; |
|
288 case EExerciseNamedRemoteView2: |
|
289 iLog->LogLine(_L("=== Exercise named remote view - view of same name already exists")); |
|
290 iCurrentTestObject=iViewExerciser; |
|
291 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iNamedRemoteView_2); |
|
292 break; |
|
293 case ECreateSubViewLessThanA: |
|
294 iLog->LogLine(_L("=== Create \"less than A\" subview")); |
|
295 iCurrentTestObject=iViewCreator; |
|
296 iSubViewLessThanA=iViewCreator->CreateSubViewL(*iNamedRemoteView_1,_L("<a")); |
|
297 break; |
|
298 case EExerciseSubViewLessThanA: |
|
299 iLog->LogLine(_L("=== Exercise \"less than A\" subview")); |
|
300 iCurrentTestObject=iViewExerciser; |
|
301 iViewExerciser->ExerciseLowSubViewL(CSortChecker::EFirstNameLastName,*iSubViewLessThanA,_L("a")); |
|
302 break; |
|
303 case ECreateSubViewAbc: |
|
304 iLog->LogLine(_L("=== Create \"ABC\" subview")); |
|
305 iCurrentTestObject=iViewCreator; |
|
306 iSubViewAbc=iViewCreator->CreateSubViewL(*iNamedRemoteView_1,_L(">=a"),_L("<d")); |
|
307 break; |
|
308 case EExerciseSubViewAbc: |
|
309 iLog->LogLine(_L("=== Exercise \"ABC\" subview")); |
|
310 iCurrentTestObject=iViewExerciser; |
|
311 iViewExerciser->ExerciseSubViewL(CSortChecker::EFirstNameLastName,*iSubViewAbc,_L("a"),_L("d")); |
|
312 break; |
|
313 case ECreateSubViewDef: |
|
314 iLog->LogLine(_L("=== Create \"DEF\" subview")); |
|
315 iCurrentTestObject=iViewCreator; |
|
316 iSubViewDef=iViewCreator->CreateSubViewL(*iNamedRemoteView_1,_L(">=d"),_L("<g")); |
|
317 break; |
|
318 case EExerciseSubViewDef: |
|
319 iLog->LogLine(_L("=== Exercise \"DEF\" subview")); |
|
320 iCurrentTestObject=iViewExerciser; |
|
321 iViewExerciser->ExerciseSubViewL(CSortChecker::EFirstNameLastName,*iSubViewDef,_L("d"),_L("g")); |
|
322 break; |
|
323 case ECreateSubViewGhi: |
|
324 iLog->LogLine(_L("=== Create \"GHI\" subview")); |
|
325 iCurrentTestObject=iViewCreator; |
|
326 iSubViewGhi=iViewCreator->CreateSubViewL(*iNamedRemoteView_1,_L(">=g"),_L("<j")); |
|
327 break; |
|
328 case EExerciseSubViewGhi: |
|
329 iLog->LogLine(_L("=== Exercise \"GHI\" subview")); |
|
330 iCurrentTestObject=iViewExerciser; |
|
331 iViewExerciser->ExerciseSubViewL(CSortChecker::EFirstNameLastName,*iSubViewGhi,_L("g"),_L("j")); |
|
332 break; |
|
333 case ECreateSubViewJkl: |
|
334 iLog->LogLine(_L("=== Create \"JKL\" subview")); |
|
335 iCurrentTestObject=iViewCreator; |
|
336 iSubViewJkl=iViewCreator->CreateSubViewL(*iNamedRemoteView_1,_L(">=j"),_L("<m")); |
|
337 break; |
|
338 case EExerciseSubViewJkl: |
|
339 iLog->LogLine(_L("=== Exercise \"JKL\" subview")); |
|
340 iCurrentTestObject=iViewExerciser; |
|
341 iViewExerciser->ExerciseSubViewL(CSortChecker::EFirstNameLastName,*iSubViewJkl,_L("j"),_L("m")); |
|
342 break; |
|
343 case ECreateSubViewGreaterThanOrEqualToM: |
|
344 iLog->LogLine(_L("=== Create \"greater than M\" subview")); |
|
345 iCurrentTestObject=iViewCreator; |
|
346 iSubViewGreaterThanOrEqualToM=iViewCreator->CreateSubViewL(*iNamedRemoteView_1,_L(">=m")); |
|
347 break; |
|
348 case EExerciseSubViewGreaterThanOrEqualToM: |
|
349 iLog->LogLine(_L("=== Exercise \"greater than M\" subview")); |
|
350 iCurrentTestObject=iViewExerciser; |
|
351 iViewExerciser->ExerciseHighSubViewL(CSortChecker::EFirstNameLastName,*iSubViewGreaterThanOrEqualToM,_L("m")); |
|
352 break; |
|
353 case ECreateConcatenatedView: |
|
354 iLog->LogLine(_L("=== Create concatenated view of all the subviews")); |
|
355 { |
|
356 RPointerArray<CContactViewBase> views; |
|
357 User::LeaveIfError(views.Append(iSubViewLessThanA)); |
|
358 User::LeaveIfError(views.Append(iSubViewAbc)); |
|
359 User::LeaveIfError(views.Append(iSubViewDef)); |
|
360 User::LeaveIfError(views.Append(iSubViewGhi)); |
|
361 User::LeaveIfError(views.Append(iSubViewJkl)); |
|
362 User::LeaveIfError(views.Append(iSubViewGreaterThanOrEqualToM)); |
|
363 iCurrentTestObject=iViewCreator; |
|
364 iConcatenatedView=iViewCreator->CreateConcatenatedViewL(views); |
|
365 views.Close(); |
|
366 } |
|
367 break; |
|
368 case EExerciseConcatenatedView: |
|
369 iLog->LogLine(_L("=== Exercise concatenated view of all the subviews")); |
|
370 iCurrentTestObject=iViewExerciser; |
|
371 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iConcatenatedView); |
|
372 break; |
|
373 case EChangeSortOrder1: |
|
374 iLog->LogLine(_L("=== Change sort order (1) of underlying named remoted view")); |
|
375 iCurrentTestObject=iSortOrderChanger; |
|
376 iSortOrderChanger->ChangeSortOrderL(iSortOrder_3,*iNamedRemoteView_1,14); |
|
377 break; |
|
378 case EChangeSortOrder2: |
|
379 iLog->LogLine(_L("=== Change sort order (2) of underlying named remoted view")); |
|
380 iCurrentTestObject=iSortOrderChanger; |
|
381 iSortOrderChanger->ChangeSortOrderL(iSortOrder_4,*iNamedRemoteView_1,14); |
|
382 break; |
|
383 case EChangeSortOrder3: |
|
384 iLog->LogLine(_L("=== Change sort order (3) of underlying named remoted view")); |
|
385 iCurrentTestObject=iSortOrderChanger; |
|
386 iSortOrderChanger->ChangeSortOrderL(iSortOrder_2,*iNamedRemoteView_1,14); |
|
387 break; |
|
388 case EExerciseAllAffectedViews: |
|
389 iLog->LogLine(_L("=== Exercise all views affected by sort order change")); |
|
390 iViewExerciser->QueueNextTestWhenComplete(EFalse); |
|
391 iLog->LogLine(_L("==== Exercise named remote view")); |
|
392 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iNamedRemoteView_1); |
|
393 iLog->LogLine(_L("==== Exercise named remote view - view of same name already exists")); |
|
394 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iNamedRemoteView_2); |
|
395 iLog->LogLine(_L("==== Exercise \"less than A\" subview")); |
|
396 iViewExerciser->ExerciseLowSubViewL(CSortChecker::ELastNameFirstName,*iSubViewLessThanA,_L("a")); |
|
397 iLog->LogLine(_L("==== Exercise \"ABC\" subview")); |
|
398 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewAbc,_L("a"),_L("d")); |
|
399 iLog->LogLine(_L("==== Exercise \"DEF\" subview")); |
|
400 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewDef,_L("d"),_L("g")); |
|
401 iLog->LogLine(_L("==== Exercise \"GHI\" subview")); |
|
402 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewGhi,_L("g"),_L("j")); |
|
403 iLog->LogLine(_L("==== Exercise \"JKL\" subview")); |
|
404 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewJkl,_L("j"),_L("m")); |
|
405 iLog->LogLine(_L("==== Exercise \"greater than M\" subview")); |
|
406 iViewExerciser->ExerciseHighSubViewL(CSortChecker::ELastNameFirstName,*iSubViewGreaterThanOrEqualToM,_L("m")); |
|
407 iLog->LogLine(_L("==== Exercise concatenated view of all the subviews")); |
|
408 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iConcatenatedView); |
|
409 NextTest(); |
|
410 break; |
|
411 case EAddMoreContacts_2: |
|
412 iLog->LogLine(_L("=== Add more contacts (2)")); |
|
413 iCurrentTestObject=iContactAdder; |
|
414 iContactAdder->AddContactsL(KContactsFile3,18); |
|
415 break; |
|
416 case EExerciseAllViews_1: |
|
417 iLog->LogLine(_L("=== Exercise all views (1)")); |
|
418 iLog->LogLine(_L("==== Exercise local view (2)")); |
|
419 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iLocalView); |
|
420 iLog->LogLine(_L("==== Exercise named local view (2)")); |
|
421 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iNamedLocalView); |
|
422 iLog->LogLine(_L("==== Exercise remote view")); |
|
423 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iRemoteView_1); |
|
424 iLog->LogLine(_L("==== Exercise remote view - view of same sort already exists")); |
|
425 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iRemoteView_2); |
|
426 iLog->LogLine(_L("==== Exercise named remote view")); |
|
427 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iNamedRemoteView_1); |
|
428 iLog->LogLine(_L("==== Exercise named remote view - view of same name already exists")); |
|
429 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iNamedRemoteView_2); |
|
430 iLog->LogLine(_L("==== Exercise \"less than A\" subview")); |
|
431 iViewExerciser->ExerciseLowSubViewL(CSortChecker::ELastNameFirstName,*iSubViewLessThanA,_L("a")); |
|
432 iLog->LogLine(_L("==== Exercise \"ABC\" subview")); |
|
433 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewAbc,_L("a"),_L("d")); |
|
434 iLog->LogLine(_L("==== Exercise \"DEF\" subview")); |
|
435 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewDef,_L("d"),_L("g")); |
|
436 iLog->LogLine(_L("==== Exercise \"GHI\" subview")); |
|
437 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewGhi,_L("g"),_L("j")); |
|
438 iLog->LogLine(_L("==== Exercise \"JKL\" subview")); |
|
439 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewJkl,_L("j"),_L("m")); |
|
440 iLog->LogLine(_L("==== Exercise \"greater than M\" subview")); |
|
441 iViewExerciser->ExerciseHighSubViewL(CSortChecker::ELastNameFirstName,*iSubViewGreaterThanOrEqualToM,_L("m")); |
|
442 iLog->LogLine(_L("==== Exercise concatenated view of all the subviews")); |
|
443 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iConcatenatedView); |
|
444 NextTest(); |
|
445 break; |
|
446 case ERemoveSomeContacts: |
|
447 iLog->LogLine(_L("=== Remove some contacts")); |
|
448 iCurrentTestObject=iContactRemover; |
|
449 //iContactRemover->RemoveContactsL(KContactsFile2,18); |
|
450 NextTest(); |
|
451 break; |
|
452 case EExerciseAllViews_2: |
|
453 iLog->LogLine(_L("=== Exercise all views (2)")); |
|
454 iLog->LogLine(_L("==== Exercise local view (3)")); |
|
455 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iLocalView); |
|
456 iLog->LogLine(_L("==== Exercise named local view (3)")); |
|
457 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iNamedLocalView); |
|
458 iLog->LogLine(_L("==== Exercise remote view")); |
|
459 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iRemoteView_1); |
|
460 iLog->LogLine(_L("==== Exercise remote view - view of same sort already exists")); |
|
461 iViewExerciser->ExerciseViewL(CSortChecker::EFirstNameLastName,*iRemoteView_2); |
|
462 iLog->LogLine(_L("==== Exercise named remote view")); |
|
463 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iNamedRemoteView_1); |
|
464 iLog->LogLine(_L("==== Exercise named remote view - view of same name already exists")); |
|
465 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iNamedRemoteView_2); |
|
466 iLog->LogLine(_L("==== Exercise \"less than A\" subview")); |
|
467 iViewExerciser->ExerciseLowSubViewL(CSortChecker::ELastNameFirstName,*iSubViewLessThanA,_L("a")); |
|
468 iLog->LogLine(_L("==== Exercise \"ABC\" subview")); |
|
469 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewAbc,_L("a"),_L("d")); |
|
470 iLog->LogLine(_L("==== Exercise \"DEF\" subview")); |
|
471 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewDef,_L("d"),_L("g")); |
|
472 iLog->LogLine(_L("==== Exercise \"GHI\" subview")); |
|
473 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewGhi,_L("g"),_L("j")); |
|
474 iLog->LogLine(_L("==== Exercise \"JKL\" subview")); |
|
475 iViewExerciser->ExerciseSubViewL(CSortChecker::ELastNameFirstName,*iSubViewJkl,_L("j"),_L("m")); |
|
476 iLog->LogLine(_L("==== Exercise \"greater than M\" subview")); |
|
477 iViewExerciser->ExerciseHighSubViewL(CSortChecker::ELastNameFirstName,*iSubViewGreaterThanOrEqualToM,_L("m")); |
|
478 iLog->LogLine(_L("==== Exercise concatenated view of all the subviews")); |
|
479 iViewExerciser->ExerciseViewL(CSortChecker::ELastNameFirstName,*iConcatenatedView); |
|
480 NextTest(); |
|
481 break; |
|
482 case EAllViewsOutOfBoundsAccess: |
|
483 { |
|
484 //Views depend on their underlying views being in a good state, however |
|
485 //as some base views are potentially in other processes they must be resistant |
|
486 //to out of date views accessesing out of bound members, views, should not |
|
487 //panic but should leave with KErrNotFound; |
|
488 //local view |
|
489 TInt err=0; |
|
490 iLog->LogLine(_L("=== Test views for out of bounds access")); |
|
491 TInt outCount = iLocalView->CountL(); |
|
492 TRAP(err,iLocalView->AtL(outCount)); |
|
493 test(err==KErrNotFound); |
|
494 TRAP(err,iLocalView->ContactAtL(outCount)); |
|
495 test(err==KErrNotFound); |
|
496 //Remote View |
|
497 outCount = iRemoteView_1->CountL(); |
|
498 TRAP(err,iRemoteView_1->AtL(outCount)); |
|
499 test(err==KErrNotFound); |
|
500 TRAP(err,iRemoteView_1->ContactAtL(outCount)); |
|
501 test(err==KErrNotFound); |
|
502 //Sub View |
|
503 outCount = iSubViewAbc->CountL(); |
|
504 TRAP(err,iSubViewAbc->AtL(outCount)); |
|
505 test(err==KErrNotFound); |
|
506 TRAP(err,iSubViewAbc->ContactAtL(outCount)); |
|
507 test(err==KErrNotFound); |
|
508 //Sub View |
|
509 outCount = iConcatenatedView->CountL(); |
|
510 TRAP(err,iConcatenatedView->AtL(outCount)); |
|
511 test(err==KErrNotFound); |
|
512 TRAP(err,iConcatenatedView->ContactAtL(outCount)); |
|
513 test(err==KErrNotFound); |
|
514 //Local Find View View |
|
515 outCount = iLocalFindView->CountL(); |
|
516 TRAP(err,iLocalFindView->AtL(outCount)); |
|
517 test(err==KErrNotFound); |
|
518 TRAP(err,iLocalFindView->ContactAtL(outCount)); |
|
519 test(err==KErrNotFound); |
|
520 //Local Find View View |
|
521 outCount = iRemoteFindView->CountL(); |
|
522 TRAP(err,iRemoteFindView->AtL(outCount)); |
|
523 test(err==KErrNotFound); |
|
524 TRAP(err,iRemoteFindView->ContactAtL(outCount)); |
|
525 test(err==KErrNotFound); |
|
526 NextTest(); |
|
527 } |
|
528 break; |
|
529 case ECreateLocalViewWithUnsortableAtEnd: |
|
530 { |
|
531 iLog->LogLine(_L("=== Create local view with Unsortable Contacts at End")); |
|
532 iCurrentTestObject=iViewCreator; |
|
533 TInt32 viewPrefs=0; |
|
534 viewPrefs|=EUnSortedAtEnd; |
|
535 iLocalViewWithViewPreferences=iViewCreator->CreateLocalViewL(iSortOrder_1,TContactViewPreferences(viewPrefs)); |
|
536 } |
|
537 break; |
|
538 case EAddUnsortableContacts: |
|
539 { |
|
540 iLog->LogLine(_L("=== Add Contacts with no sortable fields only phone numbers")); |
|
541 iUnsortableAdder = CUnsortableContactAdder::NewL(*this,*iLocalViewWithViewPreferences); |
|
542 iCurrentTestObject=iUnsortableAdder;//will recieve notificaitons |
|
543 TInt32 viewPrefs=0; |
|
544 viewPrefs|=EUnSortedAtEnd; |
|
545 iUnsortableAdder->AddContactsL(KNumberOfUnsortableContacts,TContactViewPreferences(viewPrefs)); |
|
546 } |
|
547 break; |
|
548 case EExerciseLocalViewWithUnsortableAtEnd: |
|
549 { |
|
550 iLog->LogLine(_L("=== Exercies Views for view preferences")); |
|
551 ExerciseViewPreferencesL(iLocalViewWithViewPreferences,TContactViewPreferences(EUnSortedAtEnd)); |
|
552 ExerciseViewPreferencesL(iLocalView,TContactViewPreferences(EUnSortedAtBeginning)); |
|
553 ExerciseViewPreferencesL(iRemoteView_1,TContactViewPreferences(EUnSortedAtBeginning)); |
|
554 NextTest(); |
|
555 } |
|
556 break; |
|
557 case EAddFreshLocalView: |
|
558 { |
|
559 iLog->LogLine(_L("=== Create new view with Unsortable Contacts at End")); |
|
560 iCurrentTestObject=iViewCreator; |
|
561 TInt32 viewPrefs=0; |
|
562 viewPrefs|=EUnSortedAtEnd; |
|
563 viewPrefs|=ESingleWhiteSpaceIsEmptyField; |
|
564 iFreshLocalView=iViewCreator->CreateLocalViewL(iSortOrder_1,TContactViewPreferences(viewPrefs)); |
|
565 } |
|
566 break; |
|
567 case EExerciseFreshLocalView: |
|
568 { |
|
569 iLog->LogLine(_L("=== Exercies new view for view preferences")); |
|
570 ExerciseViewPreferencesL(iFreshLocalView,TContactViewPreferences(EUnSortedAtEnd)); |
|
571 NextTest(); |
|
572 } |
|
573 break; |
|
574 case EAddSomeMoreUnsortableContacts: |
|
575 { |
|
576 iLog->LogLine(_L("=== Add more Contacts with no sortable fields only phone numbers")); |
|
577 iCurrentTestObject=iUnsortableAdder;//will recieve notificaitons |
|
578 TInt32 viewPrefs=0; |
|
579 viewPrefs|=EUnSortedAtEnd;//doesn't matter if Atbegining either same for adder. |
|
580 iUnsortableAdder->AddContactsL(KNumberOfUnsortableContacts,TContactViewPreferences(viewPrefs)); |
|
581 } |
|
582 break; |
|
583 case EExerciseViewForPrefsAgain: |
|
584 { |
|
585 iLog->LogLine(_L("=== Exercies Views for view preferences again after updates")); |
|
586 ExerciseViewPreferencesL(iLocalViewWithViewPreferences,TContactViewPreferences(EUnSortedAtEnd)); |
|
587 ExerciseViewPreferencesL(iLocalView,TContactViewPreferences(EUnSortedAtBeginning)); |
|
588 ExerciseViewPreferencesL(iRemoteView_1,TContactViewPreferences(EUnSortedAtBeginning)); |
|
589 ExerciseViewPreferencesL(iFreshLocalView,TContactViewPreferences(EUnSortedAtEnd)); |
|
590 NextTest(); |
|
591 } |
|
592 break; |
|
593 case EAddWhiteSpaceContacts: |
|
594 { |
|
595 iLog->LogLine(_L("=== Add more Contacts with white space in some sort fields")); |
|
596 iCurrentTestObject=iUnsortableAdder;//will recieve notificaitons |
|
597 TInt32 viewPrefs=0; |
|
598 viewPrefs|=ESingleWhiteSpaceIsEmptyField;//doesn't matter if Atbegining either same for adder. |
|
599 iTestIds.Reset(); |
|
600 iUnsortableAdder->AddContactsL(KNumberOfUnsortableContacts,TContactViewPreferences(viewPrefs)); |
|
601 } |
|
602 break; |
|
603 case EExerciseWhiteSpaceContacts: |
|
604 { |
|
605 //iFreshLocalView |
|
606 ExerciseViewPreferencesL(iFreshLocalView,TContactViewPreferences(ESingleWhiteSpaceIsEmptyField)); |
|
607 NextTest(); |
|
608 } |
|
609 break; |
|
610 case ERemoveOwnCardContact: |
|
611 { |
|
612 iLog->LogLine(_L("=== Remove Own Card contact")); |
|
613 iCurrentTestObject=iOwnCardRemover; |
|
614 iOwnCardRemover->RemoveOwnCardL(*iFreshLocalView); |
|
615 } |
|
616 break; |
|
617 case (EModifyOwnCardContact): |
|
618 { |
|
619 NextTest(); |
|
620 break; |
|
621 /* |
|
622 iLog->LogLine(_L("=== Modify Own Card contact")); |
|
623 iCurrentTestObject=iOwnCardModifier; |
|
624 iOwnCardModifier->ModifyOwnCardL(*iFreshLocalView); |
|
625 break; |
|
626 */ |
|
627 } |
|
628 case ESearchForEuroChar: |
|
629 { |
|
630 iLog->LogLine(_L("=== Search for a Euro character")); |
|
631 _LIT(KFindString1,"\x20a0"); |
|
632 CPtrCArray* array =new(ELeave)CPtrC16Array(1); |
|
633 CleanupStack::PushL(array); |
|
634 array->AppendL(KFindString1()); |
|
635 RPointerArray<CViewContact> contactArray; |
|
636 CleanupStack::PushL(TCleanupItem(CleanupContactArray,&contactArray)); |
|
637 iRemoteView_1->ContactsMatchingCriteriaL(*array, contactArray); |
|
638 CleanupStack::PopAndDestroy(2, array); |
|
639 NextTest(); |
|
640 } |
|
641 break; |
|
642 case ENumTests: |
|
643 { |
|
644 RThread thread; |
|
645 test(thread.RequestCount()==0); |
|
646 CActiveScheduler::Stop(); |
|
647 } |
|
648 break; |
|
649 default: |
|
650 ASSERT(EFalse); |
|
651 break; |
|
652 } |
|
653 } |
|
654 |
|
655 void CTestConductor::HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
656 { |
|
657 if(&aView == iRemoteFindView) |
|
658 { |
|
659 return; |
|
660 } |
|
661 |
|
662 if(&aView == iLocalFindView) |
|
663 { |
|
664 return; |
|
665 } |
|
666 TRAPD(err, iCurrentTestObject->HandleNotificationL(aView,aEvent) ); |
|
667 test(err == KErrNone); |
|
668 } |
|
669 |
|
670 void CTestConductor::DoCancel() |
|
671 { |
|
672 } |
|
673 |
|
674 |
|
675 TInt CTestConductor::RunError(TInt aError) |
|
676 { |
|
677 iTestError = aError; |
|
678 |
|
679 // quick code to report the test step and leave error |
|
680 // allows test to exit nicely, rather than Panic |
|
681 switch (iCurrentTestNumber) |
|
682 { |
|
683 case ECreateLocalView: test.Printf(_L("RunL left in step CreateLocalView (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
684 case EAddInitialContacts: test.Printf(_L("RunL left in step AddInitialContacts (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
685 case EExerciseLocalView_1: test.Printf(_L("RunL left in step ExerciseLocalView_1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
686 case ECreateLocalNamedView: test.Printf(_L("RunL left in step CreateLocalNamedView (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
687 case EExerciseLocalNamedView_1: test.Printf(_L("RunL left in step ExerciseLocalNamedView_1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
688 case EAddMoreContacts_1: test.Printf(_L("RunL left in step AddMoreContacts_1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
689 case EExerciseLocalView_2: test.Printf(_L("RunL left in step ExerciseLocalView_2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
690 case EExerciseLocalNamedView_2: test.Printf(_L("RunL left in step ExerciseLocalNamedView_2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
691 case ECreateRemoteView1: test.Printf(_L("RunL left in step CreateRemoteView1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
692 case EExerciseRemoteView1: test.Printf(_L("RunL left in step ExerciseRemoteView1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
693 case ECreateRemoteView2: test.Printf(_L("RunL left in step CreateRemoteView2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
694 case EExerciseRemoteView2: test.Printf(_L("RunL left in step ExerciseRemoteView2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
695 case ECreateNamedRemoteView1: test.Printf(_L("RunL left in step CreateNamedRemoteView1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
696 case EExerciseNamedRemoteView1: test.Printf(_L("RunL left in step ExerciseNamedRemoteView1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
697 case ECreateNamedRemoteView2: test.Printf(_L("RunL left in step CreateNamedRemoteView2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
698 case EExerciseNamedRemoteView2: test.Printf(_L("RunL left in step ExerciseNamedRemoteView2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
699 case ECreateSubViewLessThanA: test.Printf(_L("RunL left in step CreateSubViewLessThanA (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
700 case EExerciseSubViewLessThanA: test.Printf(_L("RunL left in step ExerciseSubViewLessThanA (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
701 case ECreateSubViewAbc: test.Printf(_L("RunL left in step CreateSubViewAbc (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
702 case EExerciseSubViewAbc: test.Printf(_L("RunL left in step ExerciseSubViewAbc (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
703 case ECreateSubViewDef: test.Printf(_L("RunL left in step CreateSubViewDef (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
704 case EExerciseSubViewDef: test.Printf(_L("RunL left in step ExerciseSubViewDef (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
705 case ECreateSubViewGhi: test.Printf(_L("RunL left in step CreateSubViewGhi (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
706 case EExerciseSubViewGhi: test.Printf(_L("RunL left in step ExerciseSubViewGhi (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
707 case ECreateSubViewJkl: test.Printf(_L("RunL left in step CreateSubViewJkl (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
708 case EExerciseSubViewJkl: test.Printf(_L("RunL left in step ExerciseSubViewJkl (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
709 case ECreateSubViewGreaterThanOrEqualToM: test.Printf(_L("RunL left in step CreateSubViewGreaterThanOrEqualToM (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
710 case EExerciseSubViewGreaterThanOrEqualToM: test.Printf(_L("RunL left in step ExerciseSubViewGreaterThanOrEqualToM (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
711 case ECreateConcatenatedView: test.Printf(_L("RunL left in step CreateConcatenatedView (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
712 case EExerciseConcatenatedView: test.Printf(_L("RunL left in step ExerciseConcatenatedView (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
713 case EChangeSortOrder1: test.Printf(_L("RunL left in step ChangeSortOrder1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
714 case EChangeSortOrder2: test.Printf(_L("RunL left in step ChangeSortOrder2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
715 case EChangeSortOrder3: test.Printf(_L("RunL left in step ChangeSortOrder3 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
716 case EExerciseAllAffectedViews: test.Printf(_L("RunL left in step ExerciseAllAffectedViews (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
717 case EAddMoreContacts_2: test.Printf(_L("RunL left in step AddMoreContacts_2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
718 case EExerciseAllViews_1: test.Printf(_L("RunL left in step ExerciseAllViews_1 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
719 case ERemoveSomeContacts: test.Printf(_L("RunL left in step RemoveSomeContacts (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
720 case EExerciseAllViews_2: test.Printf(_L("RunL left in step ExerciseAllViews_2 (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
721 case EAllViewsOutOfBoundsAccess: test.Printf(_L("RunL left in step AllViewsOutOfBoundsAccess (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
722 case ECreateLocalViewWithUnsortableAtEnd: test.Printf(_L("RunL left in step CreateLocalViewWithUnsortableAtEnd (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
723 case EAddUnsortableContacts: test.Printf(_L("RunL left in step AddUnsortableContacts (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
724 case EExerciseLocalViewWithUnsortableAtEnd: test.Printf(_L("RunL left in step ExerciseLocalViewWithUnsortableAtEnd (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
725 case EAddFreshLocalView: test.Printf(_L("RunL left in step AddFreshLocalView (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
726 case EExerciseFreshLocalView: test.Printf(_L("RunL left in step ExerciseFreshLocalView (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
727 case EAddSomeMoreUnsortableContacts: test.Printf(_L("RunL left in step AddSomeMoreUnsortableContacts (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
728 case EExerciseViewForPrefsAgain: test.Printf(_L("RunL left in step ExerciseViewForPrefsAgain (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
729 case EAddWhiteSpaceContacts: test.Printf(_L("RunL left in step AddWhiteSpaceContacts (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
730 case EExerciseWhiteSpaceContacts: test.Printf(_L("RunL left in step ExerciseWhiteSpaceContacts (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
731 case ERemoveOwnCardContact: test.Printf(_L("RunL left in step RemoveOwnCardContact (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
732 case EModifyOwnCardContact: test.Printf(_L("RunL left in step ModifyOwnCardContact (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
733 case ESearchForEuroChar: test.Printf(_L("RunL left in step SearchForEuroChar (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
734 |
|
735 case ENumTests: test.Printf(_L("RunL left in step NumTests (%i) with error %i"), iCurrentTestNumber, aError); break; |
|
736 |
|
737 default: test.Printf(_L("RunL left in step %i with error %i"), iCurrentTestNumber, aError); break; |
|
738 } |
|
739 |
|
740 // stop test |
|
741 CActiveScheduler::Stop(); |
|
742 return KErrNone; |
|
743 } |
|
744 |
|
745 |
|
746 void CTestConductor::ExerciseViewPreferencesL(const CContactViewBase* aViewToTest,TContactViewPreferences aPrefsToTest) |
|
747 { |
|
748 //test the viewpreferences of a view. All views with EunsortedatBegining for example should place, any contact |
|
749 //without the field specified in a sort to the begining of the main sorted list of contact |
|
750 TInt normalContacts = aViewToTest->CountL()-iTestIds.Count(); |
|
751 test(normalContacts>0); |
|
752 TContactItemId id=KErrNotFound; |
|
753 TInt index =KErrNotFound; |
|
754 for(TInt ii=0;ii<iTestIds.Count();ii++) |
|
755 { |
|
756 index = aViewToTest->FindL(iTestIds[ii]); |
|
757 test(index>=0);//no error code |
|
758 if(aPrefsToTest&EUnSortedAtBeginning) |
|
759 { |
|
760 //should be before 'normal' contacts |
|
761 test(index<iTestIds.Count());//in the right place |
|
762 } |
|
763 else if(aPrefsToTest&EUnSortedAtEnd) |
|
764 { |
|
765 //should be after the last index of the 'normal' contacts |
|
766 test(index>=normalContacts);//in the right place |
|
767 } |
|
768 //Integrity check |
|
769 id=aViewToTest->AtL(index); |
|
770 const CViewContact& contact=aViewToTest->ContactAtL(index); |
|
771 test(contact.Id()==id); |
|
772 if(aPrefsToTest&ESingleWhiteSpaceIsEmptyField) |
|
773 { |
|
774 //Contact Fields Should not have any white space as a field, _L(" ") |
|
775 for(TInt zz=0;zz<contact.FieldCount();zz++) |
|
776 { |
|
777 TCollationMethod collateMethod = *Mem::CollationMethodByIndex(0); |
|
778 collateMethod.iFlags|=TCollationMethod::EIgnoreNone; |
|
779 test((contact.Field(zz).CompareC(KWhiteSpaces,3,&collateMethod))!=0); |
|
780 } |
|
781 } |
|
782 } |
|
783 } |
|
784 |
|
785 // |
|
786 // CSortChecker. |
|
787 // |
|
788 |
|
789 CSortChecker* CSortChecker::NewL(CTestConductor& aConductor) |
|
790 { |
|
791 CSortChecker* self=new(ELeave) CSortChecker(aConductor); |
|
792 CleanupStack::PushL(self); |
|
793 self->ConstructL(); |
|
794 CleanupStack::Pop(); // self. |
|
795 return self; |
|
796 } |
|
797 |
|
798 CSortChecker::CSortChecker(CTestConductor& aConductor) : iConductor(aConductor) |
|
799 { |
|
800 } |
|
801 |
|
802 void CSortChecker::ConstructL() |
|
803 { |
|
804 iCollateMethod=new(ELeave) TCollationMethod; |
|
805 *iCollateMethod=*Mem::CollationMethodByIndex(0); |
|
806 iCollateMethod->iFlags|=TCollationMethod::EIgnoreNone; |
|
807 } |
|
808 |
|
809 CSortChecker::~CSortChecker() |
|
810 { |
|
811 iSortedFirstLast.ResetAndDestroy(); |
|
812 iSortedLastFirst.ResetAndDestroy(); |
|
813 delete iCollateMethod; |
|
814 } |
|
815 |
|
816 void CSortChecker::AddContactL(const TDesC& aFirstName,const TDesC& aLastName) |
|
817 { |
|
818 HBufC* buf=HBufC::NewLC(aFirstName.Length()+aLastName.Length()+1); |
|
819 TPtr bufPtr(buf->Des()); |
|
820 bufPtr.Append(aFirstName); |
|
821 if (aFirstName.Length()) |
|
822 bufPtr.Append(_L(" ")); |
|
823 bufPtr.Append(aLastName); |
|
824 User::LeaveIfError(iSortedFirstLast.Append(buf)); |
|
825 CleanupStack::Pop(); // buf. |
|
826 |
|
827 buf=HBufC::NewLC(aFirstName.Length()+aLastName.Length()+1); |
|
828 TPtr bufPtr2(buf->Des()); |
|
829 bufPtr2.Append(aLastName); |
|
830 if (aLastName.Length()) |
|
831 bufPtr2.Append(_L(" ")); |
|
832 bufPtr2.Append(aFirstName); |
|
833 User::LeaveIfError(iSortedLastFirst.Append(buf)); |
|
834 CleanupStack::Pop(); // buf. |
|
835 } |
|
836 |
|
837 void CSortChecker::RemoveContactL(const TDesC& aFirstName,const TDesC& aLastName) |
|
838 { |
|
839 HBufC* buf=HBufC::NewLC(aFirstName.Length()+aLastName.Length()+1); |
|
840 TPtr bufPtr(buf->Des()); |
|
841 bufPtr.Append(aFirstName); |
|
842 if (aFirstName.Length()) |
|
843 bufPtr.Append(_L(" ")); |
|
844 bufPtr.Append(aLastName); |
|
845 TInt index=iSortedFirstLast.Find(buf,TIdentityRelation<HBufC>(Match)); |
|
846 ASSERT(index!=KErrNotFound); |
|
847 delete iSortedFirstLast[index]; |
|
848 iSortedFirstLast.Remove(index); |
|
849 CleanupStack::PopAndDestroy(); // buf. |
|
850 |
|
851 buf=HBufC::NewLC(aFirstName.Length()+aLastName.Length()+1); |
|
852 TPtr bufPtr2(buf->Des()); |
|
853 bufPtr2.Append(aLastName); |
|
854 if (aLastName.Length()) |
|
855 bufPtr2.Append(_L(" ")); |
|
856 bufPtr2.Append(aFirstName); |
|
857 index=iSortedLastFirst.Find(buf,TIdentityRelation<HBufC>(Match)); |
|
858 ASSERT(index!=KErrNotFound); |
|
859 delete iSortedLastFirst[index]; |
|
860 iSortedLastFirst.Remove(index); |
|
861 CleanupStack::PopAndDestroy(); // buf. |
|
862 } |
|
863 |
|
864 TBool CSortChecker::Match(const HBufC& aFirst,const HBufC& aSecond) |
|
865 { |
|
866 if (aFirst.Compare(aSecond)==0) |
|
867 { |
|
868 return ETrue; |
|
869 } |
|
870 return EFalse; |
|
871 } |
|
872 |
|
873 TPtrC CSortChecker::ContactAt(TSortOrder aOrder,TInt aIndex) const |
|
874 { |
|
875 const RPointerArray<HBufC>& sortedList=(aOrder==ELastNameFirstName) ? iSortedLastFirst : iSortedFirstLast; |
|
876 return TPtrC(*sortedList[aIndex]); |
|
877 } |
|
878 |
|
879 TInt CSortChecker::Count() const |
|
880 { |
|
881 return iSortedFirstLast.Count(); |
|
882 } |
|
883 |
|
884 TInt CSortChecker::Count(TSortOrder aOrder,const TDesC& aLowBoundary,const TDesC& aHighBoundary) const |
|
885 { |
|
886 const TInt low=FindIndex(aOrder,aLowBoundary,CSortChecker::EGreaterThanOrEqualTo); |
|
887 const TInt high=FindIndex(aOrder,aHighBoundary,CSortChecker::EGreaterThanOrEqualTo); |
|
888 if (low==KErrNotFound) |
|
889 { |
|
890 test(high==KErrNotFound); |
|
891 return 0; |
|
892 } |
|
893 return high-low; |
|
894 } |
|
895 |
|
896 TInt CSortChecker::CountLow(TSortOrder aOrder,const TDesC& aHighBoundary) const |
|
897 { |
|
898 const TInt high=FindIndex(aOrder,aHighBoundary,CSortChecker::EGreaterThanOrEqualTo); |
|
899 if (high==KErrNotFound) |
|
900 { |
|
901 return 0; |
|
902 } |
|
903 return high; |
|
904 } |
|
905 |
|
906 TInt CSortChecker::CountHigh(TSortOrder aOrder,const TDesC& aLowBoundary) const |
|
907 { |
|
908 const TInt low=FindIndex(aOrder,aLowBoundary,CSortChecker::EGreaterThanOrEqualTo); |
|
909 if (low==KErrNotFound) |
|
910 { |
|
911 return 0; |
|
912 } |
|
913 return Count()-low; |
|
914 } |
|
915 |
|
916 void CSortChecker::Sort() |
|
917 { |
|
918 iSortedFirstLast.Sort(TLinearOrder<HBufC>(CompareWithoutIgnoringSpacesL)); |
|
919 iSortedLastFirst.Sort(TLinearOrder<HBufC>(CompareWithoutIgnoringSpacesL)); |
|
920 |
|
921 const TInt numContacts=iSortedFirstLast.Count(); |
|
922 __ASSERT_ALWAYS(numContacts==iSortedLastFirst.Count(),User::Invariant()); |
|
923 } |
|
924 |
|
925 void CSortChecker::CheckSort(TSortOrder aOrder,const TDesC& aName,TInt aIndex) const |
|
926 { |
|
927 const RPointerArray<HBufC>& sortedList=(aOrder==ELastNameFirstName) ? iSortedLastFirst : iSortedFirstLast; |
|
928 #ifdef VERBOSE_LOGGING |
|
929 iConductor.iLog->LogLineNoEcho(_L("Checking - %S against %S"),&aName,sortedList[aIndex]); |
|
930 #endif |
|
931 test(sortedList[aIndex]->Compare(aName)==0); |
|
932 } |
|
933 |
|
934 void CSortChecker::CheckSortLowSubView(TSortOrder aOrder,const TDesC& aName,TInt aIndex,const TDesC& aHighBoundary) const |
|
935 { |
|
936 const RPointerArray<HBufC>& sortedList=(aOrder==ELastNameFirstName) ? iSortedLastFirst : iSortedFirstLast; |
|
937 const HBufC* name=sortedList[aIndex]; |
|
938 #ifdef VERBOSE_LOGGING |
|
939 iConductor.iLog->LogLineNoEcho(_L("Checking - %S against %S"),&aName,name); |
|
940 #endif |
|
941 test(name->CompareC(aHighBoundary,3,iCollateMethod)<0); |
|
942 test(name->Compare(aName)==0); |
|
943 } |
|
944 |
|
945 void CSortChecker::CheckSortHighSubView(TSortOrder aOrder,const TDesC& aName,TInt aIndex,const TDesC& aLowBoundary) const |
|
946 { |
|
947 const RPointerArray<HBufC>& sortedList=(aOrder==ELastNameFirstName) ? iSortedLastFirst : iSortedFirstLast; |
|
948 const TInt lowIndex=FindIndex(aOrder,aLowBoundary,CSortChecker::EGreaterThanOrEqualTo); |
|
949 if (lowIndex!=KErrNotFound) |
|
950 { |
|
951 #ifdef VERBOSE_LOGGING |
|
952 iConductor.iLog->LogLineNoEcho(_L("Checking - %S against %S"),&aName,sortedList[lowIndex+aIndex]); |
|
953 #endif |
|
954 test(sortedList[lowIndex+aIndex]->Compare(aName)==0); |
|
955 } |
|
956 } |
|
957 |
|
958 void CSortChecker::CheckSortSubView(TSortOrder aOrder,const TDesC& aName,TInt aIndex,const TDesC& aLowBoundary,const TDesC& aHighBoundary) const |
|
959 { |
|
960 const RPointerArray<HBufC>& sortedList=(aOrder==ELastNameFirstName) ? iSortedLastFirst : iSortedFirstLast; |
|
961 const TInt lowIndex=FindIndex(aOrder,aLowBoundary,CSortChecker::EGreaterThanOrEqualTo); |
|
962 if (lowIndex!=KErrNotFound) |
|
963 { |
|
964 const HBufC* name=sortedList[lowIndex+aIndex]; |
|
965 #ifdef VERBOSE_LOGGING |
|
966 iConductor.iLog->LogLineNoEcho(_L("Checking - %S against %S"),&aName,name); |
|
967 #endif |
|
968 test(name->CompareC(aHighBoundary,3,iCollateMethod)<0); |
|
969 test(name->Compare(aName)==0); |
|
970 } |
|
971 } |
|
972 |
|
973 TInt CSortChecker::FindIndex(TSortOrder aOrder,const TDesC& aBoundary,TCriteria aCriteria) const |
|
974 { |
|
975 const RPointerArray<HBufC>& sortedList=(aOrder==ELastNameFirstName) ? iSortedLastFirst : iSortedFirstLast; |
|
976 const TInt numContacts=sortedList.Count(); |
|
977 for (TInt ii=0;ii<numContacts;++ii) |
|
978 { |
|
979 switch (aCriteria) |
|
980 { |
|
981 case ELessThan: |
|
982 if (sortedList[ii]->CompareC(aBoundary,3,iCollateMethod)<0) |
|
983 { |
|
984 return ii; |
|
985 } |
|
986 break; |
|
987 case ELessThanOrEqualTo: |
|
988 if (sortedList[ii]->CompareC(aBoundary,3,iCollateMethod)<=0) |
|
989 { |
|
990 return ii; |
|
991 } |
|
992 break; |
|
993 case EGreaterThan: |
|
994 if (sortedList[ii]->CompareC(aBoundary,3,iCollateMethod)>0) |
|
995 { |
|
996 return ii; |
|
997 } |
|
998 break; |
|
999 case EGreaterThanOrEqualTo: |
|
1000 if (sortedList[ii]->CompareC(aBoundary,3,iCollateMethod)>=0) |
|
1001 { |
|
1002 return ii; |
|
1003 } |
|
1004 break; |
|
1005 default: |
|
1006 ASSERT(EFalse); |
|
1007 } |
|
1008 } |
|
1009 return KErrNotFound; |
|
1010 } |
|
1011 |
|
1012 TInt CSortChecker::Compare(const HBufC& aFirst, const HBufC& aSecond) |
|
1013 { |
|
1014 return aFirst.CompareC(aSecond); |
|
1015 } |
|
1016 |
|
1017 TInt CSortChecker::CompareWithoutIgnoringSpacesL(const HBufC& aFirst, const HBufC& aSecond) |
|
1018 { |
|
1019 // In order to sort correctly, we need to recognise spaces, but ignore other punctuation |
|
1020 HBufC* temp1=HBufC::NewLC(aFirst.Length()); |
|
1021 TPtr first(temp1->Des()); |
|
1022 first.Copy(aFirst); |
|
1023 HBufC* temp2=HBufC::NewLC(aSecond.Length()); |
|
1024 TPtr second(temp2->Des()); |
|
1025 second.Copy(aSecond); |
|
1026 |
|
1027 TCollationMethod collateMethod; |
|
1028 collateMethod = *Mem::CollationMethodByIndex(0); |
|
1029 collateMethod.iFlags|=TCollationMethod::EIgnoreNone; |
|
1030 TInt compare=0; |
|
1031 TInt collationLevel=0; |
|
1032 |
|
1033 while (!compare && collationLevel<4) |
|
1034 { |
|
1035 compare=first.CompareC(second,collationLevel,&collateMethod); |
|
1036 ++collationLevel; |
|
1037 } |
|
1038 |
|
1039 CleanupStack::PopAndDestroy(2); |
|
1040 return compare; |
|
1041 } |
|
1042 |
|
1043 // |
|
1044 // CTestBase. |
|
1045 // |
|
1046 |
|
1047 CTestBase::CTestBase(CTestConductor& aConductor) : iConductor(aConductor) |
|
1048 { |
|
1049 } |
|
1050 |
|
1051 |
|
1052 // |
|
1053 // CViewCreator. |
|
1054 // |
|
1055 |
|
1056 CViewCreator* CViewCreator::NewL(CTestConductor& aConductor) |
|
1057 { |
|
1058 CViewCreator* self=new(ELeave) CViewCreator(aConductor); |
|
1059 return self; |
|
1060 } |
|
1061 |
|
1062 CContactLocalView* CViewCreator::CreateLocalViewL(const RContactViewSortOrder& aSortOrder,TContactViewPreferences aViewPrefs) |
|
1063 { |
|
1064 iView=CContactLocalView::NewL(iConductor,*iConductor.iDb,aSortOrder,aViewPrefs); |
|
1065 return STATIC_CAST(CContactLocalView*,iView); |
|
1066 } |
|
1067 |
|
1068 CContactLocalView* CViewCreator::CreateLocalViewL(const RContactViewSortOrder& aSortOrder) |
|
1069 { |
|
1070 TInt32 viewPrefs=0; |
|
1071 viewPrefs|=EUnSortedAtBeginning; |
|
1072 iView=CContactLocalView::NewL(iConductor,*iConductor.iDb,aSortOrder,TContactViewPreferences(viewPrefs)); |
|
1073 return STATIC_CAST(CContactLocalView*,iView); |
|
1074 } |
|
1075 |
|
1076 CContactNamedLocalView* CViewCreator::CreateNamedLocalViewL(const TDesC& aName,const RContactViewSortOrder& aSortOrder) |
|
1077 { |
|
1078 TInt32 viewPrefs=0; |
|
1079 viewPrefs|=EUnSortedAtBeginning; |
|
1080 iView=CContactNamedLocalView::NewL(iConductor,aName,*iConductor.iDb,aSortOrder,TContactViewPreferences(viewPrefs)); |
|
1081 return STATIC_CAST(CContactNamedLocalView*,iView); |
|
1082 } |
|
1083 |
|
1084 CContactRemoteView* CViewCreator::CreateRemoteViewL(const RContactViewSortOrder& aSortOrder) |
|
1085 { |
|
1086 TInt32 viewPrefs=0; |
|
1087 viewPrefs|=EUnSortedAtBeginning; |
|
1088 iView=CContactRemoteView::NewL(iConductor,*iConductor.iDb,aSortOrder,TContactViewPreferences(viewPrefs)); |
|
1089 return STATIC_CAST(CContactRemoteView*,iView); |
|
1090 } |
|
1091 |
|
1092 CContactNamedRemoteView* CViewCreator::CreateNamedRemoteViewL(const TDesC& aName,const RContactViewSortOrder& aSortOrder) |
|
1093 { |
|
1094 TInt32 viewPrefs=0; |
|
1095 viewPrefs|=EUnSortedAtBeginning; |
|
1096 iView=CContactNamedRemoteView::NewL(iConductor,aName,*iConductor.iDb,aSortOrder,TContactViewPreferences(viewPrefs)); |
|
1097 return STATIC_CAST(CContactNamedRemoteView*,iView); |
|
1098 } |
|
1099 |
|
1100 CContactSubView* CViewCreator::CreateSubViewL(CContactViewBase& aUnderlyingView,const TDesC& aBoundary) |
|
1101 { |
|
1102 iView=CContactSubView::NewL(iConductor,*iConductor.iDb,aUnderlyingView,aBoundary); |
|
1103 return STATIC_CAST(CContactSubView*,iView); |
|
1104 } |
|
1105 |
|
1106 CContactSubView* CViewCreator::CreateSubViewL(CContactViewBase& aUnderlyingView,const TDesC& aLowBoundary,const TDesC& aHighBoundary) |
|
1107 { |
|
1108 iView=CContactSubView::NewL(iConductor,*iConductor.iDb,aUnderlyingView,aLowBoundary,aHighBoundary); |
|
1109 return STATIC_CAST(CContactSubView*,iView); |
|
1110 } |
|
1111 |
|
1112 CContactConcatenatedView* CViewCreator::CreateConcatenatedViewL(RPointerArray<CContactViewBase>& aComponentViews) |
|
1113 { |
|
1114 iView=CContactConcatenatedView::NewL(iConductor,*iConductor.iDb,aComponentViews); |
|
1115 return STATIC_CAST(CContactConcatenatedView*,iView); |
|
1116 } |
|
1117 |
|
1118 void CViewCreator::HandleNotificationL(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
1119 { |
|
1120 if(&aView==iView) |
|
1121 { |
|
1122 test(aEvent.iEventType==TContactViewEvent::EReady); |
|
1123 iConductor.NextTest(); |
|
1124 } |
|
1125 } |
|
1126 |
|
1127 CViewCreator::CViewCreator(CTestConductor& aConductor) : CTestBase(aConductor) |
|
1128 { |
|
1129 } |
|
1130 |
|
1131 |
|
1132 // |
|
1133 // CContactAdder. |
|
1134 // |
|
1135 |
|
1136 CContactAdder* CContactAdder::NewL(CTestConductor& aConductor) |
|
1137 { |
|
1138 CContactAdder* self=new(ELeave) CContactAdder(aConductor); |
|
1139 CleanupStack::PushL(self); |
|
1140 self->ConstructL(); |
|
1141 CleanupStack::Pop(); // self. |
|
1142 return self; |
|
1143 } |
|
1144 |
|
1145 CContactAdder::~CContactAdder() |
|
1146 { |
|
1147 delete iTemplate; |
|
1148 iFile.Close(); |
|
1149 iFs.Close(); |
|
1150 } |
|
1151 |
|
1152 void CContactAdder::AddContactsL(const TDesC& aFileName,TInt aNumViews) |
|
1153 { |
|
1154 TInt err = iFile.Open(iFs,aFileName,EFileShareAny|EFileStreamText); |
|
1155 if (err == KErrNotFound) |
|
1156 { |
|
1157 test.Printf(_L("Contact test data file (\"%S\") is missing from build, ensure exports are built."), &aFileName); |
|
1158 } |
|
1159 User::LeaveIfError(err); |
|
1160 iNumViews=aNumViews; |
|
1161 TInt pos=2; |
|
1162 iFile.Seek(ESeekStart,pos); // Ignore Unicode header. |
|
1163 test.Printf(_L("Adding contact ")); |
|
1164 AddOneContactL(); |
|
1165 } |
|
1166 |
|
1167 void CContactAdder::HandleNotificationL(const CContactViewBase&,const TContactViewEvent& aEvent) |
|
1168 { |
|
1169 if (++iNumNotifications==iNumViews) |
|
1170 { |
|
1171 if (iFinished) |
|
1172 { |
|
1173 iConductor.NextTest(); |
|
1174 } |
|
1175 else |
|
1176 { |
|
1177 AddOneContactL(); |
|
1178 } |
|
1179 } |
|
1180 else |
|
1181 { |
|
1182 test(aEvent.iEventType==TContactViewEvent::EItemAdded); |
|
1183 } |
|
1184 } |
|
1185 |
|
1186 CContactAdder::CContactAdder(CTestConductor& aConductor) : CTestBase(aConductor) |
|
1187 { |
|
1188 } |
|
1189 |
|
1190 void CContactAdder::ConstructL() |
|
1191 { |
|
1192 User::LeaveIfError(iFs.Connect()); |
|
1193 iTemplate=STATIC_CAST(CContactTemplate*,iConductor.iDb->ReadContactL(iConductor.iDb->TemplateId())); |
|
1194 } |
|
1195 |
|
1196 void CContactAdder::AddOneContactL() |
|
1197 { |
|
1198 iNumNotifications=0; |
|
1199 TBuf<64> firstName; |
|
1200 TBuf<64> lastName; |
|
1201 iConductor.iLog->IncVisualCounter(); |
|
1202 iFinished=!ReadNamePairL(iFile,firstName,lastName); |
|
1203 #ifdef VERBOSE_LOGGING |
|
1204 iConductor.iLog->LogLineNoEcho(_L("Adding %S %S"),&firstName,&lastName); |
|
1205 #endif |
|
1206 CTestContact* contact=CTestContact::NewLC(*iTemplate); |
|
1207 contact->SetFirstNameL(firstName); |
|
1208 contact->SetLastNameL(lastName); |
|
1209 iConductor.iDb->AddNewContactL(contact->ContactItem()); |
|
1210 CleanupStack::PopAndDestroy(); // contact. |
|
1211 iConductor.iDb->CompactL(); |
|
1212 iConductor.iSortChecker->AddContactL(firstName,lastName); |
|
1213 if (iFinished) |
|
1214 { |
|
1215 iConductor.iLog->EndVisualCounter(); |
|
1216 iConductor.iSortChecker->Sort(); |
|
1217 } |
|
1218 } |
|
1219 |
|
1220 TBool CContactAdder::ReadNamePairL(RFile aFile,TDes& aFirstName,TDes& aLastName) |
|
1221 { |
|
1222 TBuf8<2> character=_L8(" "); |
|
1223 TBuf8<4> lineEndTestBuf=_L8(" "); |
|
1224 |
|
1225 aFirstName.SetLength(0); |
|
1226 aLastName.SetLength(0); |
|
1227 TBool readingLastName=ETrue; |
|
1228 while (lineEndTestBuf!=KUnicodeLineEnd) |
|
1229 { |
|
1230 User::LeaveIfError(aFile.Read(character,2)); |
|
1231 if (character.Length()>0) |
|
1232 { |
|
1233 lineEndTestBuf[0]=lineEndTestBuf[2]; |
|
1234 lineEndTestBuf[1]=lineEndTestBuf[3]; |
|
1235 lineEndTestBuf[2]=character[0]; |
|
1236 lineEndTestBuf[3]=character[1]; |
|
1237 |
|
1238 const TPtrC16 widePtr((TUint16*)character.Ptr(),1); |
|
1239 if (widePtr[0]==';') |
|
1240 { |
|
1241 readingLastName=EFalse; |
|
1242 } |
|
1243 else if (readingLastName) |
|
1244 { |
|
1245 aLastName.Append(widePtr); |
|
1246 } |
|
1247 else |
|
1248 { |
|
1249 aFirstName.Append(widePtr); |
|
1250 } |
|
1251 } |
|
1252 else |
|
1253 { |
|
1254 return EFalse; |
|
1255 } |
|
1256 } |
|
1257 |
|
1258 aFirstName.Delete(aFirstName.Length()-2,2); // Strip off \n\r. |
|
1259 return ETrue; |
|
1260 } |
|
1261 |
|
1262 |
|
1263 // |
|
1264 // CContactRemover. |
|
1265 // |
|
1266 |
|
1267 CContactRemover* CContactRemover::NewL(CTestConductor& aConductor) |
|
1268 { |
|
1269 CContactRemover* self=new(ELeave) CContactRemover(aConductor); |
|
1270 CleanupStack::PushL(self); |
|
1271 self->ConstructL(); |
|
1272 CleanupStack::Pop(); // self. |
|
1273 return self; |
|
1274 } |
|
1275 |
|
1276 CContactRemover::~CContactRemover() |
|
1277 { |
|
1278 iFile.Close(); |
|
1279 iFs.Close(); |
|
1280 } |
|
1281 |
|
1282 void CContactRemover::RemoveContactsL(const TDesC& aFileName,TInt aNumViews) |
|
1283 { |
|
1284 User::LeaveIfError(iFile.Open(iFs,aFileName,EFileShareAny|EFileStreamText)); |
|
1285 iNumViews=aNumViews; |
|
1286 TInt pos=2; |
|
1287 iFile.Seek(ESeekStart,pos); // Ignore Unicode header. |
|
1288 test.Printf(_L("Removing contact ")); |
|
1289 RemoveOneContactL(); |
|
1290 } |
|
1291 |
|
1292 void CContactRemover::HandleNotificationL(const CContactViewBase&,const TContactViewEvent& aEvent) |
|
1293 { |
|
1294 if (++iNumNotifications==iNumViews) |
|
1295 { |
|
1296 if (iFinished) |
|
1297 { |
|
1298 iConductor.NextTest(); |
|
1299 } |
|
1300 else |
|
1301 { |
|
1302 RemoveOneContactL(); |
|
1303 } |
|
1304 } |
|
1305 else |
|
1306 { |
|
1307 test(aEvent.iEventType==TContactViewEvent::EItemRemoved); |
|
1308 } |
|
1309 } |
|
1310 |
|
1311 CContactRemover::CContactRemover(CTestConductor& aConductor) : CTestBase(aConductor) |
|
1312 { |
|
1313 } |
|
1314 |
|
1315 void CContactRemover::ConstructL() |
|
1316 { |
|
1317 User::LeaveIfError(iFs.Connect()); |
|
1318 } |
|
1319 |
|
1320 void CContactRemover::RemoveOneContactL() |
|
1321 { |
|
1322 iNumNotifications=0; |
|
1323 TBuf<64> firstName; |
|
1324 TBuf<64> lastName; |
|
1325 iConductor.iLog->IncVisualCounter(); |
|
1326 iFinished=!CContactAdder::ReadNamePairL(iFile,firstName,lastName); |
|
1327 #ifdef VERBOSE_LOGGING |
|
1328 iConductor.iLog->LogLineNoEcho(_L("Removing %S %S"),&firstName,&lastName); |
|
1329 #endif |
|
1330 CContactItemFieldDef* def=new(ELeave) CContactItemFieldDef(); |
|
1331 CleanupStack::PushL(def); |
|
1332 def->AppendL(KUidContactFieldGivenName); |
|
1333 def->AppendL(KUidContactFieldFamilyName); |
|
1334 CContactIdArray* matchList1=iConductor.iDb->FindLC(lastName,def); |
|
1335 CContactIdArray* matchList2=iConductor.iDb->FindLC(firstName,def); |
|
1336 |
|
1337 for (TInt ii=matchList1->Count()-1;ii>=0;--ii) |
|
1338 { |
|
1339 TContactItemId thisId=(*matchList1)[ii]; |
|
1340 for (TInt jj=matchList2->Count()-1;jj>=0;--jj) |
|
1341 { |
|
1342 if (thisId==(*matchList2)[jj]) |
|
1343 { |
|
1344 iConductor.iDb->DeleteContactL(thisId); |
|
1345 goto carry_on; |
|
1346 } |
|
1347 } |
|
1348 } |
|
1349 ASSERT(EFalse); |
|
1350 |
|
1351 carry_on: |
|
1352 CleanupStack::PopAndDestroy(3); // matchList2, matchList1, def. |
|
1353 iConductor.iDb->CompactL(); |
|
1354 iConductor.iSortChecker->RemoveContactL(firstName,lastName); |
|
1355 if (iFinished) |
|
1356 { |
|
1357 iConductor.iLog->EndVisualCounter(); |
|
1358 iConductor.iSortChecker->Sort(); |
|
1359 } |
|
1360 } |
|
1361 |
|
1362 |
|
1363 // |
|
1364 // CViewExerciser. |
|
1365 // |
|
1366 |
|
1367 CViewExerciser* CViewExerciser::NewL(CTestConductor& aConductor) |
|
1368 { |
|
1369 CViewExerciser* self=new(ELeave) CViewExerciser(aConductor); |
|
1370 CleanupStack::PushL(self); |
|
1371 self->ConstructL(); |
|
1372 CleanupStack::Pop(); // self. |
|
1373 return self; |
|
1374 } |
|
1375 |
|
1376 void CViewExerciser::ProfileViewL(CContactViewBase& aView) |
|
1377 { |
|
1378 TInt viewCount = aView.CountL(); |
|
1379 RDebug::Print(_L("Profile view Count: %d"),viewCount); |
|
1380 CCntTest::ProfileReset(0,1); |
|
1381 CCntTest::ProfileStart(0); |
|
1382 for (TInt ii=0;ii<viewCount;++ii) |
|
1383 { |
|
1384 aView.ContactAtL(ii); |
|
1385 } |
|
1386 CCntTest::ProfileEnd(0); |
|
1387 TCntProfile profile[1]; |
|
1388 CCntTest::ProfileResult(profile,0,1); |
|
1389 TReal result = profile[0].iTime;//1000000.0; |
|
1390 RDebug::Print(_L("Profile ContactAt Time Taken: %g"),result); |
|
1391 } |
|
1392 |
|
1393 void CViewExerciser::ExerciseViewL(CSortChecker::TSortOrder aSortOrder,CContactViewBase& aView) |
|
1394 { |
|
1395 TBuf<128> scratchBuf; |
|
1396 TContactItemId lastId=0; |
|
1397 const TInt numItems=aView.CountL(); |
|
1398 test(iConductor.iSortChecker->Count()==numItems); |
|
1399 |
|
1400 for (TInt ii=0;ii<numItems;++ii) |
|
1401 { |
|
1402 TContactItemId thisId=aView.AtL(ii); |
|
1403 if (ii==numItems-1) |
|
1404 { |
|
1405 lastId=thisId; |
|
1406 } |
|
1407 |
|
1408 GetComparisonStringL(thisId,aSortOrder,scratchBuf); |
|
1409 iConductor.iSortChecker->CheckSort(aSortOrder,scratchBuf,ii); |
|
1410 scratchBuf.SetLength(0); |
|
1411 } |
|
1412 |
|
1413 test(aView.FindL(lastId)==numItems-1); |
|
1414 |
|
1415 if (iQueue) |
|
1416 { |
|
1417 iConductor.NextTest(); |
|
1418 } |
|
1419 } |
|
1420 |
|
1421 void CViewExerciser::ExerciseSubViewL(CSortChecker::TSortOrder aSortOrder,CContactViewBase& aView,const TDesC& aLowBoundary,const TDesC& aHighBoundary) |
|
1422 { |
|
1423 TBuf<128> scratchBuf; |
|
1424 TContactItemId lastId=0; |
|
1425 const TInt numItems=aView.CountL(); |
|
1426 test(iConductor.iSortChecker->Count(aSortOrder,aLowBoundary,aHighBoundary)==numItems); |
|
1427 |
|
1428 for (TInt ii=0;ii<numItems;++ii) |
|
1429 { |
|
1430 TContactItemId thisId=aView.AtL(ii); |
|
1431 if (ii==numItems-1) |
|
1432 { |
|
1433 lastId=thisId; |
|
1434 } |
|
1435 GetComparisonStringL(thisId,aSortOrder,scratchBuf); |
|
1436 iConductor.iSortChecker->CheckSortSubView(aSortOrder,scratchBuf,ii,aLowBoundary,aHighBoundary); |
|
1437 scratchBuf.SetLength(0); |
|
1438 } |
|
1439 |
|
1440 test(aView.FindL(lastId)==numItems-1); |
|
1441 |
|
1442 if (iQueue) |
|
1443 { |
|
1444 iConductor.NextTest(); |
|
1445 } |
|
1446 } |
|
1447 |
|
1448 void CViewExerciser::ExerciseLowSubViewL(CSortChecker::TSortOrder aSortOrder,CContactViewBase& aView,const TDesC& aLowBoundary) |
|
1449 { |
|
1450 TBuf<128> scratchBuf; |
|
1451 TContactItemId lastId=0; |
|
1452 const TInt numItems=aView.CountL(); |
|
1453 test(iConductor.iSortChecker->CountLow(aSortOrder,aLowBoundary)==numItems); |
|
1454 |
|
1455 for (TInt ii=0;ii<numItems;++ii) |
|
1456 { |
|
1457 TContactItemId thisId=aView.AtL(ii); |
|
1458 if (ii==numItems-1) |
|
1459 { |
|
1460 lastId=thisId; |
|
1461 } |
|
1462 GetComparisonStringL(thisId,aSortOrder,scratchBuf); |
|
1463 iConductor.iSortChecker->CheckSortLowSubView(aSortOrder,scratchBuf,ii,aLowBoundary); |
|
1464 scratchBuf.SetLength(0); |
|
1465 } |
|
1466 |
|
1467 test(aView.FindL(lastId)==numItems-1); |
|
1468 |
|
1469 if (iQueue) |
|
1470 { |
|
1471 iConductor.NextTest(); |
|
1472 } |
|
1473 } |
|
1474 |
|
1475 void CViewExerciser::ExerciseHighSubViewL(CSortChecker::TSortOrder aSortOrder,CContactViewBase& aView,const TDesC& aHighBoundary) |
|
1476 { |
|
1477 TBuf<128> scratchBuf; |
|
1478 TContactItemId lastId=0; |
|
1479 const TInt numItems=aView.CountL(); |
|
1480 test(iConductor.iSortChecker->CountHigh(aSortOrder,aHighBoundary)==numItems); |
|
1481 |
|
1482 for (TInt ii=0;ii<numItems;++ii) |
|
1483 { |
|
1484 TContactItemId thisId=aView.AtL(ii); |
|
1485 if (ii==numItems-1) |
|
1486 { |
|
1487 lastId=thisId; |
|
1488 } |
|
1489 GetComparisonStringL(thisId,aSortOrder,scratchBuf); |
|
1490 iConductor.iSortChecker->CheckSortHighSubView(aSortOrder,scratchBuf,ii,aHighBoundary); |
|
1491 scratchBuf.SetLength(0); |
|
1492 } |
|
1493 |
|
1494 test(aView.FindL(lastId)==numItems-1); |
|
1495 |
|
1496 if (iQueue) |
|
1497 { |
|
1498 iConductor.NextTest(); |
|
1499 } |
|
1500 } |
|
1501 |
|
1502 CViewExerciser::~CViewExerciser() |
|
1503 { |
|
1504 delete iTextDef_FirstLast; |
|
1505 delete iTextDef_LastFirst; |
|
1506 } |
|
1507 |
|
1508 void CViewExerciser::HandleNotificationL(const CContactViewBase&,const TContactViewEvent&) |
|
1509 { |
|
1510 test(EFalse); |
|
1511 } |
|
1512 |
|
1513 void CViewExerciser::GetComparisonStringL(const TContactItemId aContactId, const CSortChecker::TSortOrder aSortOrder, TDes& aContactInfo) |
|
1514 { |
|
1515 TBuf<64> first; |
|
1516 TBuf<64> last; |
|
1517 |
|
1518 CContactItem* contact=iConductor.iDb->ReadMinimalContactLC(aContactId); |
|
1519 |
|
1520 CContactItemFieldSet& fieldSet=contact->CardFields(); |
|
1521 TInt pos=fieldSet.Find(KUidContactFieldGivenName); |
|
1522 if (pos!=KErrNotFound) |
|
1523 first.Append(fieldSet[pos].TextStorage()->Text()); |
|
1524 pos=fieldSet.Find(KUidContactFieldFamilyName); |
|
1525 if (pos!=KErrNotFound) |
|
1526 last.Append(fieldSet[pos].TextStorage()->Text()); |
|
1527 CleanupStack::PopAndDestroy(contact); |
|
1528 |
|
1529 if (aSortOrder==CSortChecker::EFirstNameLastName) |
|
1530 { |
|
1531 aContactInfo.Append(first); |
|
1532 if (first.Length()) |
|
1533 aContactInfo.Append(_L(" ")); |
|
1534 aContactInfo.Append(last); |
|
1535 } |
|
1536 else |
|
1537 { |
|
1538 aContactInfo.Append(last); |
|
1539 if (last.Length()) |
|
1540 aContactInfo.Append(_L(" ")); |
|
1541 aContactInfo.Append(first); |
|
1542 } |
|
1543 } |
|
1544 |
|
1545 CViewExerciser::CViewExerciser(CTestConductor& aConductor) : CTestBase(aConductor),iQueue(ETrue) |
|
1546 { |
|
1547 } |
|
1548 |
|
1549 void CViewExerciser::ConstructL() |
|
1550 { |
|
1551 iTextDef_FirstLast=CContactTextDef::NewL(); |
|
1552 iTextDef_FirstLast->AppendL(TContactTextDefItem(KUidContactFieldGivenName,KTextDefSeparator)); |
|
1553 iTextDef_FirstLast->AppendL(TContactTextDefItem(KUidContactFieldFamilyName,KTextDefSeparator)); |
|
1554 iTextDef_FirstLast->AppendL(TContactTextDefItem(KUidContactFieldCompanyName,KTextDefSeparator)); |
|
1555 |
|
1556 iTextDef_LastFirst=CContactTextDef::NewL(); |
|
1557 iTextDef_LastFirst->AppendL(TContactTextDefItem(KUidContactFieldFamilyName,KTextDefSeparator)); |
|
1558 iTextDef_LastFirst->AppendL(TContactTextDefItem(KUidContactFieldGivenName,KTextDefSeparator)); |
|
1559 iTextDef_LastFirst->AppendL(TContactTextDefItem(KUidContactFieldCompanyName,KTextDefSeparator)); |
|
1560 } |
|
1561 |
|
1562 void CViewExerciser::QueueNextTestWhenComplete(TBool aQueue) |
|
1563 { |
|
1564 iQueue=aQueue; |
|
1565 } |
|
1566 |
|
1567 |
|
1568 // |
|
1569 // CSortOrderChanger. |
|
1570 // |
|
1571 |
|
1572 CSortOrderChanger* CSortOrderChanger::NewL(CTestConductor& aConductor) |
|
1573 { |
|
1574 CSortOrderChanger* self=new(ELeave) CSortOrderChanger(aConductor); |
|
1575 return self; |
|
1576 } |
|
1577 |
|
1578 void CSortOrderChanger::ChangeSortOrderL(RContactViewSortOrder& aSortOrder,CContactNamedLocalView& aView,TInt aNumViews) |
|
1579 { |
|
1580 aView.ChangeSortOrderL(aSortOrder); |
|
1581 iNumViews=aNumViews; |
|
1582 iNumNotifications=0; |
|
1583 } |
|
1584 |
|
1585 void CSortOrderChanger::ChangeSortOrderL(RContactViewSortOrder& aSortOrder,CContactNamedRemoteView& aView,TInt aNumViews) |
|
1586 { |
|
1587 aView.ChangeSortOrderL(aSortOrder); |
|
1588 iNumViews=aNumViews; |
|
1589 iNumNotifications=0; |
|
1590 } |
|
1591 |
|
1592 CSortOrderChanger::~CSortOrderChanger() |
|
1593 { |
|
1594 } |
|
1595 |
|
1596 void CSortOrderChanger::HandleNotificationL(const CContactViewBase&,const TContactViewEvent& aEvent) |
|
1597 { |
|
1598 test(aEvent.iEventType==TContactViewEvent::EUnavailable || aEvent.iEventType==TContactViewEvent::ESortOrderChanged); |
|
1599 if (++iNumNotifications==iNumViews*2) // 2 because there will be EUnavailable, ESortOrderChanged notifications for each view. |
|
1600 { |
|
1601 iConductor.NextTest(); |
|
1602 } |
|
1603 } |
|
1604 |
|
1605 CSortOrderChanger::CSortOrderChanger(CTestConductor& aConductor) : CTestBase(aConductor) |
|
1606 { |
|
1607 } |
|
1608 |
|
1609 |
|
1610 // |
|
1611 // CUnsortableContactAdder. |
|
1612 // |
|
1613 |
|
1614 CUnsortableContactAdder::CUnsortableContactAdder(CTestConductor& aConductor,const CContactViewBase& aView) |
|
1615 :CTestBase(aConductor),iView(&aView) |
|
1616 {} |
|
1617 |
|
1618 CUnsortableContactAdder* CUnsortableContactAdder::NewL(CTestConductor& aConductor,const CContactViewBase& aView) |
|
1619 { |
|
1620 CUnsortableContactAdder* self=new(ELeave) CUnsortableContactAdder(aConductor,aView); |
|
1621 return self; |
|
1622 } |
|
1623 |
|
1624 CUnsortableContactAdder::~CUnsortableContactAdder() |
|
1625 { |
|
1626 } |
|
1627 |
|
1628 void CUnsortableContactAdder::AddContactsL(TInt aNumberOfContact,TContactViewPreferences aContactTypes) |
|
1629 { |
|
1630 iNumContacts = aNumberOfContact; |
|
1631 iNumNotifications=0; |
|
1632 for(TInt ii=0;ii<KNumberOfUnsortableContacts;ii++) |
|
1633 { |
|
1634 TContactItemId id = iConductor.iRandomGenerator->AddTypicalContactForLocalViewPreferencesL(TContactViewPreferences(aContactTypes)); |
|
1635 iConductor.iTestIds.Append(id); |
|
1636 } |
|
1637 |
|
1638 |
|
1639 } |
|
1640 void CUnsortableContactAdder::HandleNotificationL(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
1641 { |
|
1642 if(aEvent.iEventType==TContactViewEvent::EItemAdded && &aView == iView ) |
|
1643 { |
|
1644 //only start the next test when all the contact have been added to our view. |
|
1645 if (++iNumNotifications==iNumContacts) |
|
1646 { |
|
1647 iConductor.NextTest(); |
|
1648 } |
|
1649 } |
|
1650 } |
|
1651 |
|
1652 /** Constructor */ |
|
1653 CContactOwnCardRemover::CContactOwnCardRemover(CTestConductor& aConductor) : CTestBase(aConductor) |
|
1654 { |
|
1655 } |
|
1656 |
|
1657 /** Default destructor */ |
|
1658 CContactOwnCardRemover::~CContactOwnCardRemover() |
|
1659 { |
|
1660 } |
|
1661 |
|
1662 /** Sets aId as an own card, then deletes it */ |
|
1663 void CContactOwnCardRemover::RemoveOwnCardL(const CContactViewBase& aView) |
|
1664 { |
|
1665 iView=&aView; |
|
1666 iOriginalCount = aView.CountL(); |
|
1667 TInt id = aView.AtL(0); |
|
1668 CContactItem* item = iConductor.iDb->ReadContactLC(id); |
|
1669 iConductor.iDb->SetOwnCardL(*item); |
|
1670 CleanupStack::PopAndDestroy(item); |
|
1671 iConductor.iDb->DeleteContactL(id); |
|
1672 } |
|
1673 |
|
1674 /** Verifies that a remove event was sent as a result of deleting the item */ |
|
1675 void CContactOwnCardRemover::HandleNotificationL(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
1676 { |
|
1677 if (&aView == iView && aEvent.iEventType == TContactViewEvent::EItemRemoved) |
|
1678 { |
|
1679 test(iView->CountL() == iOriginalCount - 1); |
|
1680 iConductor.NextTest(); |
|
1681 } |
|
1682 } |
|
1683 |
|
1684 // Added test code here for modification of own card |
|
1685 |
|
1686 _LIT(KNewOwnerCardFirstName, "T_VIEW2_OWNCARD"); |
|
1687 |
|
1688 /** Constructor */ |
|
1689 CContactOwnCardModifier::CContactOwnCardModifier(CTestConductor& aConductor) : CTestBase(aConductor) |
|
1690 { |
|
1691 } |
|
1692 |
|
1693 /** Default destructor */ |
|
1694 CContactOwnCardModifier::~CContactOwnCardModifier() |
|
1695 { |
|
1696 } |
|
1697 |
|
1698 /** Sets aId as an own card, then modifies it */ |
|
1699 void CContactOwnCardModifier::ModifyOwnCardL(const CContactViewBase& aView) |
|
1700 { |
|
1701 iView=&aView; |
|
1702 iOriginalCount = aView.CountL(); |
|
1703 TInt id = aView.AtL(0); |
|
1704 CContactItem* item = iConductor.iDb->OpenContactLX(id); |
|
1705 if (item) |
|
1706 { |
|
1707 CleanupStack::PushL(item); |
|
1708 iConductor.iDb->SetOwnCardL(*item); |
|
1709 // Modify first name |
|
1710 CContactItemFieldSet& fieldSet = item->CardFields(); |
|
1711 TInt index=fieldSet.Find(KUidContactFieldGivenName); |
|
1712 User::LeaveIfError(index); |
|
1713 CContactItemField& field = fieldSet[index]; |
|
1714 ASSERT(field.StorageType()==KStorageTypeText); |
|
1715 STATIC_CAST(CContactTextField*,field.Storage())->SetTextL(KNewOwnerCardFirstName); |
|
1716 iConductor.iDb->CommitContactL(*item); |
|
1717 CleanupStack::PopAndDestroy(2); // item, lock record |
|
1718 } |
|
1719 } |
|
1720 |
|
1721 /** Verifies that notification of own card item modification has been received*/ |
|
1722 void CContactOwnCardModifier::HandleNotificationL(const CContactViewBase& aView,const TContactViewEvent& aEvent) |
|
1723 { |
|
1724 if (&aView == iView && aEvent.iEventType == TContactViewEvent::EItemAdded) |
|
1725 {// THIS SHOULD NOT LEAVE... |
|
1726 test(iView->CountL()==iOriginalCount); // Follows corresponding remove |
|
1727 // Test that the own card data has been updated correctly |
|
1728 TContactItemId ownCardId = iConductor.iDb->OwnCardId(); |
|
1729 TInt ownCardIndex = aView.FindL(ownCardId); |
|
1730 const CViewContact& contact = aView.ContactAtL(ownCardIndex); |
|
1731 test(ownCardId==contact.Id()); // No reason this should fail |
|
1732 |
|
1733 const RContactViewSortOrder& sortOrder = aView.SortOrderL(); |
|
1734 // Get the first name field |
|
1735 TInt index = 0; |
|
1736 TInt soCount = sortOrder.Count(); |
|
1737 for (; index < soCount; ++index) |
|
1738 { |
|
1739 if (KUidContactFieldGivenName == sortOrder[index]) |
|
1740 { |
|
1741 break; |
|
1742 } |
|
1743 } |
|
1744 |
|
1745 TPtrC fieldData(contact.Field(index) ); |
|
1746 test( (fieldData.CompareC(KNewOwnerCardFirstName) ) == 0); |
|
1747 iNotificationsReceived++; |
|
1748 if (iNotificationsReceived == 2) |
|
1749 { |
|
1750 iConductor.NextTest(); |
|
1751 } |
|
1752 } |
|
1753 } |
|
1754 |
|
1755 |
|
1756 // |
|
1757 // Main. |
|
1758 // |
|
1759 |
|
1760 /** |
|
1761 |
|
1762 @SYMTestCaseID PIM-T-VIEW2-0001 |
|
1763 |
|
1764 */ |
|
1765 |
|
1766 GLDEF_C TInt E32Main() |
|
1767 { |
|
1768 __UHEAP_MARK; |
|
1769 // UserHal::SetAutoSwitchOffBehavior(ESwitchOffDisabled); |
|
1770 CActiveScheduler* scheduler=new CActiveScheduler; |
|
1771 if (scheduler) |
|
1772 { |
|
1773 CActiveScheduler::Install(scheduler); |
|
1774 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
1775 if (cleanup) |
|
1776 { |
|
1777 CTestConductor* tester=NULL; |
|
1778 test.Start(KTestName); |
|
1779 |
|
1780 TRAPD(err,tester=CTestConductor::NewL()); |
|
1781 __ASSERT_ALWAYS(err == KErrNone, User::Invariant()); |
|
1782 test.End(); |
|
1783 delete tester; |
|
1784 test.Close(); |
|
1785 delete cleanup; |
|
1786 } |
|
1787 delete scheduler; |
|
1788 } |
|
1789 __UHEAP_MARKEND; |
|
1790 return KErrNone; |
|
1791 } |