EXPORT_C void CLogEvent::CopyL(const CLogEvent& aEvent) /** Makes a copy of the specified log event. @param aEvent The log event to be copied. */ { // Set data first as this is the only function that can leave // If this function fails nothing will be changed SetDataL(aEvent.Data()); SetId(aEvent.Id()); SetEventType(aEvent.EventType()); SetTime(aEvent.Time()); SetDurationType(aEvent.DurationType()); SetDuration(aEvent.Duration()); SetContact(aEvent.Contact()); SetLink(aEvent.Link()); SetDescription(aEvent.Description()); SetRemoteParty(aEvent.RemoteParty()); SetDirection(aEvent.Direction()); SetStatus(aEvent.Status()); SetSubject(aEvent.Subject()); SetNumber(aEvent.Number()); ClearFlags(KLogFlagsMask); SetFlags(aEvent.Flags()); #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM SetSimId(aEvent.SimId()); #endif }
TBool CompareEvents(const CLogEvent& aLeft, const CLogEvent& aRight) { TBool ret = aLeft.Data() == aRight.Data(); ret = ret && aLeft.Description() == aRight.Description(); ret = ret && aLeft.Direction() == aRight.Direction(); ret = ret && aLeft.Duration() == aRight.Duration(); ret = ret && aLeft.DurationType() == aRight.DurationType(); ret = ret && aLeft.EventType() == aRight.EventType(); ret = ret && aLeft.Flags() == aRight.Flags(); ret = ret && aLeft.Id() == aRight.Id(); ret = ret && aLeft.Link() == aRight.Link(); ret = ret && aLeft.Number() == aRight.Number(); ret = ret && aLeft.RemoteParty() == aRight.RemoteParty(); ret = ret && aLeft.Status() == aRight.Status(); ret = ret && aLeft.Subject() == aRight.Subject(); ret = ret && aLeft.Time() == aRight.Time(); return ret; }
/** @SYMTestCaseID SYSLIB-LOGENG-CT-1022 @SYMTestCaseDesc Tests for operations on log database @SYMTestPriority High @SYMTestActions Check by add new event,change the event,and get event and check for integrity of data @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestEventViewL(CLogClient& aClient) { TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1022 ")); CTestActive* active = new(ELeave)CTestActive(); CleanupStack::PushL(active); CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC(); changeObs->SetActive(); CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs); CleanupStack::PushL(view); CLogEvent* event; TLogId id; TTime now; now.UniversalTime(); TInt count; for(count = 0; count < KTestEventNum; count++) { event = CLogEvent::NewL(); CleanupStack::PushL(event); event->SetEventType(KLogCallEventTypeUid); //User::After(Math::Random() % 100000); User::After(1000000); active->StartL(); aClient.AddEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(event->EventType() == KLogCallEventTypeUid); TEST(event->Description().Length() > 0); TEST(event->Time() >= now); now = event->Time(); id = event->Id(); event->SetRemoteParty(KTestRemoteParty1); event->SetDirection(KTestDirection1); event->SetDurationType(KTestDurationType1); event->SetDuration(KTestDuration1); event->SetStatus(KTestStatus1); event->SetSubject(KTestSubject1); event->SetNumber(KTestNumber1); event->SetLink(KTestLink1); event->SetDataL(KTestData1); event->SetFlags(KTestFlags1); event->SetContact((TLogContactItemId) count+1); User::After(Math::Random() % 100000); active->StartL(); aClient.ChangeEvent(*event, active->iStatus); CActiveScheduler::Start(); //If the test fails on the next line with -1 or -12 error, it is possible that the contacts database is missing: //c:\private\10003a73\SQLite__Contacts.cdb. Copy it to the specified location and rerun the test. TEST2(active->iStatus.Int(), KErrNone); TEST(event->EventType() == KLogCallEventTypeUid); TEST(event->RemoteParty() == KTestRemoteParty1); TEST(event->Direction() == KTestDirection1); TEST(event->DurationType() == KTestDurationType1); TEST(event->Duration() == KTestDuration1); TEST(event->Status() == KTestStatus1); TEST(event->Subject() == KTestSubject1); TEST(event->Number() == KTestNumber1); TEST(event->Link() == KTestLink1); TEST(event->Data() == KTestData1); TLogFlags eventFlags; if(TheMatchingIsEnabled) { eventFlags=KTestFlags1|KLogEventContactSearched; } else { eventFlags=KTestFlags1; } //If the test fails on the next line, it is quite possible that there is a //z:\private\10202be9a\101f401d.txt file that sets the contacts match count to 0. //Delete the file and run the test again. TEST(event->Flags() == eventFlags); TEST(event->Contact()==(TLogContactItemId) count+1); CleanupStack::PopAndDestroy(); // event; event = CLogEvent::NewL(); CleanupStack::PushL(event); event->SetId(id); active->StartL(); aClient.GetEvent(*event, active->iStatus); CActiveScheduler::Start(); TEST2(active->iStatus.Int(), KErrNone); TEST(event->EventType() == KLogCallEventTypeUid); TEST(event->RemoteParty() == KTestRemoteParty1); TEST(event->Direction() == KTestDirection1); TEST(event->DurationType() == KTestDurationType1); TEST(event->Duration() == KTestDuration1); TEST(event->Status() == KTestStatus1); TEST(event->Subject() == KTestSubject1); TEST(event->Number() == KTestNumber1); TEST(event->Link() == KTestLink1); TEST(event->Data() == KTestData1); TEST(event->Flags() == eventFlags); TEST(event->Contact()==(TLogContactItemId) count+1); CleanupStack::PopAndDestroy(); // event; } CleanupStack::PopAndDestroy(3, active); // Delete view, changeObs, active }