diff -r 2b7283837edb -r 3104fc151679 uiservicetab/vimpstcmdprocess/tsrc/vimpstcmdprocess_utest/data/branch_coverage/indexD2.html --- a/uiservicetab/vimpstcmdprocess/tsrc/vimpstcmdprocess_utest/data/branch_coverage/indexD2.html Thu Aug 19 09:41:53 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,739 +0,0 @@ - -
-Start/ | End/ | |||
True | False | - | Line | Source |
1 | /* | |||
2 | * ============================================================================== | |||
3 | * Name : vimpstcmdprocess_utestCases.cpp | |||
4 | * Part of : vimpstcmdprocess_utest | |||
5 | * | |||
6 | * Description : vimpstcmdprocess_utest test module. | |||
7 | * Version: %version: 6 % | |||
8 | * | |||
9 | * Copyright (C) 2002 - 2007 Nokia Corporation. | |||
10 | * This material, including documentation and any related | |||
11 | * computer programs, is protected by copyright controlled by | |||
12 | * Nokia Corporation. All rights are reserved. Copying, | |||
13 | * including reproducing, storing, adapting or translating, any | |||
14 | * or all of this material requires the prior written consent of | |||
15 | * Nokia Corporation. This material also contains confidential | |||
16 | * information which may not be disclosed to others without the | |||
17 | * prior written consent of Nokia Corporation. | |||
18 | * | |||
19 | * ============================================================================ | |||
20 | */ | |||
21 | ||||
22 | /** | |||
23 | * GLOBAL VARIABLES SECTION | |||
24 | */ | |||
25 | #ifdef TEST_VAR_DECLARATIONS | |||
26 | #endif | |||
27 | /** | |||
28 | * END OF GLOBAL VARIABLES SECTION | |||
29 | */ | |||
30 | ||||
31 | /** | |||
32 | * TEST CASES SECTION | |||
33 | */ | |||
34 | #ifdef TEST_CASES | |||
35 | /** | |||
36 | * STIF_SETUP defines activities needed before every test case. | |||
37 | */ | |||
38 | STIF_SETUP | |||
39 | { | |||
40 | } | |||
41 | ||||
42 | /** | |||
43 | * STIF_TEARDOWN defines activities needed after every test case | |||
44 | */ | |||
45 | STIF_TEARDOWN | |||
46 | { | |||
47 | } | |||
48 | ||||
49 | /** | |||
50 | * STIF_TESTDEFINE defines a test case | |||
51 | * | |||
52 | * Example test case - length of string is checked. | |||
53 | * The only argument of macro is a name of test case. | |||
54 | */ | |||
55 | STIF_TESTDEFINE(t_ProcArr_HandleChatMessageEventL) | |||
56 | { | |||
57 | //void HandleChatMessageEventL(TVIMPSTEnums::TIMEventType aEventType ,const TDesC& aSender ); | |||
58 | vimpstengine_stub engin; | |||
59 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
60 | procArray->iFetchCompleted = ETrue; | |||
61 | vimpststoragecontactlist_stub contactlist; | |||
62 | // vimpststoragecontact_stub contact; | |||
63 | ||||
64 | _LIT(KText,"Nutan@presence"); | |||
65 | HBufC* buddyId = HBufC::NewL(32); | |||
66 | CleanupStack::PushL(buddyId); | |||
67 | *buddyId = KText; | |||
68 | ||||
69 | MVIMPSTProcessArrayObserver* ob = vimpstprocessarrayobserver_stub::NewL(); | |||
70 | procArray->AddObserver(ob); | |||
71 | procArray->iContactInterface = vimpstserviceview_stub::NewL(); | |||
72 | procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMRequestCompleted,buddyId->Des() ); | |||
73 | STIF_ASSERT_NOT_NULL(procArray); | |||
74 | ||||
75 | //procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMNewMessage,buddyId->Des() ); | |||
76 | //STIF_ASSERT_NOT_NULL(procArray); | |||
77 | MVIMPSTStorageContact* contact = vimpststoragecontact_stub::NewL(); | |||
78 | CVIMPSTProcessContactItem* contactItem = CVIMPSTProcessContactItem::NewL (const_cast<TDesC&>(contact->Name() ), | |||
79 | const_cast<TDesC&>(contact->UserId() ),contact->ContactLink() ); | |||
80 | ||||
81 | procArray->iItemArray.Append(contactItem ); | |||
82 | procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMUnreadMessage,buddyId->Des() ); | |||
83 | STIF_ASSERT_NOT_NULL(procArray); | |||
84 | ||||
85 | procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMUnreadChange,buddyId->Des() ); | |||
86 | STIF_ASSERT_NOT_NULL(procArray); | |||
87 | ||||
88 | // procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMNewChat,buddyId->Des() ); | |||
89 | // STIF_ASSERT_NOT_NULL(procArray); | |||
90 | ||||
91 | procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMChatStarted,buddyId->Des() ); | |||
92 | STIF_ASSERT_NOT_NULL(procArray); | |||
93 | ||||
94 | procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMChatClosed,buddyId->Des() ); | |||
95 | STIF_ASSERT_NOT_NULL(procArray); | |||
96 | ||||
97 | procArray->HandleChatMessageEventL(TVIMPSTEnums::EIMAllChatClosed,buddyId->Des() ); | |||
98 | CleanupStack::PopAndDestroy(buddyId); | |||
99 | STIF_ASSERT_NOT_NULL(procArray); | |||
100 | ||||
101 | ||||
102 | } | |||
103 | ||||
104 | STIF_TESTDEFINE(t_ProcArr_HandleAddRequestEventL) | |||
105 | { | |||
106 | //void HandleAddRequestEventL(TVIMPSTEnums::TOperationType aType, const TDesC& aRequesterId); | |||
107 | vimpstengine_stub engin; | |||
108 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
109 | ||||
110 | _LIT(KText,"addcontact@presence"); | |||
111 | HBufC* buf = HBufC::NewL(32); | |||
112 | CleanupStack::PushL(buf); | |||
113 | *buf = KText; | |||
114 | ///////Test case for Add request////// | |||
115 | procArray->HandleAddRequestEventL(TVIMPSTEnums::EAddItem,buf->Des()); | |||
116 | STIF_ASSERT_NOT_NULL(procArray); | |||
117 | ||||
118 | for(TInt i=0;i<3;i++) | |||
119 | { | |||
120 | procArray->HandleAddRequestEventL(TVIMPSTEnums::EAddItem,buf->Des()); | |||
121 | } | |||
122 | TInt count = procArray->iAddRequestArray.Count(); | |||
123 | STIF_ASSERT_EQUALS(1,count); | |||
124 | ||||
125 | ///////Test case for Update request////// | |||
126 | //procArray->HandleAddRequestEventL(TVIMPSTEnums::EUpdateItem,buf->Des()); | |||
127 | // count = procArray->iAddRequestArray.Count(); | |||
128 | // CleanupStack::PopAndDestroy(buf); | |||
129 | // STIF_ASSERT_EQUALS(1,count); | |||
130 | MVIMPSTProcessArrayObserver* ob = vimpstprocessarrayobserver_stub::NewL(); | |||
131 | procArray->AddObserver(ob); | |||
132 | ///////Test case for Remove request////// | |||
133 | procArray->HandleAddRequestEventL(TVIMPSTEnums::ERemoveItem,buf->Des()); | |||
134 | count = procArray->iAddRequestArray.Count(); | |||
135 | CleanupStack::PopAndDestroy(buf); | |||
136 | STIF_ASSERT_EQUALS(0,count); | |||
137 | } | |||
138 | ||||
139 | /* No test case for functions below as they will not leave or return any value | |||
140 | void AddObserver(MVIMPSTProcessArrayObserver* aObserver) ; | |||
141 | void RemoveObserver() ; | |||
142 | void ResetArray(); | |||
143 | void MapContactListPositions(RArray<TInt>& aPositionArray ); | |||
144 | void RemoveFriendRequestL(const TDesC& aRequesterId); | |||
145 | void SetOwnAvatarIndexL( TInt aAvatarIndex ); | |||
146 | void ResetOpenConversationPendingMsg(); | |||
147 | */ | |||
148 | STIF_TESTDEFINE(t_ProcArr_Count) | |||
149 | { | |||
150 | vimpstengine_stub engin; | |||
151 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
152 | _LIT(KText,"addcontact@presence"); | |||
153 | TPtrC buf = KText; | |||
154 | procArray->HandleAddRequestEventL(TVIMPSTEnums::EAddItem,buf); | |||
155 | ||||
156 | for(TInt i=0;i<3;i++) | |||
157 | { | |||
158 | procArray->HandleAddRequestEventL(TVIMPSTEnums::EAddItem,buf); | |||
159 | } | |||
160 | TInt count = procArray->iAddRequestArray.Count(); | |||
161 | STIF_ASSERT_EQUALS(1,count); | |||
162 | } | |||
163 | ||||
164 | STIF_TESTDEFINE(t_ProcArr_IsSubServiceSupportedL) | |||
165 | { | |||
166 | //TBool IsSubServiceSupportedL( TVIMPSTEnums::SubServiceType aType ) const ; | |||
167 | vimpstengine_stub engin; | |||
168 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
169 | TBool result; | |||
170 | result = procArray->IsSubServiceSupportedL(TVIMPSTEnums::EVoip); | |||
171 | STIF_ASSERT_EQUALS(1,result); | |||
172 | result = procArray->IsSubServiceSupportedL(TVIMPSTEnums::EPresence); | |||
173 | STIF_ASSERT_EQUALS(1,result); | |||
174 | result = procArray->IsSubServiceSupportedL(TVIMPSTEnums::EIM); | |||
175 | STIF_ASSERT_EQUALS(1,result); | |||
176 | result = procArray->IsSubServiceSupportedL(TVIMPSTEnums::ELast); | |||
177 | STIF_ASSERT_EQUALS(1,result); | |||
178 | } | |||
179 | ||||
180 | STIF_TESTDEFINE(t_ProcArr_GetType) | |||
181 | { | |||
182 | // virtual TVIMPSTEnums::TItem GetType(TInt aIndex) const; | |||
183 | vimpstengine_stub engin; | |||
184 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
185 | ||||
186 | /*HBufC* contactData = HBufC::NewL(512); | |||
187 | TPtr contactDataPtr( contactData->Des() ); | |||
188 | contactDataPtr = ; | |||
189 | */ | |||
190 | _LIT(KText,"Nutan@presence"); | |||
191 | TDesC contactData = KText; | |||
192 | MVIMPSTStorageContact* contact = vimpststoragecontact_stub::NewL(); | |||
193 | CVIMPSTProcessContactItem* contactItem = CVIMPSTProcessContactItem::NewL (const_cast<TDesC&>(contact->Name() ), | |||
194 | const_cast<TDesC&>(contact->UserId() ),contact->ContactLink() ); | |||
195 | ||||
196 | procArray->iItemArray.Append(contactItem ); | |||
197 | ||||
198 | //EInvalid = -1, /* unknown Item */ | |||
199 | //EOwnStatusItem, /* Own item */ | |||
200 | //EContactItem, /* Contact Item */ | |||
201 | //EContactListItem, /* ContactList Item */ | |||
202 | //EFriendRequestItem,/* Friend request item */ | |||
203 | //EUnknonContactItem, /* contact item but not in friend list */ | |||
204 | ||||
205 | TInt index = 0; | |||
206 | TVIMPSTEnums::TItem itemType = procArray->GetType( index ); | |||
207 | ||||
208 | STIF_ASSERT_EQUALS(TVIMPSTEnums::EOwnStatusItem,itemType); | |||
209 | index = 2; | |||
210 | itemType = procArray->GetType( index ); | |||
211 | STIF_ASSERT_EQUALS(TVIMPSTEnums::EContactItem,itemType); | |||
212 | procArray->iItemArray.ResetAndDestroy(); | |||
213 | } | |||
214 | ||||
215 | STIF_TESTDEFINE(t_ProcArr_GetItemNameText) | |||
216 | { | |||
217 | //virtual TPtrC GetItemNameText(TInt aIndex); | |||
218 | vimpstengine_stub engin; | |||
219 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
220 | //_LIT(KDummy,"dummy@gmail.com"); | |||
221 | _LIT(KDummy1,"dummy1@gmail.com"); | |||
222 | ||||
223 | TPtrC contactData = KDummy1; | |||
224 | //TDesC contactData = KDummy1; | |||
225 | CVIMPSTProcessOwnDataItem* ownitem = CVIMPSTProcessOwnDataItem::NewL(contactData); | |||
226 | procArray->iItemArray.Append(ownitem ); | |||
227 | MVIMPSTStorageContact* contact = vimpststoragecontact_stub::NewL(); | |||
228 | CVIMPSTProcessContactItem* contactItem = CVIMPSTProcessContactItem::NewL (const_cast<TDesC&>(contact->Name() ), | |||
229 | const_cast<TDesC&>(contact->UserId() ),contact->ContactLink() ); | |||
230 | procArray->iItemArray.Append(contactItem ); | |||
231 | ||||
232 | TInt itemindex = 2; | |||
233 | TPtrC itemname = procArray->GetItemNameText(itemindex); | |||
234 | STIF_ASSERT_EQUALS( contactData,itemname); | |||
235 | ||||
236 | itemindex = -1; | |||
237 | TPtrC itemname1 = procArray->GetItemNameText(itemindex); | |||
238 | ||||
239 | procArray->iItemArray.ResetAndDestroy(); | |||
240 | TPtrC nulldata = KNullDesC; | |||
241 | STIF_ASSERT_EQUALS(nulldata,itemname1); | |||
242 | // STIF_ASSERT_NULL(itemname1); | |||
243 | } | |||
244 | ||||
245 | STIF_TESTDEFINE(t_ProcArr_Set_Get_LoginStateL) | |||
246 | { | |||
247 | //virtual TVIMPSTEnums::TVIMPSTRegistrationState GetLoginState(); | |||
248 | vimpstengine_stub engin; | |||
249 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
250 | ||||
251 | procArray->SetLoginStateL( TVIMPSTEnums::ESVCERegistered ); | |||
252 | TVIMPSTEnums::TVIMPSTRegistrationState aState = procArray->GetLoginState(); | |||
253 | ||||
254 | STIF_ASSERT_EQUALS( TVIMPSTEnums::ESVCERegistered,aState); | |||
255 | } | |||
256 | ||||
257 | STIF_TESTDEFINE(t_ProcArr_ContactLink) | |||
258 | { | |||
259 | //MVPbkContactLink* ContactLink(TInt aIndex); | |||
260 | vimpstengine_stub engin; | |||
261 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
262 | ||||
263 | procArray->ContactLink( 1 ); | |||
264 | STIF_ASSERT_EQUALS( 1,1); | |||
265 | } | |||
266 | ||||
267 | STIF_TESTDEFINE(t_ProcArr_GetOnlineStatusL) | |||
268 | { | |||
269 | //TVIMPSTEnums::TOnlineStatus GetOnlineStatusL(TInt aIndex); | |||
270 | vimpstengine_stub engin; | |||
271 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
272 | /* | |||
273 | EUnknown = -1, // unknown status | |||
274 | EOffline, // Offline status | |||
275 | EOnline, // Online status | |||
276 | EInvisible, // Invisible status | |||
277 | EAway, // Away status | |||
278 | EBusy, // Busy status | |||
279 | EOnPhone, | |||
280 | EDoNotDisturb, | |||
281 | EPending, | |||
282 | EBlocked | |||
283 | */ | |||
284 | TInt index = 0; | |||
285 | TVIMPSTEnums::TOnlineStatus aState = procArray->GetOnlineStatusL(index); | |||
286 | ||||
287 | STIF_ASSERT_EQUALS( TVIMPSTEnums::EOffline,aState); | |||
288 | } | |||
289 | ||||
290 | STIF_TESTDEFINE(t_ProcArr_StatusTextL) | |||
291 | { | |||
292 | //const TDesC& StatusTextL(TInt aIndex ) ; | |||
293 | vimpstengine_stub engin; | |||
294 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
295 | TInt index = 0; | |||
296 | _LIT(temptext, "dummy"); | |||
297 | TPtrC statustxt = KDummy(); | |||
298 | TPtrC statustext = procArray->StatusTextL(index); | |||
299 | STIF_ASSERT_EQUALS( statustxt,statustext); | |||
300 | } | |||
301 | ||||
302 | STIF_TESTDEFINE(t_ProcArr_IsMsgPending) | |||
303 | { | |||
304 | /*//TBool IsMsgPending(TInt aIndex); | |||
305 | //void ResetPendingMsg(TInt aIndex); | |||
306 | vimpstengine_stub engin; | |||
307 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
308 | TInt index = 0; | |||
309 | TBool pendingMsg = procArray->IsMsgPending(index); | |||
310 | STIF_ASSERT_EQUALS( 0,pendingMsg); | |||
311 | procArray->ResetPendingMsg(index); | |||
312 | STIF_ASSERT_EQUALS( 0,pendingMsg);*/ | |||
313 | } | |||
314 | ||||
315 | STIF_TESTDEFINE(t_ProcArr_FindAnyContact) | |||
316 | { | |||
317 | //TBool FindAnyContact( const TDesC& aContactId ); | |||
318 | vimpstengine_stub engin; | |||
319 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
320 | _LIT(KText,"dummy@presence"); | |||
321 | TPtrC contactData = KText; | |||
322 | TBool contactExist = procArray->FindAnyContact(contactData); | |||
323 | STIF_ASSERT_EQUALS( 1,contactExist); | |||
324 | ||||
325 | TPtrC contactData1 = KNullDesC; | |||
326 | contactExist = procArray->FindAnyContact(contactData1); | |||
327 | STIF_ASSERT_EQUALS( 0,contactExist); | |||
328 | } | |||
329 | ||||
330 | STIF_TESTDEFINE(t_ProcArr_FindAnyContactServiceField) | |||
331 | { | |||
332 | vimpstengine_stub engin; | |||
333 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
334 | _LIT(KText,"dummy@presence"); | |||
335 | TPtrC contactData = KText; | |||
336 | TBool contactExist = procArray->FindAnyContactServiceField(contactData); | |||
337 | STIF_ASSERT_EQUALS( 1,contactExist); | |||
338 | ||||
339 | TPtrC contactData1 = KNullDesC; | |||
340 | contactExist = procArray->FindAnyContactServiceField(contactData1); | |||
341 | STIF_ASSERT_EQUALS( 0,contactExist); | |||
342 | //TBool FindAnyContactServiceField( const TDesC& aContactId ); | |||
343 | ||||
344 | } | |||
345 | ||||
346 | STIF_TESTDEFINE(t_ProcArr_FindAnyAddRequest) | |||
347 | { | |||
348 | //TBool FindAnyAddRequest( const TDesC& aRequesterId ); | |||
349 | vimpstengine_stub engin; | |||
350 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
351 | _LIT(KText,"Nutan@presence"); | |||
352 | TPtrC contactData = KText; | |||
353 | CVIMPSTProcessFriendRequestItem* frn = CVIMPSTProcessFriendRequestItem::NewL(contactData); | |||
354 | procArray->iAddRequestArray.AppendL(frn); | |||
355 | TBool addRequest = procArray->FindAnyAddRequest(contactData); | |||
356 | STIF_ASSERT_EQUALS( 1,addRequest); | |||
357 | _LIT(KText1,"Nutan1@presence"); | |||
358 | TPtrC contactData1 = KText1; | |||
359 | addRequest = procArray->FindAnyAddRequest(contactData1); | |||
360 | STIF_ASSERT_EQUALS( 0,addRequest); | |||
361 | } | |||
362 | ||||
363 | STIF_TESTDEFINE(t_ProcArr_IsContactBlocked) | |||
364 | { | |||
365 | //TBool IsContactBlocked( const TDesC& aRequesterId ); | |||
366 | vimpstengine_stub engin; | |||
367 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
368 | _LIT(KText,"blocked@presence"); | |||
369 | TPtrC contactData = KText; | |||
370 | TBool contactBlocked = procArray->IsContactBlocked(contactData); | |||
371 | STIF_ASSERT_EQUALS( 1,contactBlocked); | |||
372 | _LIT(KText1,"Nutan1@presence"); | |||
373 | TPtrC contactData1 = KText1; | |||
374 | contactBlocked = procArray->IsContactBlocked(contactData1); | |||
375 | STIF_ASSERT_EQUALS( 0,contactBlocked); | |||
376 | } | |||
377 | ||||
378 | STIF_TESTDEFINE(t_ProcArr_IsConversationExistL) | |||
379 | { | |||
380 | //TBool IsConversationExistL(const TDesC& aRecipientId) ; | |||
381 | vimpstengine_stub engin; | |||
382 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
383 | _LIT(KText,"addcontact@presence"); | |||
384 | TDesC contactData = KText; | |||
385 | TBool conversationExist = procArray->IsConversationExistL(contactData); | |||
386 | STIF_ASSERT_EQUALS( 0,conversationExist); | |||
387 | } | |||
388 | ||||
389 | STIF_TESTDEFINE(t_ProcArr_FindContactIndexL) | |||
390 | { | |||
391 | //TInt FindContactIndexL( const TDesC& aContactId ) ; | |||
392 | vimpstengine_stub engin; | |||
393 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
394 | procArray->iContactListModel = vimpststorageitemlist_stub::NewL(); | |||
395 | _LIT(KText,"dummy@presence"); | |||
396 | TPtrC contactData = KText; | |||
397 | ||||
398 | TInt contactIndex = procArray->FindContactIndexL(contactData); | |||
399 | STIF_ASSERT_EQUALS( 2,contactIndex); | |||
400 | _LIT(KText1,"addcontact@presence"); | |||
401 | TPtrC contactData1 = KText1; | |||
402 | contactIndex = procArray->FindContactIndexL(contactData1); | |||
403 | STIF_ASSERT_EQUALS( -1,contactIndex); | |||
404 | } | |||
405 | ||||
406 | STIF_TESTDEFINE(t_ProcArr_GetItemUserId) | |||
407 | { | |||
408 | //TPtrC GetItemUserId(TInt aIndex); | |||
409 | vimpstengine_stub engin; | |||
410 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
411 | _LIT(KText,"ownid@presence"); | |||
412 | TPtrC tempusrId = KText; | |||
413 | CVIMPSTProcessOwnDataItem* ownitem = CVIMPSTProcessOwnDataItem::NewL(tempusrId); | |||
414 | procArray->iItemArray.Append(ownitem ); | |||
415 | ||||
416 | TInt index = 2; | |||
417 | TPtrC userId = procArray->GetItemUserId(index); | |||
418 | STIF_ASSERT_EQUALS(tempusrId,userId); | |||
419 | ||||
420 | ||||
421 | MVIMPSTStorageContact* contact = vimpststoragecontact_stub::NewL(); | |||
422 | CVIMPSTProcessContactItem* contactItem = CVIMPSTProcessContactItem::NewL (const_cast<TDesC&>(contact->Name() ), | |||
423 | const_cast<TDesC&>(contact->UserId() ),contact->ContactLink() ); | |||
424 | procArray->iItemArray.Append(contactItem ); | |||
425 | ||||
426 | index = 3; | |||
427 | _LIT(KText1,"dummy@presence"); | |||
428 | TPtrC tempusrId1 = KText1; | |||
429 | TPtrC userId1 = procArray->GetItemUserId(index); | |||
430 | STIF_ASSERT_EQUALS(tempusrId1,userId1); | |||
431 | ||||
432 | index = 4; | |||
433 | ||||
434 | TPtrC userId2 = procArray->GetItemUserId(index); | |||
435 | TPtrC null = KNullDesC; | |||
436 | STIF_ASSERT_EQUALS(null,userId2); | |||
437 | ||||
438 | ||||
439 | } | |||
440 | ||||
441 | STIF_TESTDEFINE(t_ProcArr_LoginUserIdFromStoreL) | |||
442 | { | |||
443 | //const TDesC& LoginUserIdFromStoreL() const; | |||
444 | vimpstengine_stub engin; | |||
445 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
446 | _LIT(KText,"dummy@presence"); | |||
447 | TPtrC ownuserId = KText ; | |||
448 | TPtrC userId = procArray->LoginUserIdFromStoreL(); | |||
449 | STIF_ASSERT_EQUALS(ownuserId ,userId); | |||
450 | } | |||
451 | ||||
452 | STIF_TESTDEFINE(t_ProcArr_OwnAvatarIndexL) | |||
453 | { | |||
454 | //TInt OwnAvatarIndexL( ) ; | |||
455 | vimpstengine_stub engin; | |||
456 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
457 | _LIT(KText,"Nutan@presence"); | |||
458 | TInt avatarIndex = procArray->OwnAvatarIndexL(); | |||
459 | STIF_ASSERT_EQUALS(1 ,avatarIndex); | |||
460 | } | |||
461 | ||||
462 | STIF_TESTDEFINE(t_ProcArr_OwnAvatarContentL) | |||
463 | { | |||
464 | //const TDesC8& OwnAvatarContentL( ) const ; | |||
465 | vimpstengine_stub engin; | |||
466 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
467 | _LIT8(KText,"avatar"); | |||
468 | ||||
469 | TPtrC8 ownavacontent = KText; | |||
470 | TPtrC8 avatarContent = procArray->OwnAvatarContentL(); | |||
471 | STIF_ASSERT_EQUALS( ownavacontent,avatarContent); | |||
472 | } | |||
473 | ||||
474 | STIF_TESTDEFINE(t_ProcArr_AvatarContent) | |||
475 | { | |||
476 | //const TDesC8& AvatarContent(TInt aContactIndex) ; | |||
477 | vimpstengine_stub engin; | |||
478 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
479 | _LIT8(KText,"avatar"); | |||
480 | ||||
481 | TPtrC8 avacontent = KText; | |||
482 | MVIMPSTStorageContact* contact = vimpststoragecontact_stub::NewL(); | |||
483 | CVIMPSTProcessContactItem* contactItem = CVIMPSTProcessContactItem::NewL (const_cast<TDesC&>(contact->Name() ), | |||
484 | const_cast<TDesC&>(contact->UserId() ),contact->ContactLink() ); | |||
485 | procArray->iItemArray.Append(contactItem ); | |||
486 | TInt index = 1; | |||
487 | TPtrC8 avatarContent = procArray->AvatarContent(index); | |||
488 | STIF_ASSERT_EQUALS(avacontent,avatarContent); | |||
489 | } | |||
490 | ||||
491 | STIF_TESTDEFINE(t_ProcArr_SetAvatarIndex) | |||
492 | { | |||
493 | //void SetAvatarIndex( TInt aContactIndex, TInt aAvatarIndex ); | |||
494 | //TInt AvatarIndex(TInt aContactIndex) ; | |||
495 | vimpstengine_stub engin; | |||
496 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
497 | TInt ContactIndex = 1; | |||
498 | TInt index = 1; | |||
499 | MVIMPSTStorageContact* contact = vimpststoragecontact_stub::NewL(); | |||
500 | CVIMPSTProcessContactItem* contactItem = CVIMPSTProcessContactItem::NewL (const_cast<TDesC&>(contact->Name() ), | |||
501 | const_cast<TDesC&>(contact->UserId() ),contact->ContactLink() ); | |||
502 | procArray->iItemArray.Append(contactItem ); | |||
503 | procArray->SetAvatarIndex(ContactIndex, index); | |||
504 | TInt avaIndex = procArray->AvatarIndex(ContactIndex); | |||
505 | STIF_ASSERT_EQUALS(index ,avaIndex); | |||
506 | } | |||
507 | ||||
508 | STIF_TESTDEFINE(t_ProcArr_FindArrayItem) | |||
509 | { | |||
510 | //MVIMPSTProcessArrayItem* FindArrayItem( const TDesC& aSenderId ); | |||
511 | vimpstengine_stub engin; | |||
512 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
513 | _LIT(KText,"ownid@presence"); | |||
514 | TPtrC tempusrId = KText; | |||
515 | CVIMPSTProcessOwnDataItem* ownitem = CVIMPSTProcessOwnDataItem::NewL(tempusrId); | |||
516 | procArray->iItemArray.Append(ownitem ); | |||
517 | ||||
518 | MVIMPSTProcessArrayItem* arrayItem = procArray->FindArrayItem(tempusrId); | |||
519 | TPtrC userid = arrayItem->GetItemUserId(); | |||
520 | STIF_ASSERT_EQUALS( tempusrId,userid); | |||
521 | } | |||
522 | /* | |||
523 | ||||
524 | private: // Implementation | |||
525 | /** | |||
526 | * FillItemL: fill up the individual item in the array | |||
527 | * @return void | |||
528 | ** | |||
529 | void FillItemL(); | |||
530 | /** | |||
531 | * FillOwnDataL: fill up fill the owndata item | |||
532 | * @return void | |||
533 | ** | |||
534 | TBool FillOwnDataL(); | |||
535 | ||||
536 | /** | |||
537 | * FillArray: fill up the complete array | |||
538 | * @return void | |||
539 | ** | |||
540 | void FillArrayL(); | |||
541 | ||||
542 | /** | |||
543 | * fill the unknown contact to main array | |||
544 | * @return void | |||
545 | ** | |||
546 | void FillUnknownContactsL(); | |||
547 | /** | |||
548 | * FillAddRequestDataL: fill up the add request to array | |||
549 | * @return void | |||
550 | ** | |||
551 | void FillAddRequestDataL(); | |||
552 | ||||
553 | /** | |||
554 | * remove all the unknown contacts from main array iItemArray, | |||
555 | * so that unknown contact can pesist till the session is entertainesd. | |||
556 | * @return void | |||
557 | ** | |||
558 | void RemoveUnKnownContacts(); | |||
559 | /** | |||
560 | * RemoveAddRequestData: removes data from iItemArray, | |||
561 | * so that request can pesist till the reqest is entertainesd. | |||
562 | * @return void | |||
563 | ** | |||
564 | void RemoveAddRequestData(); | |||
565 | ||||
566 | /** | |||
567 | * handlle the message which is from unknown buddy | |||
568 | * @param aSenderId , Sender Id | |||
569 | * @return void | |||
570 | ** | |||
571 | void DoHandleUnKnownContactMessageL( const TDesC& aSenderId ,TBool aIsMsgPending); | |||
572 | ||||
573 | /** | |||
574 | * get the all open chat and append unknown contacts | |||
575 | * @return void | |||
576 | ** | |||
577 | void GetAndCreateOpenChatListL(); | |||
578 | ||||
579 | /** | |||
580 | * remove the item from invitation or unknown array if found | |||
581 | * @param aContactId : conatct user Id | |||
582 | * @return ETrue if contact is removed | |||
583 | * | |||
584 | TBool RemoveFromUnknonOrInvitationListL( const TDesC& aContactId , TBool aBlocked ) ; | |||
585 | /** | |||
586 | * play the incoming message tone. | |||
587 | * | |||
588 | void PlayMsgBeepL(); | |||
589 | ||||
590 | /** | |||
591 | * @return ETrue if unread message exist | |||
592 | * | |||
593 | TBool IsUnreadMessageExistsL(const TDesC& aRecipientId); | |||
594 | /** | |||
595 | * helper method for removing unknown contacts | |||
596 | * @return ETrue if contact is removed | |||
597 | * | |||
598 | TBool RemoveFromUnknonListL( const TDesC& aAddedUserId ); | |||
599 | /** | |||
600 | * helper method for removing invitation contacts | |||
601 | * @return ETrue if contact is removed | |||
602 | * | |||
603 | TBool RemoveFromInvitationListL( const TDesC& aAddedUserId ); | |||
604 | /** | |||
605 | * helper method for finding and marking as open chat | |||
606 | * @return ETrue if contact is find | |||
607 | * | |||
608 | TBool FindAndMarkContactAsOpenChat( const TDesC& aContactId, TBool aMesssagePending ); | |||
609 | */ | |||
610 | ||||
611 | ||||
612 | STIF_TESTDEFINE(t_ProcArr_GetSelectedItemIndex) | |||
613 | { | |||
614 | vimpstengine_stub engin; | |||
615 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
616 | _LIT(KDummy,"dummy@presence"); | |||
617 | _LIT(KDummy1,"dummy1@gmail.com"); | |||
618 | ||||
619 | TInt index = procArray->GetSelectedItemIndex(KDummy1); | |||
620 | STIF_ASSERT_EQUALS(index ,KErrNotFound); | |||
621 | ||||
622 | procArray->iItemArray.ResetAndDestroy(); | |||
623 | ||||
624 | _LIT(KText,"ownid@presence"); | |||
625 | TPtrC tempusrId = KText; | |||
626 | CVIMPSTProcessOwnDataItem* ownitem = CVIMPSTProcessOwnDataItem::NewL(tempusrId); | |||
627 | procArray->iItemArray.Append(ownitem ); | |||
628 | ||||
629 | TInt index1 = procArray->GetSelectedItemIndex(tempusrId); | |||
630 | STIF_ASSERT_EQUALS(index1 ,0); | |||
631 | ||||
632 | MVIMPSTStorageContact* contact = vimpststoragecontact_stub::NewL(); | |||
633 | CVIMPSTProcessContactItem* contactItem = CVIMPSTProcessContactItem::NewL (const_cast<TDesC&>(contact->Name() ), | |||
634 | const_cast<TDesC&>(contact->UserId() ),contact->ContactLink() ); | |||
635 | procArray->iItemArray.Append(contactItem ); | |||
636 | ||||
637 | ||||
638 | ||||
639 | TInt index2 = procArray->GetSelectedItemIndex(KDummy); | |||
640 | STIF_ASSERT_EQUALS(index2 ,1); | |||
641 | } | |||
642 | ||||
643 | STIF_TESTDEFINE(t_ProcArr_HandleStorageChangeL) | |||
644 | { | |||
645 | vimpstengine_stub engin; | |||
646 | CVIMPSTProcessArray* procArray = CVIMPSTProcessArray::NewL(engin); | |||
647 | vimpststoragecontactlist_stub contactlist; | |||
648 | vimpststoragecontact_stub contact; | |||
649 | MVIMPSTProcessArrayObserver* ob = vimpstprocessarrayobserver_stub::NewL(); | |||
650 | procArray->AddObserver(ob); | |||
651 | ||||
652 | TVIMPSTEnums::TVIMPSTStorgaeEventType eventType = TVIMPSTEnums::EStorageEventContactAddition; | |||
653 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
654 | STIF_ASSERT_NOT_NULL(procArray); | |||
655 | ||||
656 | eventType = TVIMPSTEnums::EStorageEventContactDelete; | |||
657 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
658 | STIF_ASSERT_NOT_NULL(procArray); | |||
659 | ||||
660 | eventType = TVIMPSTEnums::EStorageEventContactChange; | |||
661 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
662 | STIF_ASSERT_NOT_NULL(procArray); | |||
663 | ||||
664 | eventType = TVIMPSTEnums::EStorageAvatarChange; | |||
665 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
666 | STIF_ASSERT_NOT_NULL(procArray); | |||
667 | ||||
668 | eventType = TVIMPSTEnums::EStoragePresenceChange; | |||
669 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
670 | STIF_ASSERT_NOT_NULL(procArray); | |||
671 | ||||
672 | eventType = TVIMPSTEnums::EStorageMultiplePresenceChange; | |||
673 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
674 | STIF_ASSERT_NOT_NULL(procArray); | |||
675 | ||||
676 | eventType = TVIMPSTEnums::EStorageOwnPresenceChange; | |||
677 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
678 | STIF_ASSERT_NOT_NULL(procArray); | |||
679 | ||||
680 | eventType = TVIMPSTEnums::EStorageAllContactRemoved; | |||
681 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
682 | STIF_ASSERT_NOT_NULL(procArray); | |||
683 | ||||
684 | eventType = TVIMPSTEnums::EStorageContactFetchComplete; | |||
685 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
686 | STIF_ASSERT_NOT_NULL(procArray); | |||
687 | ||||
688 | eventType = TVIMPSTEnums::EStorageEventOwnUserChanged; | |||
689 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
690 | STIF_ASSERT_NOT_NULL(procArray); | |||
691 | ||||
692 | eventType = TVIMPSTEnums::EStorageEventUserIdPostChange; | |||
693 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
694 | STIF_ASSERT_NOT_NULL(procArray); | |||
695 | ||||
696 | eventType = TVIMPSTEnums::EStorageContactReadComplete; | |||
697 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
698 | STIF_ASSERT_NOT_NULL(procArray); | |||
699 | ||||
700 | eventType = TVIMPSTEnums::EStorageContactReading; | |||
701 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
702 | STIF_ASSERT_NOT_NULL(procArray); | |||
703 | ||||
704 | eventType = TVIMPSTEnums::EStorageContactFetching; | |||
705 | procArray->HandleStorageChangeL(eventType,&contactlist,&contact,ETrue); | |||
706 | STIF_ASSERT_NOT_NULL(procArray); | |||
707 | } | |||
708 | #endif | |||
709 | /** | |||
710 | * END OF TEST CASES SECTION | |||
711 | */ | |||
***TER 100% (0/0) of SOURCE FILE t_vimpstcmdprocess_processarray_utest.cpp |