loggingservices/eventlogger/test/src/t_logview2.cpp
branchRCL_3
changeset 10 31a8f755b7fe
parent 9 667e88a979d7
equal deleted inserted replaced
9:667e88a979d7 10:31a8f755b7fe
  6783 	TEST2(duplicate->CountL(), 5);
  6783 	TEST2(duplicate->CountL(), 5);
  6784 	
  6784 	
  6785 	CleanupStack::PopAndDestroy(4);	
  6785 	CleanupStack::PopAndDestroy(4);	
  6786 }
  6786 }
  6787 
  6787 
       
  6788 /**
       
  6789 @SYMTestCaseID          PDS-LOGENG-CT-4050
       
  6790 @SYMTestCaseDesc        Tests for the changes made in defect DEF144552 
       
  6791 @SYMTestPriority        High
       
  6792 @SYMTestActions         Tests for the sucessful completion of the following operation - 
       
  6793                         1)Applying a filter where the event's start time matches the end time.
       
  6794                         2)Clearing the log where the clear log time is 1 microsecs after the 
       
  6795                         timestamp of the event.
       
  6796 @SYMTestExpectedResults Test must not fail
       
  6797 @SYMREQ                 DEF144552
       
  6798 */
       
  6799 LOCAL_C void DEF144552L(CLogClient& aClient)
       
  6800     {
       
  6801     TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-CT-4050 ")); 
       
  6802     TestUtils::DeleteDatabaseL(EFalse);
       
  6803     
       
  6804     CTestActive* active = new(ELeave)CTestActive();
       
  6805     CleanupStack::PushL(active);
       
  6806 
       
  6807     //Setup the database by adding a event and changing the timestamp for the event
       
  6808     //Add 1 event
       
  6809     CLogEvent* event = CLogEvent::NewL();
       
  6810     CleanupStack::PushL(event);
       
  6811     event->SetEventType(KLogCallEventTypeUid);
       
  6812     event->SetContact(KTestContact1);
       
  6813     event->SetNumber(KTestNumber2);
       
  6814     event->SetDuration(0);
       
  6815     active->StartL();
       
  6816     aClient.AddEvent(*event, active->iStatus);
       
  6817     CActiveScheduler::Start();
       
  6818     TEST2(active->iStatus.Int(), KErrNone);
       
  6819     
       
  6820     //Change the event
       
  6821     TTime now;
       
  6822     now.UniversalTime();
       
  6823     event->SetTime(now);
       
  6824     active->StartL();
       
  6825     aClient.ChangeEvent(*event, active->iStatus);
       
  6826     CActiveScheduler::Start();
       
  6827     TEST2(active->iStatus.Int(), KErrNone);
       
  6828     
       
  6829     //Test 1: Setup and apply a filter where the start time matches the end time
       
  6830     //If the defect is fixed then the view will contain the event previously added,
       
  6831     //Otherwise the time parameters will be truncated and the event will not be found
       
  6832     
       
  6833     //Setup filter so that the start and the end time matches
       
  6834     CLogFilter* filter = CLogFilter::NewL();
       
  6835     CleanupStack::PushL(filter);
       
  6836     filter->SetStartTime(now);
       
  6837     filter->SetEndTime(now);
       
  6838     
       
  6839     //Apply the filter and check that 1 event is in the view
       
  6840     CLogViewEvent* view = CLogViewEvent::NewL(aClient);
       
  6841     CleanupStack::PushL(view);
       
  6842     active->StartL();
       
  6843     TEST(view->SetFilterL(*filter, active->iStatus));
       
  6844     CActiveScheduler::Start();
       
  6845     TEST2(active->iStatus.Int(), KErrNone);
       
  6846     TEST2(view->CountL(), 1);
       
  6847     
       
  6848     //Retrieve and check the event
       
  6849     active->StartL();
       
  6850     TEST(view->FirstL(active->iStatus));
       
  6851     CActiveScheduler::Start();
       
  6852     TEST2(active->iStatus.Int(), KErrNone);
       
  6853     const CLogEvent& currentEvent(view->Event());
       
  6854     TEST2(currentEvent.EventType().iUid, KLogCallEventTypeUid.iUid);
       
  6855     TEST2(currentEvent.Duration(), 0);
       
  6856     TEST2(currentEvent.Time().Int64(), now.Int64());
       
  6857     
       
  6858     // Test 2: Clearing a log where the time specified in ClearLog() is just
       
  6859     // after the timestamp of the event by 1 microsecond. If the defect is fixed
       
  6860     // then the event will be deleted. However if the defect is not fixed then the
       
  6861     // time specified in ClearLog() will be truncated and the event will not be 
       
  6862     // deleted
       
  6863     
       
  6864     //Clear the log
       
  6865     active->StartL();
       
  6866     TTimeIntervalMicroSeconds microsecond(1);
       
  6867     now += microsecond;
       
  6868     aClient.ClearLog(now, active->iStatus);
       
  6869     CActiveScheduler::Start();
       
  6870     TEST2(active->iStatus.Int(), KErrNone);
       
  6871     
       
  6872     //Check that the event has been deleted in the view
       
  6873     CleanupStack::PopAndDestroy(2);
       
  6874     view = CLogViewEvent::NewL(aClient);
       
  6875     CleanupStack::PushL(view);
       
  6876     filter = CLogFilter::NewL();
       
  6877     CleanupStack::PushL(filter);
       
  6878     active->StartL();
       
  6879     TEST(!view->SetFilterL(*filter, active->iStatus));
       
  6880 
       
  6881     CleanupStack::PopAndDestroy(4, active); 
       
  6882     }
       
  6883 
  6788 void doTestsL()
  6884 void doTestsL()
  6789 	{
  6885 	{
  6790 	TestUtils::Initialize(_L("t_logview2"));
  6886 	TestUtils::Initialize(_L("t_logview2"));
  6791 	TestUtils::DeleteDatabaseL();
  6887 	TestUtils::DeleteDatabaseL();
  6792 
  6888 
  6908 	TheTest.Next(_L("Test Defect INC108225: Call history check for the CS & PS(VOIP) calls "));
  7004 	TheTest.Next(_L("Test Defect INC108225: Call history check for the CS & PS(VOIP) calls "));
  6909 	TestNumberFieldINC108225L(*client);
  7005 	TestNumberFieldINC108225L(*client);
  6910 	TestOtherFieldsINC108225L(*client);
  7006 	TestOtherFieldsINC108225L(*client);
  6911 	theLog.Write(_L8("Test 23 OK\n"));
  7007 	theLog.Write(_L8("Test 23 OK\n"));
  6912 
  7008 
       
  7009 	TheTest.Next(_L("Test Defect DEF144552: CLogFilter doesn't work when Starttime is the same as EndTime"));
       
  7010 	DEF144552L(*client);
       
  7011 	theLog.Write(_L8("Test 24 OK\n"));
       
  7012 	
  6913 	CleanupStack::PopAndDestroy(2); // client, notifier
  7013 	CleanupStack::PopAndDestroy(2); // client, notifier
  6914 	}
  7014 	}