void CTmsTestStep::CleanUpAndWriteResults() { RFs fs; fs.Connect(); CleanupClosePushL(fs); iTestStepPositions.Close(); if (iTestStepNames != NULL) { iTestStepNames->Reset(); delete iTestStepNames; iTestStepNames = NULL; if (BaflUtils::FolderExists(fs, KLogLocation)) { RFile file; if (BaflUtils::FileExists( fs, KLogLocation )) { // open the temporary tms log TInt err = file.Open( fs, KLogLocation, EFileRead|EFileShareAny); if(err == KErrInUse) { CleanupStack::PopAndDestroy(); return; } if (err == KErrNone) { CleanupClosePushL(file); TBuf8<256> line; TBuf<250> testID; TBuf<6> testResult; // get a line from the temporary tms log while (CTmsTestStep::ReadNextLineL(file,line)) { TInt blankPos = line.Find(KBlankSpace); // get the ID from the line testID.Copy(line.Left(blankPos)); //get the pass or fail result from the line testResult.Copy(line.Mid(blankPos+1,4)); // print into the standard tef log the id and the result in the correct format // so that they are correctly parsed into the TMS csv file INFO_PRINTF2(_L("START_TESTCASE %S"),&testID); INFO_PRINTF2(_L("Line = 1 Command = START_TESTCASE %S"),&testID); INFO_PRINTF2(_L("END_TESTCASE %S"),&testID); INFO_PRINTF3(_L("Line = 1 Command = END_TESTCASE %S ***TestCaseResult = %S"),&testID,&testResult); } CleanupStack::PopAndDestroy(); } // remove the temporary tms log fs.Delete(KLogLocation); } } } CleanupStack::PopAndDestroy(); }
TBool TestExportedFile(const TDesC& aFilename) { //Check for DTSTART and DTEND //Check it is in DATE-TIME format TBool DTSTART_patternFound = EFalse; TBool DTEND_patternFound = EFalse; RFile fileHandle; CleanupClosePushL(fileHandle); fileHandle.Open(calTestLibrary->FileSession(),aFilename, 0); TBuf8<256> line; TInt KDateLength = 8; TInt KColon = 1; while (fileHandle.Read(line) == KErrNone && line.Length() != 0) { TInt pos = line.Find(KDTSTART()); if (pos != KErrNotFound) { DTSTART_patternFound = ETrue; TText time; time = line[pos + KDTSTART().Length() + KColon + KDateLength ]; test (time == 'T'); } pos = line.Find(KDTEND()); if ( pos != KErrNotFound) { DTEND_patternFound = ETrue; TText time; time = line[pos + KDTEND().Length() + KColon + KDateLength ]; test (time == 'T'); if (DTSTART_patternFound && DTEND_patternFound) break; } } CleanupStack::PopAndDestroy(&fileHandle); return (DTSTART_patternFound && DTEND_patternFound); }
// --------------------------------------------------------- // AddXmlAttributeL() // --------------------------------------------------------- // void CBIPXmlWriter::AddXmlAttributeL( TAttributeType aAttributeType, TDesC8& aAttr ) { TRACE_FUNC_ENTRY TBuf8<KBIPImageTypesLength> attribute = KBIPImageTypes(); switch( aAttributeType ) { case EEncoding: { if( attribute.Find( aAttr ) == KErrNotFound ) { User::LeaveIfError( ifile.Write( KBIPUserSeries60 ) ); User::LeaveIfError( ifile.Write( aAttr ) ); } else { User::LeaveIfError( ifile.Write( aAttr ) ); } break; } case EPixel: { User::LeaveIfError( ifile.Write( aAttr ) ); break; } case EMaxSize: { User::LeaveIfError( ifile.Write( aAttr ) ); break; } case ETransformation: { break; } default: { } } TRACE_FUNC_EXIT }
TBool VersitCheckPatternL(const TDesC& aExportFileName, const TDesC8& aExportedPattern) { RFile fileHandle; TBool patternFound = EFalse; fileHandle.Open(fsSession, aExportFileName, EFileRead|EFileStreamText); CleanupClosePushL(fileHandle); // TFileText exportedfile; //Bug in TFileText so not used at the moment // exportedfile.Set(fileHandle); // exportedfile.Seek(ESeekStart); TBuf8<256> line; while(fileHandle.Read(line) == KErrNone && line.Length() != 0) { if (line.Find(aExportedPattern) != KErrNotFound) { patternFound = ETrue; break; } } CleanupStack::PopAndDestroy(&fileHandle); return patternFound; }