TBool CHuiFxEffectParser::GetOpaqueHintL( CMDXMLNode *aNode ) { if (aNode->NodeType() != CMDXMLNode::EElementNode) { FAIL(KErrGeneral, _L("Text node expected while reading visual source type")); } TInt attributeIndex = ((CMDXMLElement*)aNode)->FindIndex( KLitOpaque ); if (attributeIndex == KErrNotFound) { // If src not found, the source defaults to visual itself return EFalse; } TPtrC attributeValue; TPtrC attributeName; User::LeaveIfError(((CMDXMLElement*)aNode)->AttributeDetails( attributeIndex, attributeName, attributeValue )); if( attributeValue.Compare( KLitTrue ) == 0 ) { return ETrue; } if( attributeValue.Compare( KLitFalse ) == 0 ) { return EFalse; } return EFalse; }
TVerdict CTestChangeLanguageStep::doTestStepPreambleL() /** * @return - TVerdict code * Override of base class virtual */ { TPtrC langFromIni; GetStringFromConfig(ConfigSection(),KLanguageTag,langFromIni); if (langFromIni.Compare(_L("English")) == KErrNone) { iLanguage = ELangEnglish; } else if (langFromIni.Compare(_L("French")) == KErrNone) { iLanguage = ELangFrench; } else { _LIT(KLanguageNotFound,"TestChangeLanguage: Language Tag not found, default to English"); INFO_PRINTF1(KLanguageNotFound); iLanguage = ELangEnglish; } return TestStepResult(); }
// ----------------------------------------------------------------------------- // COMASuplWapListener::HandleMessageL // Handles a push message synchronously. // ----------------------------------------------------------------------------- // void COMASuplWapListener::HandleMessageL( CPushMessage* aPushMsg ) { //TBuf<64> contentType; __ASSERT_ALWAYS( aPushMsg, User::Panic( KPushMsgNull, KErrUnknown ) ); iTrace->Trace( _L( "COMASuplWapListener::HandleMessageL() Sync Start" ), KTraceFileName, __LINE__ ); iMessage = aPushMsg; TPtrC receivedContentType; iTrace->Trace( _L("Retriving Content Type:" ), KTraceFileName, __LINE__ ); iMessage->GetContentType(receivedContentType); iTrace->Trace( _L("Received Content Type for WAP ..." ), KTraceFileName, __LINE__ ); iTrace->Trace(receivedContentType, KTraceFileName, __LINE__ ); if(receivedContentType.Compare(KSupportedContentType) == 0 || receivedContentType.Compare(KSupportedBinaryContentType) == 0 || receivedContentType.Compare(KSupportedBinaryContentType2) == 0 ) //can be combined... { iState = EProcess; } else if (CheckBinaryContentType(aPushMsg)) { iState = EProcess; } else { iTrace->Trace( _L("ERROR:Received Content Type is not supported..." ), KTraceFileName, __LINE__ ); iState = EComplete; iErrCode = KErrNotSupported; } IdleComplete(); }
TInt CTS_MultiHomingStep::GetConnectionType(TConnDetails *conn, TDesC& aName) { TPtrC ptrBuf; TInt err = GetStringFromConfig(aName, KConnType, ptrBuf); if(err != 1) { LogExtra((TText8*)__FILE__, __LINE__, ESevrWarn, KEConfigFile); return err; } if(ptrBuf.Compare(KConnDefault) ==0) conn->iConnectionType = TConnDetails::defaultConn; else if(ptrBuf.Compare(KConnImplicit) ==0) conn->iConnectionType = TConnDetails::implicitConn; else if(ptrBuf.Compare(KConnExplicit) ==0) conn->iConnectionType = TConnDetails::explicitConn; else { _LIT(KTypeErr, "Connection type should be one of %S %S or %S"); LogExtra((TText8*)__FILE__, __LINE__, ESevrErr, KTypeErr, KConnExplicit, KConnImplicit, KConnDefault ); return KErrNotFound; } return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::NameL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::NameL( CStifItemParser& aItem ) { TInt mode; TPtrC name; User::LeaveIfError( aItem.GetNextInt( mode )); if ( mode == EPropertyDef ) { CMdEPropertyDef* propDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); User::LeaveIfError( aItem.GetNextString( name )); TL( name.Compare( propDef->Name()) == 0 ); } else if ( mode == ENamespaceDef ) { CMdENamespaceDef* spaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); User::LeaveIfError( aItem.GetNextString( name )); TL( name.Compare( spaceDef->Name()) == 0 ); } else { User::Leave( KErrArgument ); } return KErrNone; }
TInt COpenRSubConnectionStep::ConfigureFromIni() { iParams.Reset(); // Read in appropriate fields if((GetStringFromConfig(iSection, KTe_SubConnectionName, iParams.iSubConnectionName) != 1) || (iParams.iSubConnectionName.Length() == 0)) { INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); return KErrNotFound; } if (GetStringFromConfig(iSection,KTe_SocketServName,iParams.iSockServName)!=1) { INFO_PRINTF2(_L("%S: Socket server name missing."),&iParams.iSubConnectionName); return KErrNotFound; } if (GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName)!=1) { INFO_PRINTF2(_L("%S: Connection name missing."),&iParams.iSubConnectionName); return KErrNotFound; } TPtrC subConnTypeName; if (GetStringFromConfig(iSection,KTe_SubConnectionTypeName,subConnTypeName)!=1) { INFO_PRINTF2(_L("%S: SubConnection type missing."),&iParams.iSubConnectionName); return KErrNotFound; } if (subConnTypeName.Compare(KTe_SubConnectionTypeAttach)==0) { iParams.iSubConnType = RSubConnection::EAttachToDefault; } else if (subConnTypeName.Compare(KTe_SubConnectionTypeNew)==0) { iParams.iSubConnType = RSubConnection::ECreateNew; } else { INFO_PRINTF3(_L("%S: SubConnection type (%S) not recognised."),&iParams.iSubConnectionName,&subConnTypeName); return KErrNotFound; } if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError)) { iExpectedError = KErrNone; } else { INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError); } // All ok if we got this far return KErrNone; }
TBool CT_MsgVerifyHeaders::VerifyMimeHeaderPartsL(CMsvEntrySelection* aEntrySelection) { TBool status = EPass; for(int index = 0; index < aEntrySelection->Count(); ++index) { CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(aEntrySelection->At(index)); CleanupStack::PushL(entry); CMsvStore* store = entry->ReadStoreL(); CleanupStack::PushL(store); if (store->IsPresentL(KUidMsgFileMimeHeader)) { CImMimeHeader* mimeHeader = CImMimeHeader::NewLC(); mimeHeader->RestoreL(*store); TBuf<256> param; TPtrC contentType; param.Format(KContentType, index); if(GetStringFromConfig( ConfigSection(), param, contentType)) { TPtrC8 content8 = mimeHeader->ContentType(); HBufC* content16 = HBufC::NewLC(content8.Length()); content16->Des().Copy(content8); if(contentType.Compare(content16->Des())) { ERR_PRINTF1(_L("Content Type is not matched")); status = EFail; } CleanupStack::PopAndDestroy(content16); } TPtrC contentSubType; param.Format(KContentSubType, index); if(GetStringFromConfig( ConfigSection(), param, contentSubType)) { TPtrC8 content8 = mimeHeader->ContentSubType(); HBufC* content16 = HBufC::NewLC(content8.Length()); content16->Des().Copy(content8); if(contentSubType.Compare(content16->Des())) { ERR_PRINTF1(_L("Content Sub Type is not matched")); status = EFail; } CleanupStack::PopAndDestroy(content16); } CleanupStack::PopAndDestroy(mimeHeader); } CleanupStack::PopAndDestroy(store); CleanupStack::PopAndDestroy(entry); } return status; }
TMsvId CTestImapSyncManager::FindFolderL(const TDesC& aName, TBool aCaseSensitive) { TMsvId remoteId = KErrNotFound; iEntry->SetEntry(iServiceId); CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection; iEntry->GetChildren(*msvEntrySelection); TPtrC iEntryName = aName; TInt count = msvEntrySelection->Count(); for (TInt i=0; i<count; i++) { iEntry->SetEntry((*msvEntrySelection)[i]); if (aCaseSensitive) { if (iEntryName.Compare(iEntry->Entry().iDetails ) == 0) { remoteId = (*msvEntrySelection)[i]; break; } } else if ((iEntryName.CompareF(iEntry->Entry().iDetails) == 0)) { remoteId = (*msvEntrySelection)[i]; break; } } delete msvEntrySelection; return remoteId; }
// --------------------------------------------------------- // CPosTp52::CheckLongLandmarkNameL // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp52::CheckLongLandmarkNameL() { iLog->Log(_L("CheckLandmarkL")); // Should only exist one landmark in db CPosLandmark* lm = iDatabase->ReadLandmarkLC(1); TPtrC lmname; TInt res = lm->GetLandmarkName(lmname); if (res != KErrNone) //LogErrorAndLeave(_L("Problem getting Landmark")); { iLog->Log(_L("Problem getting Landmark")); User::Leave(-1); } _LIT(KLONGNAME, "Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landmark10Landm"); if (lmname.Compare(KLONGNAME) != 0) { iLog->Log(_L("Long landmark name does not match")); iErrorsFound++; } CleanupStack::PopAndDestroy(lm); }
/** Auxilary function called to compare generated hash with reference hash and report error if they don't match. @param aHashIndex holds the hashId. */ EXPORT_C void CTHashReferenceImages::CompareHashValuesL(const TDesC& aHashIndex) { TBuf<KLengthOfHashValue> hexString; //Gets the hash value for the current drawings GenerateHashAndReturnInHexFormatL(hexString); TPtrC hashFromConfig; TBool stringFound = iStep->GetStringFromConfig(iStep->ConfigSection(), aHashIndex, hashFromConfig); if (stringFound) { //cannot use the macro //TEST((hashFromConfig.Compare(hexString)) == 0); since iStep needs to be //referenced iStep->testBooleanTrue((hashFromConfig.Compare(hexString)) == 0, (TText8*)__FILE__, __LINE__, ETrue); } else { #ifdef APPEND_NEW_OR_MISSING_HASH_DATA //Hash data will be written to ini file if hash id is not found. //If written the status will be as INI WRITE with the new hash id and value in test log file. iStep->testBooleanTrue(iStep->WriteStringToConfig(iStep->ConfigSection(), aHashIndex, hexString), (TText8*)__FILE__, __LINE__); #ifdef SAVEBITMAP CopyScreenToBitmapL(aHashIndex); #endif #else //Report error in case hash data is missing and APPEND_NEW_OR_MISSING_HASH_DATA is not defined iStep->testBooleanTrue( 0, (TText8*)__FILE__, __LINE__); #endif } }
// ----------------------------------------------------------------------------- // CCLFItemImpl::GetMediaTypeL // ----------------------------------------------------------------------------- // TInt CCLFItemImpl::GetMediaTypeL( CMdEObjectDef& aObjectDef, TInt32& aValue ) const { const TDesC* mdemediatypes[] = { &MdeConstants::Audio::KAudioObject, &MdeConstants::Video::KVideoObject, &MdeConstants::Image::KImageObject, }; const TInt clfmediatypes[] = { ECLFMediaTypeSound, ECLFMediaTypeVideo, ECLFMediaTypeImage, }; const TPtrC name = aObjectDef.Name(); TInt32 error = KErrNotFound; aValue = ECLFMediaTypeUnknown; // Default to this. for ( TUint i = 0; i < sizeof( clfmediatypes ) / sizeof( TInt ); ++i ) { if ( name.Compare( *mdemediatypes[ i ] ) == 0 ) { aValue = clfmediatypes[ i ]; error = KErrNone; break; } } if ( aValue == ECLFMediaTypeSound ) { DetermineIfMusicL( aObjectDef, aValue ); } return error; }
TInt CTS_MultiHomingStep::GetResolverConfig(const TInt aIndex, TName &aHostName, TInt& aProtocol, TBool& aExpectSuccess, TBool& aExpectTimeout, TBool& aExpectNotReady, TBool& aExplicitResolve, TConnDetails **aConnDetails) /** * Gets resolver configuration from file, using defaults if necessary * @param aIndex The index for the socket configkey * @param aHostName The host to be resolved * @param aProtocol The protocol to be used * @param aExpectSuccess Flag indicating if name should be resolved ok * @param aExpectTimeout Flag indicating if name resolution should timeout * @param aConnDetails The connection for an explicit resolver * @return System wide error code */ { TInt err=KErrNone; TName resolverName; // Create the Key for the config lookup resolverName = KResolver; resolverName.AppendNum(aIndex); TPtrC ptrBuf; err = GetStringFromConfig(resolverName, KDestName, ptrBuf); if (!err) { LogExtra((TText8*)__FILE__, __LINE__, ESevrWarn, KEConfigFile); iTestStepResult= EInconclusive; return KErrNotFound; } aHostName.Copy(ptrBuf.Ptr(), ptrBuf.Length()); aExpectSuccess = ETrue; GetBoolFromConfig(resolverName, KExpectSuccess, aExpectSuccess); aExpectTimeout = EFalse; GetBoolFromConfig(resolverName, KExpectTimeout, aExpectTimeout); aExpectNotReady = EFalse; GetBoolFromConfig(resolverName, KExpectNoDnsServer, aExpectNotReady); aExplicitResolve = EFalse; GetBoolFromConfig(resolverName, KExplicitResolve, aExplicitResolve); err = GetStringFromConfig(resolverName, KProtocol, ptrBuf); if (err && (ptrBuf.Compare(KTcp)==0)) aProtocol = KProtocolInetTcp; else aProtocol = KProtocolInetUdp; err = GetStringFromConfig(resolverName, KConnName, ptrBuf); if (!err) { return KErrNotFound; } *aConnDetails = iOwnerSuite->GetTConnection(ptrBuf); return KErrNone; }
/** Create Contact Item and add field to it and * verify the field is being added * aValue - field value * @param aStorageType - Storage type of each field * @param aContFieldUid - Uid of Contact field * @param avCardMapUid - Uid of vCard * @return - void */ void CTestAddFieldsStep::AddFieldsL(TPtrC aValue, TInt aStorageType,TUid aContFieldUid, TUid avCardMap) { TPtrC value; TInt year, month, day; // Create contact Item and add field to it CContactItem* item = CContactCard::NewLC(); CContactItemField* field = CContactItemField::NewL(aStorageType, aContFieldUid); CleanupStack::PushL(field); field->SetMapping(avCardMap); if(aStorageType==KStorageTypeDateTime) { GetIntFromConfig(ConfigSection(), KIniYear, year); GetIntFromConfig(ConfigSection(), KIniMonth, month); GetIntFromConfig(ConfigSection(), KIniDay, day); TDateTime date(year,(TMonth)month,day,0,0,0,0); field->DateTimeStorage()->SetTime(date); } else { field->TextStorage()->SetTextL(aValue); } item->AddFieldL(*field); // verify the field is being added CContactItemFieldSet& ContactFieldSet = item->CardFields(); TInt pos = ContactFieldSet.Find(aContFieldUid, avCardMap); if(pos != KErrNotFound) { if(aStorageType==KStorageTypeDateTime) { TDateTime result=ContactFieldSet[pos].DateTimeStorage()->Time().DateTime(); //compair the results if((result.Year() == year) && (result.Month() == (TMonth)month) && (result.Day() == day)) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } } else { value.Set(ContactFieldSet[pos].TextStorage()->Text()); //compair the results if(aValue.Compare(value)==0 ) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } } } CleanupStack::Pop(field); CleanupStack::PopAndDestroy(item); }
void CNSmlDummyDataProvider_Test::DoListStoresLCL() { CDesCArray* store = iCNSmlDummyDataProvider->DoListStoresLC(); TPtrC ptrStoreName = ( *store )[ 0 ]; EUNIT_PRINT( ptrStoreName ); EUNIT_ASSERT( ptrStoreName.Compare( KDefaultDBName ) == 0 ); CleanupStack::PopAndDestroy( store ); }
/** * Sets the time mode based on the input given @param aTimeMode time mode of the entry */ TCalTime::TTimeMode CTestCalInterimApiSuiteStepBase::SetTimeMode(const TPtrC& aTimeMode) { TCalTime::TTimeMode timeMode = TCalTime::EFixedUtc; if (aTimeMode.Compare(KTimeModeFloating) == 0) { timeMode = TCalTime::EFloating; } else if (aTimeMode.Compare(KFixedTimeZone) == 0) { timeMode = TCalTime::EFixedTimeZone; } else { timeMode = TCalTime::EFixedUtc; } return timeMode; }
TInt CSoundManager::PlayFile() { TPtrC file = iData->GetSelectFile(); if (file.Compare(KNullDesC)== 0) return KErrNotFound; else return LoadFile(file); }
/** * Function which performs addition, update and deletion of the entries. @param aDeleteFlag Flag to perform different delete operations like delete by reference, * delete by uid, local uid and delete by instances. */ void CTestCalInterimApiModifier::AddModifyDeleteEntriesL(const TPtrC& aDeleteFlag) { TBool addEntriesFlag = EFalse; iTestStep->GetBoolFromConfig(iTestStep->ConfigSection(), KAddEntriesFlag, addEntriesFlag); // If this flag is set, then add the entries in the calendar file if( addEntriesFlag ) { AddEntriesL(); } TBool updateEntriesFlag = EFalse; iTestStep->GetBoolFromConfig(iTestStep->ConfigSection(), KUpdateEntriesFlag, updateEntriesFlag); // If this flag is set, then update the entries in the calendar file if( updateEntriesFlag ) { UpdateEntriesL(); } TBool deleteEntriesFlag = EFalse; iTestStep->GetBoolFromConfig(iTestStep->ConfigSection(), KDeleteEntriesFlag, deleteEntriesFlag); // If this flag is set, then delete the entries in the calendar file if( deleteEntriesFlag ) { if ( !aDeleteFlag.Compare(KDeleteByInstances) ) { DeleteInstancesL(); } if( !aDeleteFlag.Compare(KDeleteByLocalUids) ) { DeleteEntriesByArrayOfLocalUidsL(); } else if( !aDeleteFlag.Compare(KDeleteByReference) ) { DeleteEntriesByReferenceL(); } else if ( !aDeleteFlag.Compare(KDeleteByTimeRange) ) { DeleteEntriesByTimeRangeL(); } else // DeleteByUid { DeleteEntriesByUidListL(); } } }
TInt CBindRSocketStep::ConfigureFromIni() { // Read in appropriate fields if((GetStringFromConfig(iSection, KTe_SocketName, iParams.iSocketName) != 1) || (iParams.iSocketName.Length() == 0)) { INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); return KErrNotFound; } TInt protocolInt = 0; if (GetIntFromConfig(iSection, KTe_Protocol, protocolInt)!=1) { TPtrC protocolStr; if (GetStringFromConfig(iSection, KTe_Protocol,protocolStr)!=1 ) { INFO_PRINTF2(_L("%S: Protocol missing."),&iParams.iSocketName); return KErrNotFound; } if (protocolStr.Compare(KTe_TCPName)==0) { protocolInt = KProtocolInetTcp; } else if (protocolStr.Compare(KTe_UDPName)==0) { protocolInt = KProtocolInetUdp; } else if (protocolStr.Compare(KTe_DummyNetworkProtocolName)==0) { protocolInt = KDummyNetworkProtocol; } else if (protocolStr.Compare(KTe_DummyProtocolName)==0) { protocolInt = KDummyProtocol; } else { INFO_PRINTF3(_L("%S: Protocol (%S) not recognised."),&iParams.iSocketName,&protocolStr); return KErrNotFound; } } iParams.iProtocol = protocolInt; // IP Address Local if (GetIpAddressFromConfig(iSection,KTe_SourceAddressName,iParams.iLocalIP)!=1) { INFO_PRINTF2(_L("%S: Local address missing."),&iParams.iSocketName); } // All ok if we got this far return KErrNone; }
THuiFxVisualSrcType CHuiFxEffectParser::GetSrcTypeL( CMDXMLNode* aNode, TPtrC16& aBitmap ) { #ifdef _HUI_FX_PARSER_LOGGING __ALFFXLOGSTRING1("CHuiFxEffectParser::GetSrcTypeL - 0x%x ",this); #endif if (aNode->NodeType() != CMDXMLNode::EElementNode) { FAIL(KErrGeneral, _L("Text node expected while reading visual source type")); } TInt attributeIndex = ((CMDXMLElement*)aNode)->FindIndex( KLitSrc ); if (attributeIndex == KErrNotFound) { // If src not found, the source defaults to visual itself return EVisualSrcVisual; } TPtrC attributeValue; TPtrC attributeName; User::LeaveIfError(((CMDXMLElement*)aNode)->AttributeDetails( attributeIndex, attributeName, attributeValue )); if( attributeValue.Compare( KLitItem ) == 0 ) { return EVisualSrcVisual; } else if ( attributeValue.Compare( KLitInput1 ) == 0 ) { // This means that the source is given as a parameter to the effect return EVisualSrcInput1; } else if ( attributeValue.Compare( KLitInput2 ) == 0 ) { // This means that the source is given as a parameter to the effect return EVisualSrcInput2; } else { // if nothing else is defined, the src represents an external file (bitmap) aBitmap.Set( attributeValue ); return EVisualSrcBitmap; } }
// --------------------------------------------------------- // CPosTp52::CheckLongCategoryNameL // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp52::CheckLongCategoryNameL(TInt aNumExpectedCategories ) { iLog->Log(_L("CheckLongCategoryNameL")); // Should only exist one landmark in db CPosLandmark* lm = iDatabase->ReadLandmarkLC(1); RArray<TPosLmItemId> array; CleanupClosePushL(array); lm->GetCategoriesL(array); TInt nr = array.Count(); TPtrC name; _LIT(KLONGNAME1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234"); _LIT(KLONGNAME2, "Pizzeria10Pizzeria20Pizzeria30Pizzeria40Pizzeria50Pizzeria60Pizzeria70Pizzeria80Pizzeria90Pizzeria10Pizzeria10Pizzeria20Pizz"); _LIT(KLONGNAME3, "Gizzeria10Gizzeria20Gizzeria30Gizzeria40Gizzeria50Gizzeria60Gizzeria70Gizzeria80Gizzeria90Gizzeria10Gizzeria10Gizzeria20_ABC"); _LIT(KLONGNAME4, "Dizzeria10Dizzeria20Dizzeria30Dizzeria40Dizzeria50Dizzeria60Dizzeria70Dizzeria80Dizzeria90Dizzeria10Dizzeria10Dizzeria20_ABC"); const TInt numNames = 4; const TPtrC names[] = { KLONGNAME1(), KLONGNAME2(), KLONGNAME3(), KLONGNAME4() }; if (nr != aNumExpectedCategories) //LogErrorAndLeave(_L("Wrong number of categories for landmark")); { iLog->Log(_L("Wrong number of categories for landmark")); User::Leave(-1); } CPosLmCategoryManager* categoryManager = CPosLmCategoryManager::NewL(*iDatabase); CleanupStack::PushL(categoryManager); for ( TInt i = 0; i < aNumExpectedCategories; i++ ) { CPosLandmarkCategory* cat = categoryManager->ReadCategoryLC(array[i]); cat->GetCategoryName(name); // Maximum size for category name is 124 characters if (name.Length() != 124) { iLog->Log(_L("Category name has wrong size, should be 124")); User::Leave(-1); } if (name.Compare(names[i]) != 0) { iLog->Log(_L("Long category name does not match")); iErrorsFound++; } CleanupStack::PopAndDestroy(cat); } CleanupStack::PopAndDestroy(categoryManager); CleanupStack::PopAndDestroy(&array); CleanupStack::PopAndDestroy(lm); }
TInt COpenMAXALTestModule::CheckForNull(CStifItemParser& aItem, void*& paramPtr) { TInt status(KErrNone); TPtrC itfc; _LIT(ifc,"null"); _LIT(invalidItfc, "invalid"); status = aItem.GetNextString(itfc); if(!status) { if(!itfc.Compare(ifc)) { paramPtr = NULL; } else if (itfc.Compare(invalidItfc) == 0) { paramPtr = (void *)&aItem; } } return status; }
void CAppConfig::GetConfigL(const TDesC &aKey, const TConfig &aConfig) { RDbTable table; TDbSeekKey seekKey(aKey); User::LeaveIfError(table.Open(iDb, KConfigTable, table.EReadOnly)); CleanupClosePushL(table); User::LeaveIfError(table.SetIndex(KConfigIndex)); CDbColSet* colSet = table.ColSetL(); CleanupStack::PushL(colSet); TInt valueColNo = colSet->ColNo(KConfigValueCol); if (table.SeekL(seekKey)) { table.GetL(); TPtrC value = table.ColDes(valueColNo); switch (aConfig.iType) { case EConfigBool: *aConfig.iValue.iBool = value.Compare(KBoolTrue) == 0 ? ETrue : EFalse; break; case EConfigInt: { TLex lex(value); TInt lvalue; if (lex.Val(lvalue) == KErrNone) { *aConfig.iValue.iInt = lvalue; } break; } case EConfigText: if (aConfig.iValue.iText->MaxLength() > value.Length()) { aConfig.iValue.iText->Copy(value.Left(aConfig.iValue.iText->MaxLength())); } else { aConfig.iValue.iText->Copy(value); } break; case EConfigText8: if (aConfig.iValue.iText8->MaxLength() > value.Length()) { aConfig.iValue.iText8->Copy(value.Left(aConfig.iValue.iText8->MaxLength())); } else { aConfig.iValue.iText8->Copy(value); } break; } } CleanupStack::PopAndDestroy(colSet); CleanupStack::PopAndDestroy(&table); }
TVerdict CAppFwkStartSafeTestStepAppTimeout::doTestStepL( void ) { CStartSafe *startSafe = CStartSafe::NewL(); CleanupStack::PushL( startSafe ); CStartupProperties *prop = CStartupProperties::NewL(); CleanupStack::PushL( prop ); RProcess proc; CleanupClosePushL( proc ); prop->SetFileParamsL( KTestAppSlow, KNullDesC ); prop->SetStartupType( EStartApp ); prop->SetStartMethod( EWaitForStart ); prop->SetNoOfRetries( 0 ); prop->SetTimeout( KWaitTime ); TInt tried = 0; INFO_PRINTF2( _L("Start the app and wait for %d milliseconds"), KWaitTime ); TRAPD( err, startSafe->StartL(*prop, proc, tried) ); if ( KErrTimedOut == err ) { SetTestStepResult( EPass ); INFO_PRINTF1( _L("Timed out - Test passed") ); } else { SetTestStepResult( EFail ); ERR_PRINTF1( _L("No time-out - Test failed") ); TPtrC procNamePtr = proc.FileName().Right( KTestAppSlow().Length() ); // Check that the process is the app we think it is. if( 0 == procNamePtr.Compare( KTestAppSlow()) ) { proc.Kill( KErrNone ); } } CleanupStack::PopAndDestroy( 3, startSafe ); return TestStepResult(); }
void CDirectPrintPrinterSettingView::HandleEditItemL(TInt aIndex, TBool aChanged) { if (aChanged) { TBuf<25> titleBearer; CEikonEnv::Static()->ReadResource(titleBearer, R_DIRECTPRINT_PRINTERSETTING_ITEM_BEARER); TPtrC name = (*(iListBox->SettingItemArray()))[aIndex]->SettingName(); if (name.Compare(titleBearer) == 0) { ReloadListL(); } } }
TInt CShutdownRSocketStep::ConfigureFromIni() { iParams.Reset(); // Read in appropriate fields if((GetStringFromConfig(iSection, KTe_SocketName, iParams.iSocketName) != 1) || (iParams.iSocketName.Length() == 0)) { INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); return KErrNotFound; } TPtrC shutdownType; if (GetStringFromConfig(iSection,KTe_ShutdownTypeName,shutdownType)!=1) { INFO_PRINTF2(_L("%S: Shutdown type missing."),&iParams.iSocketName); return KErrNotFound; } if (shutdownType.Compare(KTe_ShutdownNormal)==0) { iParams.iShutdownType = RSocket::ENormal; } else if (shutdownType.Compare(KTe_ShutdownStopInput)==0) { iParams.iShutdownType = RSocket::EStopInput; } else if (shutdownType.Compare(KTe_ShutdownStopOutput)==0) { iParams.iShutdownType = RSocket::EStopOutput; } else if (shutdownType.Compare(KTe_ShutdownImmediate)==0) { iParams.iShutdownType = RSocket::EImmediate; } else { INFO_PRINTF3(_L("%S: Shutdown type (%S) not recognised."),&iParams.iSocketName,&shutdownType); return KErrNotFound; } // All ok if we got this far return KErrNone; }
void CTraverseNode::Start() { CMDXMLNode::TDOMNodeType nodeType = iNode.NodeType(); if (nodeType == CMDXMLNode::EElementNode) { CMDXMLElement& element = reinterpret_cast<CMDXMLElement&>(iNode); TPtrC nodeName = element.NodeName(); TPtrC attributeValue; if (!nodeName.Compare(KSmilImg)) { if (element.GetAttribute(KAttributeNameSrc,attributeValue) == KErrNone) { iMmsMessage.CreateMediaObjectL(EFalse,KMimeImageGif,attributeValue); iMmsMessage.StoreL(); } } else if (!nodeName.Compare(KSmilText)) { if (element.GetAttribute(KAttributeNameSrc,attributeValue) == KErrNone) { iMmsMessage.CreateMediaObjectL(EFalse,KMimeTextPlain,attributeValue); iMmsMessage.StoreL(); } } } if (iNode.HasChildNodes()) { for (CMDXMLNode* node = iNode.FirstChild(); node; node = node->NextSibling()) { CTraverseNode* traverseNode = new(ELeave) CTraverseNode(*node,iMmsMessage); traverseNode->Start(); delete traverseNode; } } }
TVerdict CTestReceivingDeliversWithTPSRR::doTestStepPreambleL() { //Call the base class preamble CTestReceivingMessages::doTestStepPreambleL(); //Get the expected selective status from the config file TPtrC expectedSchemeStr; GetStringFromConfig(ConfigSection(), _L("expectedScheme"), expectedSchemeStr); if(expectedSchemeStr.Compare(_L("TPSRR"))==0) iExpectedScheme = ETPSRRScheme; else iExpectedScheme = EDefaultScheme; return TestStepResult(); }
/* This function performs desired operations specified as a parameter @param aOperation string representing operation to be performed @return None */ void CTestRControlChannel::PerformDesiredOperationsL(const TDesC& aOperation) { const TInt KMatch = 0; TPtrC operationType; _LIT(KOperationType, "operationtype"); GetStringFromConfig(aOperation, KOperationType, operationType); if ( iConnection.SubSessionHandle () == 0 ) { TestUtils::LoadESockL ( iSocketServ, iConnection ); } if(operationType.Compare(KPublishService) == KMatch) { PublishServiceL(aOperation); } }
void CTestCalInterimApiSuiteStepBase::DefaultFileNameL() { INFO_PRINTF1(_L("Retrieving the Default File")); const TPtrC fileName = iSession->DefaultFileNameL(); INFO_PRINTF2(_L("The Default file name is %S"), &fileName); if( fileName.Compare(_L("C:Calendar")) == 0) { INFO_PRINTF1(_L("The default file name and the retrieved file matches")); } else { ERR_PRINTF1(KErrInDefaultFileName); SetTestStepResult(EFail); } }
/* In this section, we edit the desired number of groups in the database * Set label for them and associate them with contacts @ param aGroupSection - Desired Group Name @ param aContact - Contact to be updated */ void CTestContactViewCRUDOperationsStep::UpdateContactsInGroupL(const TInt aNumberOfContactsToBeUpdated, const TPtrC& aGroupSection) { RArray<TPtrC> listOfGroupsSections; CleanupClosePushL(listOfGroupsSections); ViewUtilityReference().TokenizeStringL(aGroupSection, listOfGroupsSections); for ( TInt i = 0; i < listOfGroupsSections.Count(); ++i ) { CCntFilter* filter = CCntFilter::NewL(); CleanupStack::PushL(filter); filter->SetContactFilterTypeGroup(ETrue); DatabaseReference().FilterDatabaseL(*filter); for ( TInt i = 0; i < filter->iIds->Count(); ++i ) { TContactItemId groupId = (*filter->iIds)[i]; CContactItem* group = DatabaseReference().OpenContactL(groupId); CContactGroup* newGroup = static_cast<CContactGroup*>(group); if(aGroupSection.Compare(newGroup->GetGroupLabelL()) == 0) { const CContactIdArray* listOfContacts = newGroup->ItemsContained(); for(TInt i(0); i < aNumberOfContactsToBeUpdated; i++) { TContactItemId contactItemId = (*listOfContacts)[i]; CContactItem* contactItem = DatabaseReference().ReadContactL(contactItemId); CleanupStack::PushL(contactItem); UpdateFieldsL(*contactItem); CContactItem* updatedContactItem = DatabaseReference().UpdateContactLC(contactItemId, contactItem); CleanupStack::PopAndDestroy(updatedContactItem); CleanupStack::PopAndDestroy(contactItem); } delete listOfContacts; DatabaseReference().CloseContactL(groupId); break; } DatabaseReference().CloseContactL(groupId); } CleanupStack::PopAndDestroy(filter); } CleanupStack::PopAndDestroy(&listOfGroupsSections); }