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_logviewfail2"));
22 const TLogContactItemId KTestContact = 0x123;
23 _LIT(KTestStatus, "Test Status Text");
26 @SYMTestCaseID SYSLIB-LOGENG-CT-0971
27 @SYMTestCaseDesc Tests for CLogViewEvent::SetFilterL() function
29 @SYMTestActions Create a log filter and set the filter on logview.Check for equality of events on the view and events
30 added.Check for file failure error
31 @SYMTestExpectedResults Test must not fail
34 LOCAL_C void TestEventViewSetupWithFileFailL(CLogClient& aClient)
36 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0971 "));
37 CTestActive* active = new(ELeave)CTestActive;
38 CleanupStack::PushL(active);
40 CLogEvent* event = CLogEvent::NewL();
41 CleanupStack::PushL(event);
42 event->SetEventType(KLogCallEventTypeUid);
43 event->SetStatus(KTestStatus);
46 aClient.AddEvent(*event, active->iStatus);
48 CActiveScheduler::Start();
49 TEST2(active->iStatus.Int(), KErrNone);
51 CLogViewEvent* view = CLogViewEvent::NewL(aClient);
52 CleanupStack::PushL(view);
54 CLogFilterList* list = new(ELeave)CLogFilterList;
55 CleanupStack::PushL(list);
57 CLogFilter* filter = CLogFilter::NewL();
58 CleanupStack::PushL(filter);
59 filter->SetStatus(KTestStatus);
63 TBool finished = EFalse;
68 TheTest.Printf(_L("%d \r"), failCount);
69 __FILE_FAILNEXT(KErrNoMemory, failCount++);
71 TBool result = EFalse;
72 TRAP(error, result = view->SetFilterL(*filter, active->iStatus));
74 if (error == KErrNone)
79 CActiveScheduler::Start();
81 if (active->iStatus.Int() == KErrNone)
85 TEST(view->CountL() >= 1);
86 TEST(TestUtils::EventsEqual(*event, view->Event()));
90 if(active->iStatus.Int() != KErrNoMemory)
92 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
94 TEST2(active->iStatus.Int(), KErrNoMemory);
99 if(error != KErrNoMemory)
101 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
103 TEST2(error, KErrNoMemory);
108 TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount);
110 list->AppendL(filter);
111 CleanupStack::Pop(); // filter
113 filter = CLogFilter::NewL();
114 CleanupStack::PushL(filter);
115 filter->SetEventType(KLogCallEventTypeUid);
116 list->AppendL(filter);
117 CleanupStack::Pop(); // filter
124 TheTest.Printf(_L("%d \r"), failCount);
125 __FILE_FAILNEXT(KErrNoMemory, failCount++);
127 TBool result = EFalse;
128 TRAP(error, result = view->SetFilterL(*list, active->iStatus));
130 if (error == KErrNone)
135 CActiveScheduler::Start();
137 if (active->iStatus.Int() == KErrNone)
141 TEST(view->CountL() >= 1);
142 TEST(TestUtils::EventsEqual(*event, view->Event()));
146 if(active->iStatus.Int() != KErrNoMemory)
148 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
150 TEST2(active->iStatus.Int(), KErrNoMemory);
155 if(error != KErrNoMemory)
157 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
159 TEST2(error, KErrNoMemory);
165 list->ResetAndDestroy();
166 CleanupStack::PopAndDestroy(4); // list, view, event, active
168 TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount);
172 @SYMTestCaseID SYSLIB-LOGENG-CT-0972
173 @SYMTestCaseDesc Tests CLogViewRecent::SetRecentListL() function
174 @SYMTestPriority High
175 @SYMTestActions Set recent view list first without a filter and later with log filter,check for file failure error
176 @SYMTestExpectedResults Test must not fail
179 LOCAL_C void TestRecentViewSetupWithFileFailL(CLogClient& aClient)
181 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0972 "));
182 CTestActive* active = new(ELeave)CTestActive;
183 CleanupStack::PushL(active);
185 CLogEvent* event = CLogEvent::NewL();
186 CleanupStack::PushL(event);
190 aClient.GetString(buf, R_LOG_DIR_IN);
192 event->SetEventType(KLogCallEventTypeUid);
193 event->SetDirection(buf);
194 event->SetStatus(KTestStatus);
197 aClient.AddEvent(*event, active->iStatus);
199 CActiveScheduler::Start();
200 TEST2(active->iStatus.Int(), KErrNone);
202 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
203 CleanupStack::PushL(view);
206 TBool finished = EFalse;
211 TheTest.Printf(_L("%d \r"), failCount);
212 __FILE_FAILNEXT(KErrNoMemory, failCount++);
214 TBool result = EFalse;
215 TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
217 if (error == KErrNone)
222 CActiveScheduler::Start();
224 if (active->iStatus.Int() == KErrNone)
227 TEST(view->CountL() >= 1);
231 if(active->iStatus.Int() != KErrNoMemory)
233 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
235 TEST2(active->iStatus.Int(), KErrNoMemory);
240 if(error != KErrNoMemory)
242 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
244 TEST2(error, KErrNoMemory);
249 TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount);
251 CLogFilterList* list = new(ELeave)CLogFilterList;
252 CleanupStack::PushL(list);
254 CLogFilter* filter = CLogFilter::NewL();
255 CleanupStack::PushL(filter);
256 filter->SetStatus(KTestStatus);
263 TheTest.Printf(_L("%d \r"), failCount);
264 __FILE_FAILNEXT(KErrNoMemory, failCount++);
266 TBool result = EFalse;
267 TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
269 if (error == KErrNone)
274 CActiveScheduler::Start();
276 if (active->iStatus.Int() == KErrNone)
279 TEST(view->CountL() >= 1);
283 if(active->iStatus.Int() != KErrNoMemory)
285 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
287 TEST2(active->iStatus.Int(), KErrNoMemory);
292 if(error != KErrNoMemory)
294 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
296 TEST2(error, KErrNoMemory);
301 TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount);
303 list->AppendL(filter);
304 CleanupStack::Pop(); // filter
306 filter = CLogFilter::NewL();
307 CleanupStack::PushL(filter);
308 filter->SetEventType(KLogCallEventTypeUid);
309 list->AppendL(filter);
310 CleanupStack::Pop(); // filter
317 TheTest.Printf(_L("%d \r"), failCount);
318 __FILE_FAILNEXT(KErrNoMemory, failCount++);
320 TBool result = EFalse;
321 TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
323 if (error == KErrNone)
328 CActiveScheduler::Start();
330 if (active->iStatus.Int() == KErrNone)
333 TEST(view->CountL() >= 1);
337 if(active->iStatus.Int() != KErrNoMemory)
339 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
341 TEST2(active->iStatus.Int(), KErrNoMemory);
346 if(error != KErrNoMemory)
348 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
350 TEST2(error, KErrNoMemory);
356 list->ResetAndDestroy();
357 CleanupStack::PopAndDestroy(4); // list, view, event, active
359 TheTest.Printf(_L("\r\nTest-3 has succeeded at iteration %d\n"), failCount);
363 @SYMTestCaseID SYSLIB-LOGENG-CT-0973
364 @SYMTestCaseDesc Tests for CLogViewRecent::DuplicatesL() function
365 @SYMTestPriority High
366 @SYMTestActions Set the specified duplicate event view with logview duplicates.
367 Check for file failure errors
368 @SYMTestExpectedResults Test must not fail
371 LOCAL_C void TestDuplicateViewSetupWithFileFailL(CLogClient& aClient)
373 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0973 "));
374 CTestActive* active = new(ELeave)CTestActive;
375 CleanupStack::PushL(active);
377 CLogEvent* event = CLogEvent::NewL();
378 CleanupStack::PushL(event);
382 aClient.GetString(buf, R_LOG_DIR_IN);
384 event->SetEventType(KLogCallEventTypeUid);
385 event->SetDirection(buf);
386 event->SetContact(KTestContact);
387 event->SetStatus(KTestStatus);
390 aClient.AddEvent(*event, active->iStatus);
392 CActiveScheduler::Start();
393 TEST2(active->iStatus.Int(), KErrNone);
395 aClient.AddEvent(*event, active->iStatus);
397 CActiveScheduler::Start();
398 TEST2(active->iStatus.Int(), KErrNone);
400 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
401 CleanupStack::PushL(view);
403 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
405 CActiveScheduler::Start();
406 TEST2(active->iStatus.Int(), KErrNone);
408 CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
409 CleanupStack::PushL(duplicate);
412 TBool finished = EFalse;
417 TheTest.Printf(_L("%d \r"), failCount);
418 __FILE_FAILNEXT(KErrNoMemory, failCount++);
420 TBool result = EFalse;
421 TRAP(error, result = view->DuplicatesL(*duplicate, active->iStatus));
423 if (error == KErrNone)
428 CActiveScheduler::Start();
430 if (active->iStatus.Int() == KErrNone)
433 TEST(duplicate->CountL() >= 1);
437 if(active->iStatus.Int() != KErrNoMemory)
439 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
441 TEST2(active->iStatus.Int(), KErrNoMemory);
446 if(error != KErrNoMemory)
448 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
450 TEST2(error, KErrNoMemory);
455 TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount);
457 CLogFilterList* list = new(ELeave)CLogFilterList;
458 CleanupStack::PushL(list);
460 CLogFilter* filter = CLogFilter::NewL();
461 CleanupStack::PushL(filter);
462 filter->SetStatus(KTestStatus);
469 TheTest.Printf(_L("%d \r"), failCount);
470 __FILE_FAILNEXT(KErrNoMemory, failCount++);
472 TBool result = EFalse;
473 TRAP(error, result = view->DuplicatesL(*duplicate, *filter, active->iStatus));
475 if (error == KErrNone)
480 CActiveScheduler::Start();
482 if (active->iStatus.Int() == KErrNone)
485 TEST(duplicate->CountL() >= 1);
489 if(active->iStatus.Int() != KErrNoMemory)
491 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
493 TEST2(active->iStatus.Int(), KErrNoMemory);
498 if(error != KErrNoMemory)
500 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
502 TEST2(error, KErrNoMemory);
507 TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount);
509 list->AppendL(filter);
510 CleanupStack::Pop(); // filter
512 filter = CLogFilter::NewL();
513 CleanupStack::PushL(filter);
514 filter->SetEventType(KLogCallEventTypeUid);
515 list->AppendL(filter);
516 CleanupStack::Pop(); // filter
523 TheTest.Printf(_L("%d \r"), failCount);
524 __FILE_FAILNEXT(KErrNoMemory, failCount++);
526 TBool result = EFalse;
527 TRAP(error, result = view->DuplicatesL(*duplicate, *list, active->iStatus));
529 if (error == KErrNone)
534 CActiveScheduler::Start();
536 if (active->iStatus.Int() == KErrNone)
539 TEST(duplicate->CountL() >= 1);
543 if(active->iStatus.Int() != KErrNoMemory)
545 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
547 TEST2(active->iStatus.Int(), KErrNoMemory);
552 if(error != KErrNoMemory)
554 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
556 TEST2(error, KErrNoMemory);
562 list->ResetAndDestroy();
563 CleanupStack::PopAndDestroy(5); // list, duplicate, view, event, active
565 TheTest.Printf(_L("\r\nTest-3 has succeeded at iteration %d\n"), failCount);
569 @SYMTestCaseID SYSLIB-LOGENG-CT-0974
570 @SYMTestCaseDesc Tests for CLogViewEvent::NextL(),CLogViewEvent::LastL(),CLogViewEvent::PreviousL(),
571 CLogViewEvent::FirstL() functions
572 @SYMTestPriority High
573 @SYMTestActions Tests for all the navigation functions in the view.Check for file failure error
574 @SYMTestExpectedResults Test must not fail
577 LOCAL_C void TestNavigationWithFileFailL(CLogClient& aClient)
579 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0974 "));
580 CTestActive* active = new(ELeave)CTestActive;
581 CleanupStack::PushL(active);
583 CLogEvent* event = CLogEvent::NewL();
584 CleanupStack::PushL(event);
585 event->SetEventType(KLogCallEventTypeUid);
588 aClient.AddEvent(*event, active->iStatus);
590 CActiveScheduler::Start();
591 TEST2(active->iStatus.Int(), KErrNone);
593 CLogViewEvent* view = CLogViewEvent::NewL(aClient);
594 CleanupStack::PushL(view);
596 CLogFilter* filter = CLogFilter::NewL();
597 CleanupStack::PushL(filter);
600 TBool finished = EFalse;
605 TEST(view->SetFilterL(*filter, active->iStatus));
607 CActiveScheduler::Start();
608 TEST2(active->iStatus.Int(), KErrNone);
609 TEST(view->CountL() > 1);
610 event->CopyL(view->Event());
612 TheTest.Printf(_L("%d \r"), failCount);
613 __FILE_FAILNEXT(KErrNoMemory, failCount++);
615 TBool result = EFalse;
616 TRAP(error, result = view->NextL(active->iStatus));
618 if (error == KErrNone)
623 CActiveScheduler::Start();
625 if (active->iStatus.Int() == KErrNone)
628 TEST(!TestUtils::EventsEqual(*event, view->Event()));
632 if(active->iStatus.Int() != KErrNoMemory)
634 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
636 TEST2(active->iStatus.Int(), KErrNoMemory);
641 if(error != KErrNoMemory)
643 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
645 TEST2(error, KErrNoMemory);
650 TheTest.Printf(_L("\r\nTest-1 (\"View Next\") has succeeded at iteration %d\n"), failCount);
657 TEST(view->SetFilterL(*filter, active->iStatus));
659 CActiveScheduler::Start();
660 TEST2(active->iStatus.Int(), KErrNone);
661 TEST(view->CountL() > 1);
663 TEST(view->LastL(active->iStatus));
665 CActiveScheduler::Start();
666 TEST2(active->iStatus.Int(), KErrNone);
668 event->CopyL(view->Event());
670 TheTest.Printf(_L("%d \r"), failCount);
671 __FILE_FAILNEXT(KErrNoMemory, failCount++);
673 TBool result = EFalse;
674 TRAP(error, result = view->PreviousL(active->iStatus));
676 if (error == KErrNone)
681 CActiveScheduler::Start();
683 if (active->iStatus.Int() == KErrNone)
686 TEST(!TestUtils::EventsEqual(*event, view->Event()));
690 if(active->iStatus.Int() != KErrNoMemory)
692 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
694 TEST2(active->iStatus.Int(), KErrNoMemory);
699 if(error != KErrNoMemory)
701 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
703 TEST2(error, KErrNoMemory);
708 TheTest.Printf(_L("\r\nTest-2 (\"View Previous\") has succeeded at iteration %d\n"), failCount);
715 TEST(view->SetFilterL(*filter, active->iStatus));
717 CActiveScheduler::Start();
718 TEST2(active->iStatus.Int(), KErrNone);
719 TEST(view->CountL() > 1);
721 TEST(view->LastL(active->iStatus));
723 CActiveScheduler::Start();
724 TEST2(active->iStatus.Int(), KErrNone);
726 event->CopyL(view->Event());
728 TheTest.Printf(_L("%d \r"), failCount);
729 __FILE_FAILNEXT(KErrNoMemory, failCount++);
731 TBool result = EFalse;
732 TRAP(error, result = view->FirstL(active->iStatus));
734 if (error == KErrNone)
739 CActiveScheduler::Start();
741 if (active->iStatus.Int() == KErrNone)
744 TEST(!TestUtils::EventsEqual(*event, view->Event()));
748 if(active->iStatus.Int() != KErrNoMemory)
750 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
752 TEST2(active->iStatus.Int(), KErrNoMemory);
757 if(error != KErrNoMemory)
759 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
761 TEST2(error, KErrNoMemory);
766 TheTest.Printf(_L("\r\nTest-3 (\"View First\") has succeeded at iteration %d\n"), failCount);
773 TEST(view->SetFilterL(*filter, active->iStatus));
775 CActiveScheduler::Start();
776 TEST2(active->iStatus.Int(), KErrNone);
777 TEST(view->CountL() > 1);
779 TEST(view->FirstL(active->iStatus));
781 CActiveScheduler::Start();
782 TEST2(active->iStatus.Int(), KErrNone);
784 event->CopyL(view->Event());
786 TheTest.Printf(_L("%d \r"), failCount);
787 __FILE_FAILNEXT(KErrNoMemory, failCount++);
789 TBool result = EFalse;
790 TRAP(error, result = view->LastL(active->iStatus));
792 if (error == KErrNone)
797 CActiveScheduler::Start();
799 if (active->iStatus.Int() == KErrNone)
802 TEST(!TestUtils::EventsEqual(*event, view->Event()));
806 if(active->iStatus.Int() != KErrNoMemory)
808 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
810 TEST2(active->iStatus.Int(), KErrNoMemory);
815 if(error != KErrNoMemory)
817 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
819 TEST2(error, KErrNoMemory);
825 CleanupStack::PopAndDestroy(4); // filter, view, event, active
827 TheTest.Printf(_L("\r\nTest-4 (\"View Last\") has succeeded at iteration %d\n"), failCount);
831 @SYMTestCaseID SYSLIB-LOGENG-CT-0975
832 @SYMTestCaseDesc Tests for CLogViewEvent::CountL() functions
833 @SYMTestPriority High
834 @SYMTestActions Test for getting the number of events in the view.Check for file failure error
835 @SYMTestExpectedResults Test must not fail
838 LOCAL_C void TestViewCountWithFileFailL(CLogClient& aClient)
840 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0975 "));
841 CTestActive* active = new(ELeave)CTestActive;
842 CleanupStack::PushL(active);
844 CLogEvent* event = CLogEvent::NewL();
845 CleanupStack::PushL(event);
846 event->SetEventType(KLogCallEventTypeUid);
849 aClient.AddEvent(*event, active->iStatus);
851 CActiveScheduler::Start();
852 TEST2(active->iStatus.Int(), KErrNone);
854 CLogViewEvent* view = CLogViewEvent::NewL(aClient);
855 CleanupStack::PushL(view);
857 CLogFilter* filter = CLogFilter::NewL();
858 CleanupStack::PushL(filter);
860 TEST(view->SetFilterL(*filter, active->iStatus));
862 CActiveScheduler::Start();
863 TEST2(active->iStatus.Int(), KErrNone);
866 TBool finished = EFalse;
871 TheTest.Printf(_L("%d \r"), failCount);
872 __FILE_FAILNEXT(KErrNoMemory, failCount++);
875 TRAP(error, result = view->CountL());
877 if (error == KErrNone)
884 if(error != KErrNoMemory)
886 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
888 TEST2(error, KErrNoMemory);
894 CleanupStack::PopAndDestroy(4); // filter, view, event, active
896 TheTest.Printf(_L("\r\nThe test (\"View Count\") has succeeded at iteration %d\n"), failCount);
900 @SYMTestCaseID SYSLIB-LOGENG-CT-0976
901 @SYMTestCaseDesc Tests for CLogViewRecent::RemoveL() function
902 @SYMTestPriority High
903 @SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for file failure error
904 @SYMTestExpectedResults Test must not fail
907 LOCAL_C void TestRecentViewRemoveWithFileFailL(CLogClient& aClient)
909 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0976 "));
910 CTestActive* active = new(ELeave)CTestActive;
911 CleanupStack::PushL(active);
913 CLogEvent* event = CLogEvent::NewL();
914 CleanupStack::PushL(event);
918 aClient.GetString(buf, R_LOG_DIR_IN);
920 event->SetEventType(KLogCallEventTypeUid);
921 event->SetDirection(buf);
924 event->SetContact(1);
925 aClient.AddEvent(*event, active->iStatus);
927 CActiveScheduler::Start();
928 TEST2(active->iStatus.Int(), KErrNone);
930 event->SetContact(2);
931 aClient.AddEvent(*event, active->iStatus);
933 CActiveScheduler::Start();
934 TEST2(active->iStatus.Int(), KErrNone);
936 event->SetContact(3);
937 aClient.AddEvent(*event, active->iStatus);
939 CActiveScheduler::Start();
940 TEST2(active->iStatus.Int(), KErrNone);
942 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
943 CleanupStack::PushL(view);
945 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
947 CActiveScheduler::Start();
948 TEST2(active->iStatus.Int(), KErrNone);
950 TInt count = view->CountL();
954 TBool finished = EFalse;
959 TheTest.Printf(_L("%d \r"), failCount);
960 __FILE_FAILNEXT(KErrNoMemory, failCount++);
962 TRAP(error, view->RemoveL(view->Event().Id()));
966 if (error == KErrNone)
970 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
972 CActiveScheduler::Start();
973 if(active->iStatus.Int() != KErrNone)
975 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
977 TEST2(active->iStatus.Int(), KErrNone);
979 TEST(count == view->CountL() + 1);
983 if(error != KErrNoMemory)
985 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
987 TEST2(error, KErrNoMemory);
989 // This failCount value causes DBMS to return KErrCorrupt. Apparently this
990 // can't actually occur in real life, so we skip this value.
994 TRAP(error, view->RemoveL(view->Event().Id()));
995 TEST2(error, KErrNone);
998 CleanupStack::PopAndDestroy(3); // view, event, active
1000 TheTest.Printf(_L("\r\nThe test (\"View Remove\") has succeeded at iteration %d\n"), failCount);
1004 @SYMTestCaseID SYSLIB-LOGENG-CT-0977
1005 @SYMTestCaseDesc Tests for CLogViewDuplicate::RemoveL() function
1006 @SYMTestPriority High
1007 @SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for file failure error
1008 @SYMTestExpectedResults Test must not fail
1011 LOCAL_C void TestDuplicateViewRemoveWithFileFailL(CLogClient& aClient)
1013 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0977 "));
1014 CTestActive* active = new(ELeave)CTestActive;
1015 CleanupStack::PushL(active);
1017 CLogEvent* event = CLogEvent::NewL();
1018 CleanupStack::PushL(event);
1022 aClient.GetString(buf, R_LOG_DIR_IN);
1024 event->SetEventType(KLogCallEventTypeUid);
1025 event->SetDirection(buf);
1026 event->SetContact(KTestContact);
1029 aClient.AddEvent(*event, active->iStatus);
1031 CActiveScheduler::Start();
1032 TEST2(active->iStatus.Int(), KErrNone);
1034 aClient.AddEvent(*event, active->iStatus);
1036 CActiveScheduler::Start();
1037 TEST2(active->iStatus.Int(), KErrNone);
1039 aClient.AddEvent(*event, active->iStatus);
1041 CActiveScheduler::Start();
1042 TEST2(active->iStatus.Int(), KErrNone);
1044 aClient.AddEvent(*event, active->iStatus);
1046 CActiveScheduler::Start();
1047 TEST2(active->iStatus.Int(), KErrNone);
1049 CLogViewRecent* view = CLogViewRecent::NewL(aClient);
1050 CleanupStack::PushL(view);
1052 TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1054 CActiveScheduler::Start();
1055 TEST2(active->iStatus.Int(), KErrNone);
1057 CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
1058 CleanupStack::PushL(duplicate);
1060 TEST(view->DuplicatesL(*duplicate, active->iStatus));
1062 CActiveScheduler::Start();
1063 TEST2(active->iStatus.Int(), KErrNone);
1065 TInt count = duplicate->CountL();
1069 TBool finished = EFalse;
1074 TheTest.Printf(_L("%d \r"), failCount);
1075 __FILE_FAILNEXT(KErrNoMemory, failCount++);
1083 TRAP(error, duplicate->RemoveL(duplicate->Event().Id()));
1087 if (error == KErrNone)
1091 TEST(view->DuplicatesL(*duplicate, active->iStatus));
1093 CActiveScheduler::Start();
1094 if(active->iStatus.Int() != KErrNone)
1096 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1098 TEST2(active->iStatus.Int(), KErrNone);
1100 TEST(count == duplicate->CountL() + 1);
1104 if(error != KErrNoMemory)
1106 TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1108 TEST2(error, KErrNoMemory);
1111 CleanupStack::PopAndDestroy(4); // duplicate, view, event, active
1113 TheTest.Printf(_L("\r\nThe test (\"View Remove Duplicates\") has succeeded at iteration %d\n"), failCount);
1118 TestUtils::Initialize(_L("t_logviewfail2"));
1119 TestUtils::DeleteDatabaseL();
1121 CLogClient* client = CLogClient::NewL(theFs);
1122 CleanupStack::PushL(client);
1124 TheTest.Start(_L("Event View Setup"));
1125 TestEventViewSetupWithFileFailL(*client);
1126 TheTest.Next(_L("Recent View Setup"));
1127 TestRecentViewSetupWithFileFailL(*client);
1128 TheTest.Next(_L("Duplicated View Setup"));
1129 TestDuplicateViewSetupWithFileFailL(*client);
1130 theLog.Write(_L8("Test 1 OK\n"));
1132 TheTest.Next(_L("View Navigation"));
1133 TestNavigationWithFileFailL(*client);
1134 theLog.Write(_L8("Test 2 OK\n"));
1136 TheTest.Next(_L("View Count"));
1137 TestViewCountWithFileFailL(*client);
1138 TheTest.Next(_L("View Remove"));
1139 TestRecentViewRemoveWithFileFailL(*client);
1140 TheTest.Next(_L("View Remove Duplicates"));
1141 TestDuplicateViewRemoveWithFileFailL(*client);
1142 theLog.Write(_L8("Test 3 OK\n"));
1144 CleanupStack::PopAndDestroy(); // client;