/** Checks the start, end and time of an entry @param aFetchInstanceArray Array of instances @test */ void CTestCalInterimApiTZChange::CheckEntryTimesL(RPointerArray<CCalInstance>& aFetchInstanceArray) { CCalEntry& entry = aFetchInstanceArray[0]->Entry(); const TDesC8& entryUid = entry.UidL(); for ( TInt index = 0; index < aFetchInstanceArray.Count(); index++ ) { const TDesC8& entryUid1 = aFetchInstanceArray[index]->Entry().UidL(); TESTL(!entryUid.Compare(entryUid1)); } GetEntryDataFromIniFileL(); TDateTime startTime; TDateTime endTime; if (iIsFloating) { startTime = entry.StartTimeL().TimeLocalL().DateTime(); INFO_PRINTF7(_L("Entry Start Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), startTime.Year(), startTime.Month(), startTime.Day(), startTime.Hour(), startTime.Minute(), startTime.Second()); TESTL(FormatDateTime(iPtrExpectedEntryStart) == entry.StartTimeL().TimeLocalL()); endTime = entry.EndTimeL().TimeLocalL().DateTime(); INFO_PRINTF7(_L("Entry End Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), endTime.Year(), endTime.Month(), endTime.Day(), endTime.Hour(), endTime.Minute(), endTime.Second()); TESTL(FormatDateTime(iPtrExpectedEntryEnd) == entry.EndTimeL().TimeLocalL()); TESTL(entry.StartTimeL().TimeMode() == TCalTime::EFloating); TESTL(entry.EndTimeL().TimeMode() == TCalTime::EFloating); } else { startTime = entry.StartTimeL().TimeUtcL().DateTime(); INFO_PRINTF7(_L("Entry Start Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), startTime.Year(), startTime.Month(), startTime.Day(), startTime.Hour(), startTime.Minute(), startTime.Second()); TESTL(FormatDateTime(iPtrExpectedEntryStart) == entry.StartTimeL().TimeUtcL()); endTime = entry.EndTimeL().TimeUtcL().DateTime(); INFO_PRINTF7(_L("Entry End Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), endTime.Year(), endTime.Month(), endTime.Day(), endTime.Hour(), endTime.Minute(), endTime.Second()); TESTL(FormatDateTime(iPtrExpectedEntryEnd) == entry.EndTimeL().TimeUtcL()); TESTL(entry.StartTimeL().TimeMode() == TCalTime::EFixedUtc); TESTL(entry.EndTimeL().TimeMode() == TCalTime::EFixedUtc); } INFO_PRINTF1(KEntryTimesCorrect); CCalAlarm* alarm1 = entry.AlarmL(); TESTL(alarm1->TimeOffset().Int() == iIntAlarmOffset); delete alarm1; INFO_PRINTF1(KAlarmOffsetTZ); }
TVerdict CTestImpRevLocal::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual */ { SetTestStepResult(EFail); TInt numberOfCases = 0; while(ETrue) { TBuf<90> config(KImportRevLocal); TPtrC ptrexpUTC = GetExpectedUTCFromIniL(numberOfCases, config, EFalse); if(ptrexpUTC==KNullDesC) { break; } INFO_PRINTF2(_L("TEST: %d"), numberOfCases+1); iExpectedUTC = FormatDateTime(ptrexpUTC); TBuf<80> pathVCF(KPathImportRevLocal); OpenVCFAndImportItemL(pathVCF, iFsSession, numberOfCases); // Imports vcf TDateTime t = iTimeFromImport.DateTime(); TDateTime t1 = iExpectedUTC.DateTime(); INFO_PRINTF7(_L("Imported Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()); INFO_PRINTF7(_L("Expected Date Year: %d, Month: %d, Day: %d, Expected Time Hr: %d, Min: %d, Sec: %d "), t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second()); if (iExpectedUTC==iTimeFromImport) // checks if imported time is correct { INFO_PRINTF1(_L("Imported Time as local (correct)")); SetTestStepResult(EPass); } else { INFO_PRINTF1(_L("Imported Time not imported as local (NOT CORRECT)")); SetTestStepResult(EFail); return TestStepResult(); } numberOfCases++; } return TestStepResult(); }
void CUISisAdaptor::DisplayAppInfo(const TDesC& aPreText, const CAppInfo& aAppInfo) { INFO_PRINTF7(_L("\t%S {\"%S\", \"%S\", V%u.%u.%u}"), &aPreText, &aAppInfo.AppName(), &aAppInfo.AppVendor(), aAppInfo.AppVersion().iMajor, aAppInfo.AppVersion().iMinor, aAppInfo.AppVersion().iBuild); }
/** Checks the start, end and time of an instance @param aFetchInstanceArray Array of instances @param aIndex Used to retrieve the correct instance from array @test */ void CTestCalInterimApiTZChange::CheckInstancesTimesL(RPointerArray<CCalInstance>& aFetchInstanceArray, TInt aIndex) { TDateTime startTime; TDateTime endTime; CCalInstance* instance = NULL; GetInstanceDataFromIniFileL(aIndex); if (iIsFloating) { instance = aFetchInstanceArray[aIndex]; startTime = instance->StartTimeL().TimeLocalL().DateTime(); INFO_PRINTF7(_L("Instance Start Date Year: %d, Month: %d, Day: %d, Instance Start Time Hr: %d, Min: %d, Sec: %d "), startTime.Year(), startTime.Month(), startTime.Day(), startTime.Hour(), startTime.Minute(), startTime.Second()); TESTL(instance->StartTimeL().TimeLocalL() == instance->Time().TimeLocalL()); INFO_PRINTF1(_L("Start and Time of instance match")); TESTL(FormatDateTime(iPtrExpectedInstanceStart) == instance->StartTimeL().TimeLocalL()); endTime = instance->EndTimeL().TimeLocalL().DateTime(); INFO_PRINTF7(_L("Instance End Date Year: %d, Month: %d, Day: %d, Instance Start Time Hr: %d, Min: %d, Sec: %d "), endTime.Year(), endTime.Month(), endTime.Day(), endTime.Hour(), endTime.Minute(), endTime.Second()); TESTL(FormatDateTime(iPtrExpectedInstanceEnd) == instance->EndTimeL().TimeLocalL()); TESTL(instance->StartTimeL().TimeMode() == TCalTime::EFloating); // defect stored as fixedutc TESTL(instance->Time().TimeMode() == TCalTime::EFloating); TESTL(instance->EndTimeL().TimeMode() == TCalTime::EFloating); } else { instance = aFetchInstanceArray[aIndex]; startTime = instance->StartTimeL().TimeUtcL().DateTime(); INFO_PRINTF7(_L("Instance Start Date Year: %d, Month: %d, Day: %d, Instance Start Time Hr: %d, Min: %d, Sec: %d "), startTime.Year(), startTime.Month(), startTime.Day(), startTime.Hour(), startTime.Minute(), startTime.Second()); TESTL(instance->StartTimeL().TimeUtcL() == instance->Time().TimeUtcL()); INFO_PRINTF1(_L("Start and Time of instance match")); TESTL(FormatDateTime(iPtrExpectedInstanceStart) == instance->StartTimeL().TimeUtcL()); endTime = instance->EndTimeL().TimeUtcL().DateTime(); INFO_PRINTF7(_L("Instance End Date Year: %d, Month: %d, Day: %d, Instance Start Time Hr: %d, Min: %d, Sec: %d "), endTime.Year(), endTime.Month(), endTime.Day(), endTime.Hour(), endTime.Minute(), endTime.Second()); TESTL(FormatDateTime(iPtrExpectedInstanceEnd) == instance->EndTimeL().TimeUtcL()); TESTL(instance->StartTimeL().TimeMode() == TCalTime::EFixedUtc); TESTL(instance->Time().TimeMode() == TCalTime::EFixedUtc); TESTL(instance->EndTimeL().TimeMode() == TCalTime::EFixedUtc); } }
TVerdict CTestExRevUTC::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual */ { SetTestStepResult(EFail); TBuf<90> pathVCF(KExportRevUTCFile); ExportItemL(pathVCF, EFalse); // read from the disk. ImportItemL(pathVCF,EFalse); TDateTime t = iRecordedTime.DateTime(); TDateTime t1 = iTimeFromImport.DateTime(); INFO_PRINTF7(_L("Recorded Last Modified Date Year: %d, Month: %d, Day: %d, Recorded Time Hr: %d, Min: %d, Sec: %d "), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()); INFO_PRINTF7(_L("Imported Last Modified Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second()); TTimeIntervalSeconds secondsDifference; User::LeaveIfError(iTimeFromImport.SecondsFrom(iRecordedTime, secondsDifference)); TInt difference = secondsDifference.Int(); if (difference < 2 && difference > -2) { INFO_PRINTF1(_L("Recorded and Imported DateTime match")); SetTestStepResult(EPass); } else { INFO_PRINTF1(_L("Recorded and Imported DateTime does not match")); SetTestStepResult(EFail); } return TestStepResult(); }
TVerdict CTestExBDayLocal::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual */ { SetTestStepResult(EFail); TInt numberOfCases = 0; while (ETrue) { TPtrC ptrBDay = GetBDayL(numberOfCases); if(ptrBDay==KNullDesC) { break; } INFO_PRINTF2(_L("TEST: %d"), numberOfCases+1); iBDayLocal = FormatDateTime(ptrBDay); TDateTime t = iBDayLocal.DateTime(); INFO_PRINTF7(_L("Birthday to be exported, Year: %d, Month: %d, Day: %d, Hr: %d, Min: %d, Sec: %d"), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()); iName = GetNameL(numberOfCases); iPhone = GetPhoneL(numberOfCases); TBuf<90> pathVCF(KExportBDayFile); ExportItemL(pathVCF, ETrue); // read from the disk. ImportItemL(pathVCF, ETrue); if(!CheckImportedBDay()) { SetTestStepResult(EFail); return TestStepResult(); } numberOfCases++; }// End Of While Loop SetTestStepResult(EPass); return TestStepResult(); }
TInt CTestLibcwchar::wmemcpy3L( ) { wchar_t ws1[50]=L"abcdegghij",*retval,ws2[50]; retval = wmemcpy(ws2,ws1,7); INFO_PRINTF1(_L("wmemcpy3 result is")); for(int i=0;i<7;i++) { INFO_PRINTF7(_L("retval[%d]=%x ws1[%d]=%x ws2[%d]=%x"),i,retval[i],i,ws1[i],i,ws2[i]); if(retval[i] != ws2[i] || ws1[i] != ws2[i]) { return KErrGeneral; } } return KErrNone; }
/** * Function Name : TestMacAddress * Description : Gets the MAC address of the device * Return Value : KErrNone */ TInt CTestIfioctls::TestMacAddress() { int sd, ret=KErrNone; struct ifreq ifr; unsigned char *a; char ifrname[25]; memset (&ifrname,0,sizeof(ifrname)); ret = GetIfrName(ifrname, sizeof(ifrname)); if (ret == KErrGeneral) { INFO_PRINTF1(_L("GetOpt fails")); return KErrGeneral; } if (!ifrname || ifrname[0] == '\0') { INFO_PRINTF1(_L("invalid ifrname")); return KErrGeneral; } memset(&ifr, 0, sizeof(ifr)); sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); strncpy(&ifr.ifr_name[0], ifrname, strlen(ifrname)); if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0) { INFO_PRINTF2(_L("ioctl() -SIOCGIFHWADDR failed: %d\n"), errno); ret = KErrGeneral; } a = (unsigned char *) &ifr.ifr_hwaddr.sa_data; INFO_PRINTF7(_L("%02x:%02x:%02x:%02x:%02x:%02x"), a[0],a[1],a[2],a[3],a[4],a[5]); return ret; }