Update contrib.
1 // Copyright (c) 2002-2010 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "t_logutil2.h"
20 RTest TheTest(_L("t_logviewfail"));
22 const TLogContactItemId KTestContact = 0x123;
23 _LIT(KTestStatus, "Test Status Text");
27 @SYMTestCaseID SYSLIB-LOGENG-CT-0961-0001
28 @SYMTestCaseDesc Tests for CLogViewEvent::NewL() function
30 @SYMTestActions Add an event to the client,Create a new CLogViewEvent on heap,if no error check if the view works
31 Check for memory errors
32 @SYMTestExpectedResults Test must not fail
35 LOCAL_C void TestEventViewConstructWithHeapFailL(CLogClient& aClient)
37 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0961-0001 "));
38 CTestActive* active = new(ELeave)CTestActive;
39 CleanupStack::PushL(active);
41 CLogEvent* event = CLogEvent::NewL();
42 CleanupStack::PushL(event);
43 event->SetEventType(KLogCallEventTypeUid);
46 aClient.AddEvent(*event, active->iStatus);
48 CActiveScheduler::Start();
49 TEST2(active->iStatus.Int(), KErrNone);
51 CLogViewEvent* view = NULL;
56 TBool finished = EFalse;
61 __UHEAP_FAILNEXT(failCount++);
63 TRAP(error, view = CLogViewEvent::NewL(aClient));
70 CleanupStack::PushL(view);
72 // Check the view works
73 CLogFilter* filter = CLogFilter::NewL();
74 CleanupStack::PushL(filter);
76 TEST(view->SetFilterL(*filter, active->iStatus));
78 CActiveScheduler::Start();
79 TEST2(active->iStatus.Int(), KErrNone);
80 TEST(view->CountL() >= 1);
81 TEST(TestUtils::EventsEqual(*event, view->Event()));
83 CleanupStack::PopAndDestroy(2); // filter, view
86 TEST2(error, KErrNoMemory);
89 CleanupStack::PopAndDestroy(2); // event, active
93 @SYMTestCaseID SYSLIB-LOGENG-CT-0962-0001
94 @SYMTestCaseDesc Tests for CLogViewRecent::NewL(),CLogViewRecent::SetRecentListL() functions
96 @SYMTestActions Create a new view object,if no errors and test of initialising of the view for the specified recent event list.
97 Check for no memory errors.
98 @SYMTestExpectedResults Test must not fail
101 LOCAL_C void TestRecentViewConstructWithHeapFailL(CLogClient& aClient)
103 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0962-0001 "));
104 CTestActive* active = new(ELeave)CTestActive;
105 CleanupStack::PushL(active);
107 CLogEvent* event = CLogEvent::NewL();
108 CleanupStack::PushL(event);
112 aClient.GetString(buf, R_LOG_DIR_IN);
114 event->SetEventType(KLogCallEventTypeUid);
115 event->SetDirection(buf);
118 aClient.AddEvent(*event, active->iStatus);
120 CActiveScheduler::Start();
121 TEST2(active->iStatus.Int(), KErrNone);
123 CLogViewRecent* view = NULL;
129 TBool finished = EFalse;
134 __UHEAP_FAILNEXT(failCount++);
136 TRAP(error, view = CLogViewRecent::NewL(aClient));
143 CleanupStack::PushL(view);
145 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
147 CActiveScheduler::Start();
148 TEST2(active->iStatus.Int(), KErrNone);
149 TEST(view->CountL() >= 1);
150 TEST(TestUtils::EventsEqual(*event, view->Event()));
152 CleanupStack::PopAndDestroy(); // view
155 TEST2(error, KErrNoMemory);
158 CleanupStack::PopAndDestroy(2); // event, active
162 @SYMTestCaseID SYSLIB-LOGENG-CT-0963-0001
163 @SYMTestCaseDesc Tests for CLogViewDuplicate::NewL() functions
164 @SYMTestPriority High
165 @SYMTestActions Create a new logviewrecent object,set the recent log view,
166 List out the duplicates of the current event in the recent event list view,
167 Check for no memory errors.
168 @SYMTestExpectedResults Test must not fail
171 LOCAL_C void TestDuplicateViewConstructWithHeapFailL(CLogClient& aClient)
173 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0963-0001 "));
174 CTestActive* active = new(ELeave)CTestActive;
175 CleanupStack::PushL(active);
177 CLogEvent* event = CLogEvent::NewL();
178 CleanupStack::PushL(event);
182 aClient.GetString(buf, R_LOG_DIR_IN);
184 event->SetEventType(KLogCallEventTypeUid);
185 event->SetDirection(buf);
186 event->SetContact(KTestContact);
189 aClient.AddEvent(*event, active->iStatus);
191 CActiveScheduler::Start();
192 TEST2(active->iStatus.Int(), KErrNone);
194 aClient.AddEvent(*event, active->iStatus);
196 CActiveScheduler::Start();
197 TEST2(active->iStatus.Int(), KErrNone);
199 CLogViewDuplicate* view = NULL;
205 TBool finished = EFalse;
210 __UHEAP_FAILNEXT(failCount++);
212 TRAP(error, view = CLogViewDuplicate::NewL(aClient));
219 CleanupStack::PushL(view);
221 CLogViewRecent* recent = CLogViewRecent::NewL(aClient);
222 CleanupStack::PushL(recent);
223 TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
225 CActiveScheduler::Start();
226 TEST2(active->iStatus.Int(), KErrNone);
227 TEST(recent->CountL() >= 1);
229 TEST(recent->DuplicatesL(*view, active->iStatus));
231 CActiveScheduler::Start();
232 TEST2(active->iStatus.Int(), KErrNone);
233 TEST(view->CountL() >= 1);
235 CleanupStack::PopAndDestroy(2); // recent, view
238 TEST2(error, KErrNoMemory);
241 CleanupStack::PopAndDestroy(2); // event, active
245 @SYMTestCaseID SYSLIB-LOGENG-CT-0964-0001
246 @SYMTestCaseDesc Tests for CLogViewEvent::SetFilterL() function
247 @SYMTestPriority High
248 @SYMTestActions Create a log filter and set the filter on logview.Check for equality of events on the view and events
249 added.Check for memory errors.
250 @SYMTestExpectedResults Test must not fail
253 LOCAL_C void TestEventViewSetupWithHeapFailL(CLogClient& aClient)
255 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0964-0001 "));
256 CTestActive* active = new(ELeave)CTestActive;
257 CleanupStack::PushL(active);
259 CLogEvent* event = CLogEvent::NewL();
260 CleanupStack::PushL(event);
261 event->SetEventType(KLogCallEventTypeUid);
262 event->SetStatus(KTestStatus);
265 aClient.AddEvent(*event, active->iStatus);
267 CActiveScheduler::Start();
268 TEST2(active->iStatus.Int(), KErrNone);
270 CLogViewEvent* view = CLogViewEvent::NewL(aClient);
271 CleanupStack::PushL(view);
273 CLogFilterList* list = new(ELeave)CLogFilterList;
274 CleanupStack::PushL(list);
276 CLogFilter* filter = CLogFilter::NewL();
277 CleanupStack::PushL(filter);
278 filter->SetStatus(KTestStatus);
284 TBool finished = EFalse;
289 __UHEAP_FAILNEXT(failCount++);
291 TBool result = EFalse;
292 TRAP(error, result = view->SetFilterL(*filter, active->iStatus));
299 CActiveScheduler::Start();
301 if (active->iStatus.Int() == KErrNone)
305 TEST(view->CountL() >= 1);
306 TEST(TestUtils::EventsEqual(*event, view->Event()));
309 TEST2(active->iStatus.Int(), KErrNoMemory);
312 TEST2(error, KErrNoMemory);
317 list->AppendL(filter);
318 CleanupStack::Pop(); // filter
320 filter = CLogFilter::NewL();
321 CleanupStack::PushL(filter);
322 filter->SetEventType(KLogCallEventTypeUid);
323 list->AppendL(filter);
324 CleanupStack::Pop(); // filter
332 __UHEAP_FAILNEXT(failCount++);
334 TBool result = EFalse;
335 TRAP(error, result = view->SetFilterL(*list, active->iStatus));
342 CActiveScheduler::Start();
344 if (active->iStatus.Int() == KErrNone)
348 TEST(view->CountL() >= 1);
349 TEST(TestUtils::EventsEqual(*event, view->Event()));
352 TEST2(active->iStatus.Int(), KErrNoMemory);
355 TEST2(error, KErrNoMemory);
360 list->ResetAndDestroy();
361 CleanupStack::PopAndDestroy(4); // list, view, event, active
365 @SYMTestCaseID SYSLIB-LOGENG-CT-0965-0001
366 @SYMTestCaseDesc Tests for CLogViewRecent::SetRecentListL() function
367 @SYMTestPriority High
368 @SYMTestActions Set recent view list first without a filter and later with log filter,check for memory errors
369 @SYMTestExpectedResults Test must not fail
372 LOCAL_C void TestRecentViewSetupWithHeapFailL(CLogClient& aClient)
374 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0965-0001 "));
375 CTestActive* active = new(ELeave)CTestActive;
376 CleanupStack::PushL(active);
378 CLogEvent* event = CLogEvent::NewL();
379 CleanupStack::PushL(event);
383 aClient.GetString(buf, R_LOG_DIR_IN);
385 event->SetEventType(KLogCallEventTypeUid);
386 event->SetDirection(buf);
387 event->SetStatus(KTestStatus);
390 aClient.AddEvent(*event, active->iStatus);
392 CActiveScheduler::Start();
393 TEST2(active->iStatus.Int(), KErrNone);
395 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
396 CleanupStack::PushL(view);
402 TBool finished = EFalse;
407 __UHEAP_FAILNEXT(failCount++);
409 TBool result = EFalse;
410 TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
417 CActiveScheduler::Start();
419 if (active->iStatus.Int() == KErrNone)
422 TEST(view->CountL() >= 1);
425 TEST2(active->iStatus.Int(), KErrNoMemory);
428 TEST2(error, KErrNoMemory);
433 CLogFilterList* list = new(ELeave)CLogFilterList;
434 CleanupStack::PushL(list);
436 CLogFilter* filter = CLogFilter::NewL();
437 CleanupStack::PushL(filter);
438 filter->SetStatus(KTestStatus);
447 __UHEAP_FAILNEXT(failCount++);
449 TBool result = EFalse;
450 TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
457 CActiveScheduler::Start();
459 if (active->iStatus.Int() == KErrNone)
462 TEST(view->CountL() >= 1);
465 TEST2(active->iStatus.Int(), KErrNoMemory);
468 TEST2(error, KErrNoMemory);
473 list->AppendL(filter);
474 CleanupStack::Pop(); // filter
476 filter = CLogFilter::NewL();
477 CleanupStack::PushL(filter);
478 filter->SetEventType(KLogCallEventTypeUid);
479 list->AppendL(filter);
480 CleanupStack::Pop(); // filter
489 __UHEAP_FAILNEXT(failCount++);
491 TBool result = EFalse;
492 TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
499 CActiveScheduler::Start();
501 if (active->iStatus.Int() == KErrNone)
504 TEST(view->CountL() >= 1);
507 TEST2(active->iStatus.Int(), KErrNoMemory);
510 TEST2(error, KErrNoMemory);
515 list->ResetAndDestroy();
516 CleanupStack::PopAndDestroy(4); // list, view, event, active
520 @SYMTestCaseID SYSLIB-LOGENG-CT-0966
521 @SYMTestCaseDesc Tests for CLogViewRecent::DuplicatesL() function
522 @SYMTestPriority High
523 @SYMTestActions Set the specified duplicate event view with logview duplicates.
524 Check for memory errors
525 @SYMTestExpectedResults Test must not fail
528 LOCAL_C void TestDuplicateViewSetupWithHeapFailL(CLogClient& aClient)
530 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0966 "));
531 CTestActive* active = new(ELeave)CTestActive;
532 CleanupStack::PushL(active);
534 CLogEvent* event = CLogEvent::NewL();
535 CleanupStack::PushL(event);
539 aClient.GetString(buf, R_LOG_DIR_IN);
541 event->SetEventType(KLogCallEventTypeUid);
542 event->SetDirection(buf);
543 event->SetContact(KTestContact);
544 event->SetStatus(KTestStatus);
547 aClient.AddEvent(*event, active->iStatus);
549 CActiveScheduler::Start();
550 TEST2(active->iStatus.Int(), KErrNone);
552 aClient.AddEvent(*event, active->iStatus);
554 CActiveScheduler::Start();
555 TEST2(active->iStatus.Int(), KErrNone);
557 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
558 CleanupStack::PushL(view);
560 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
562 CActiveScheduler::Start();
563 TEST2(active->iStatus.Int(), KErrNone);
565 CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
566 CleanupStack::PushL(duplicate);
572 TBool finished = EFalse;
577 __UHEAP_FAILNEXT(failCount++);
579 TBool result = EFalse;
580 TRAP(error, result = view->DuplicatesL(*duplicate, active->iStatus));
587 CActiveScheduler::Start();
589 if (active->iStatus.Int() == KErrNone)
592 TEST(duplicate->CountL() >= 1);
595 TEST2(active->iStatus.Int(), KErrNoMemory);
598 TEST2(error, KErrNoMemory);
603 CLogFilterList* list = new(ELeave)CLogFilterList;
604 CleanupStack::PushL(list);
606 CLogFilter* filter = CLogFilter::NewL();
607 CleanupStack::PushL(filter);
608 filter->SetStatus(KTestStatus);
617 __UHEAP_FAILNEXT(failCount++);
619 TBool result = EFalse;
620 TRAP(error, result = view->DuplicatesL(*duplicate, *filter, active->iStatus));
627 CActiveScheduler::Start();
629 if (active->iStatus.Int() == KErrNone)
632 TEST(duplicate->CountL() >= 1);
635 TEST2(active->iStatus.Int(), KErrNoMemory);
638 TEST2(error, KErrNoMemory);
643 list->AppendL(filter);
644 CleanupStack::Pop(); // filter
646 filter = CLogFilter::NewL();
647 CleanupStack::PushL(filter);
648 filter->SetEventType(KLogCallEventTypeUid);
649 list->AppendL(filter);
650 CleanupStack::Pop(); // filter
659 __UHEAP_FAILNEXT(failCount++);
661 TBool result = EFalse;
662 TRAP(error, result = view->DuplicatesL(*duplicate, *list, active->iStatus));
669 CActiveScheduler::Start();
671 if (active->iStatus.Int() == KErrNone)
674 TEST(duplicate->CountL() >= 1);
677 TEST2(active->iStatus.Int(), KErrNoMemory);
680 TEST2(error, KErrNoMemory);
685 list->ResetAndDestroy();
686 CleanupStack::PopAndDestroy(5); // list, duplicate, view, event, active
690 @SYMTestCaseID SYSLIB-LOGENG-CT-0967
691 @SYMTestCaseDesc Tests for CLogViewEvent::NextL(),CLogViewEvent::LastL(),CLogViewEvent::PreviousL(),
692 CLogViewEvent::FirstL() functions
693 @SYMTestPriority High
694 @SYMTestActions Tests for all the navigation functions in the view.
695 @SYMTestExpectedResults Test must not fail
698 LOCAL_C void TestNavigationWithHeapFailL(CLogClient& aClient)
700 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0967 "));
701 CTestActive* active = new(ELeave)CTestActive;
702 CleanupStack::PushL(active);
704 CLogEvent* event = CLogEvent::NewL();
705 CleanupStack::PushL(event);
706 event->SetEventType(KLogCallEventTypeUid);
709 aClient.AddEvent(*event, active->iStatus);
711 CActiveScheduler::Start();
712 TEST2(active->iStatus.Int(), KErrNone);
714 CLogViewEvent* view = CLogViewEvent::NewL(aClient);
715 CleanupStack::PushL(view);
717 CLogFilter* filter = CLogFilter::NewL();
718 CleanupStack::PushL(filter);
724 TBool finished = EFalse;
729 TEST(view->SetFilterL(*filter, active->iStatus));
731 CActiveScheduler::Start();
732 TEST2(active->iStatus.Int(), KErrNone);
733 TEST(view->CountL() > 1);
734 event->CopyL(view->Event());
736 __UHEAP_FAILNEXT(failCount++);
738 TBool result = EFalse;
739 TRAP(error, result = view->NextL(active->iStatus));
746 CActiveScheduler::Start();
748 if (active->iStatus.Int() == KErrNone)
751 TEST(!TestUtils::EventsEqual(*event, view->Event()));
754 TEST2(active->iStatus.Int(), KErrNoMemory);
757 TEST2(error, KErrNoMemory);
769 TEST(view->SetFilterL(*filter, active->iStatus));
771 CActiveScheduler::Start();
772 TEST2(active->iStatus.Int(), KErrNone);
773 TEST(view->CountL() > 1);
775 TEST(view->LastL(active->iStatus));
777 CActiveScheduler::Start();
778 TEST2(active->iStatus.Int(), KErrNone);
780 event->CopyL(view->Event());
782 __UHEAP_FAILNEXT(failCount++);
784 TBool result = EFalse;
785 TRAP(error, result = view->PreviousL(active->iStatus));
792 CActiveScheduler::Start();
794 if (active->iStatus.Int() == KErrNone)
797 TEST(!TestUtils::EventsEqual(*event, view->Event()));
800 TEST2(active->iStatus.Int(), KErrNoMemory);
803 TEST2(error, KErrNoMemory);
815 TEST(view->SetFilterL(*filter, active->iStatus));
817 CActiveScheduler::Start();
818 TEST2(active->iStatus.Int(), KErrNone);
819 TEST(view->CountL() > 1);
821 TEST(view->LastL(active->iStatus));
823 CActiveScheduler::Start();
824 TEST2(active->iStatus.Int(), KErrNone);
826 event->CopyL(view->Event());
828 __UHEAP_FAILNEXT(failCount++);
830 TBool result = EFalse;
831 TRAP(error, result = view->FirstL(active->iStatus));
838 CActiveScheduler::Start();
840 if (active->iStatus.Int() == KErrNone)
843 TEST(!TestUtils::EventsEqual(*event, view->Event()));
846 TEST2(active->iStatus.Int(), KErrNoMemory);
849 TEST2(error, KErrNoMemory);
861 TEST(view->SetFilterL(*filter, active->iStatus));
863 CActiveScheduler::Start();
864 TEST2(active->iStatus.Int(), KErrNone);
865 TEST(view->CountL() > 1);
867 TEST(view->FirstL(active->iStatus));
869 CActiveScheduler::Start();
870 TEST2(active->iStatus.Int(), KErrNone);
872 event->CopyL(view->Event());
874 __UHEAP_FAILNEXT(failCount++);
876 TBool result = EFalse;
877 TRAP(error, result = view->LastL(active->iStatus));
884 CActiveScheduler::Start();
886 if (active->iStatus.Int() == KErrNone)
889 TEST(!TestUtils::EventsEqual(*event, view->Event()));
892 TEST2(active->iStatus.Int(), KErrNoMemory);
895 TEST2(error, KErrNoMemory);
900 CleanupStack::PopAndDestroy(4); // filter, view, event, active
904 @SYMTestCaseID SYSLIB-LOGENG-CT-0968
905 @SYMTestCaseDesc Tests for CLogViewEvent::CountL() function
906 @SYMTestPriority High
907 @SYMTestActions Test for getting the number of events in the view.Check for memory errors
908 @SYMTestExpectedResults Test must not fail
911 LOCAL_C void TestViewCountWithHeapFailL(CLogClient& aClient)
913 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0968 "));
914 CTestActive* active = new(ELeave)CTestActive;
915 CleanupStack::PushL(active);
917 CLogEvent* event = CLogEvent::NewL();
918 CleanupStack::PushL(event);
919 event->SetEventType(KLogCallEventTypeUid);
922 aClient.AddEvent(*event, active->iStatus);
924 CActiveScheduler::Start();
925 TEST2(active->iStatus.Int(), KErrNone);
927 CLogViewEvent* view = CLogViewEvent::NewL(aClient);
928 CleanupStack::PushL(view);
930 CLogFilter* filter = CLogFilter::NewL();
931 CleanupStack::PushL(filter);
933 TEST(view->SetFilterL(*filter, active->iStatus));
935 CActiveScheduler::Start();
936 TEST2(active->iStatus.Int(), KErrNone);
942 TBool finished = EFalse;
947 __UHEAP_FAILNEXT(failCount++);
950 TRAP(error, result = view->CountL());
958 TEST2(error, KErrNoMemory);
963 CleanupStack::PopAndDestroy(4); // filter, view, event, active
967 @SYMTestCaseID SYSLIB-LOGENG-CT-0969
968 @SYMTestCaseDesc Tests for CLogViewRecent::RemoveL() function
969 @SYMTestPriority High
970 @SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for memory error
971 @SYMTestExpectedResults Test must not fail
974 LOCAL_C void TestRecentViewRemoveWithHeapFailL(CLogClient& aClient)
976 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0969 "));
977 CTestActive* active = new(ELeave)CTestActive;
978 CleanupStack::PushL(active);
980 CLogEvent* event = CLogEvent::NewL();
981 CleanupStack::PushL(event);
985 aClient.GetString(buf, R_LOG_DIR_IN);
987 event->SetEventType(KLogCallEventTypeUid);
988 event->SetDirection(buf);
989 event->SetContact(1);
992 aClient.AddEvent(*event, active->iStatus);
994 CActiveScheduler::Start();
995 TEST2(active->iStatus.Int(), KErrNone);
997 event->SetContact(2);
999 aClient.AddEvent(*event, active->iStatus);
1001 CActiveScheduler::Start();
1002 TEST2(active->iStatus.Int(), KErrNone);
1004 event->SetContact(3);
1006 aClient.AddEvent(*event, active->iStatus);
1008 CActiveScheduler::Start();
1009 TEST2(active->iStatus.Int(), KErrNone);
1011 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
1012 CleanupStack::PushL(view);
1014 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1016 CActiveScheduler::Start();
1017 TEST2(active->iStatus.Int(), KErrNone);
1019 TInt count = view->CountL();
1026 TBool finished = EFalse;
1031 __UHEAP_FAILNEXT(failCount++);
1033 TRAP(error, view->RemoveL(view->Event().Id()));
1041 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1043 CActiveScheduler::Start();
1044 TEST2(active->iStatus.Int(), KErrNone);
1046 TEST(count == view->CountL() + 1);
1049 TEST2(error, KErrNoMemory);
1059 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1061 CActiveScheduler::Start();
1062 TEST2(active->iStatus.Int(), KErrNone);
1064 count = view->CountL();
1067 __UHEAP_FAILNEXT(failCount++);
1070 TRAP(error, ret = view->RemoveL(active->iStatus));
1079 CActiveScheduler::Start();
1081 if (active->iStatus == KErrNone)
1083 TEST(count == view->CountL() + 1);
1087 TEST2(active->iStatus.Int(), KErrNoMemory);
1090 TEST2(error, KErrNoMemory);
1093 CleanupStack::PopAndDestroy(3); // view, event, active
1097 @SYMTestCaseID SYSLIB-LOGENG-CT-0970
1098 @SYMTestCaseDesc Tests for CLogViewDuplicate::RemoveL() function
1099 @SYMTestPriority High
1100 @SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for memory error
1101 @SYMTestExpectedResults Test must not fail
1104 LOCAL_C void TestDuplicateViewRemoveWithHeapFailL(CLogClient& aClient)
1106 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0970 "));
1107 CTestActive* active = new(ELeave)CTestActive;
1108 CleanupStack::PushL(active);
1110 CLogEvent* event = CLogEvent::NewL();
1111 CleanupStack::PushL(event);
1115 aClient.GetString(buf, R_LOG_DIR_IN);
1117 event->SetEventType(KLogCallEventTypeUid);
1118 event->SetDirection(buf);
1119 event->SetContact(KTestContact);
1122 aClient.AddEvent(*event, active->iStatus);
1124 CActiveScheduler::Start();
1125 TEST2(active->iStatus.Int(), KErrNone);
1127 aClient.AddEvent(*event, active->iStatus);
1129 CActiveScheduler::Start();
1130 TEST2(active->iStatus.Int(), KErrNone);
1132 aClient.AddEvent(*event, active->iStatus);
1134 CActiveScheduler::Start();
1135 TEST2(active->iStatus.Int(), KErrNone);
1137 aClient.AddEvent(*event, active->iStatus);
1139 CActiveScheduler::Start();
1140 TEST2(active->iStatus.Int(), KErrNone);
1142 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
1143 CleanupStack::PushL(view);
1145 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1147 CActiveScheduler::Start();
1148 TEST2(active->iStatus.Int(), KErrNone);
1150 CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
1151 CleanupStack::PushL(duplicate);
1153 TEST(view->DuplicatesL(*duplicate, active->iStatus));
1155 CActiveScheduler::Start();
1156 TEST2(active->iStatus.Int(), KErrNone);
1158 TInt count = duplicate->CountL();
1165 TBool finished = EFalse;
1170 __UHEAP_FAILNEXT(failCount++);
1172 TRAP(error, duplicate->RemoveL(duplicate->Event().Id()));
1180 TEST(view->DuplicatesL(*duplicate, active->iStatus));
1182 CActiveScheduler::Start();
1183 TEST2(active->iStatus.Int(), KErrNone);
1185 TEST(count == duplicate->CountL() + 1);
1188 TEST2(error, KErrNoMemory);
1198 TEST(view->DuplicatesL(*duplicate, active->iStatus));
1200 CActiveScheduler::Start();
1201 TEST2(active->iStatus.Int(), KErrNone);
1203 count = duplicate->CountL();
1206 __UHEAP_FAILNEXT(failCount++);
1209 TRAP(error, ret = duplicate->RemoveL(active->iStatus));
1218 CActiveScheduler::Start();
1220 if (active->iStatus == KErrNone)
1223 TEST(count == duplicate->CountL() + 1);
1226 TEST2(active->iStatus.Int(), KErrNoMemory);
1229 TEST2(error, KErrNoMemory);
1232 CleanupStack::PopAndDestroy(4); // duplicate, view, event, active
1237 TestUtils::Initialize(_L("t_logviewfail"));
1238 TestUtils::DeleteDatabaseL();
1240 CLogClient* client = CLogClient::NewL(theFs);
1241 CleanupStack::PushL(client);
1243 TheTest.Start(_L("Heap Failure in Client"));
1245 TheTest.Next(_L("View Construction"));
1246 TestEventViewConstructWithHeapFailL(*client);
1247 TestRecentViewConstructWithHeapFailL(*client);
1248 TestDuplicateViewConstructWithHeapFailL(*client);
1249 theLog.Write(_L8("Test 1 OK\n"));
1251 TheTest.Next(_L("View Setup"));
1252 TestEventViewSetupWithHeapFailL(*client);
1253 TestRecentViewSetupWithHeapFailL(*client);
1254 TestDuplicateViewSetupWithHeapFailL(*client);
1255 theLog.Write(_L8("Test 2 OK\n"));
1257 TheTest.Next(_L("View Navigation"));
1258 TestNavigationWithHeapFailL(*client);
1259 theLog.Write(_L8("Test 3 OK\n"));
1261 TheTest.Next(_L("Other"));
1262 TestViewCountWithHeapFailL(*client);
1263 TestRecentViewRemoveWithHeapFailL(*client);
1264 TestDuplicateViewRemoveWithHeapFailL(*client);
1265 theLog.Write(_L8("Test 4 OK\n"));
1267 CleanupStack::PopAndDestroy(); // client;