diff -r 748ec5531811 -r 336bee5c2d35 textrendering/texthandling/ttext/T_TRAN.CPP --- a/textrendering/texthandling/ttext/T_TRAN.CPP Tue Aug 31 17:01:26 2010 +0300 +++ b/textrendering/texthandling/ttext/T_TRAN.CPP Wed Sep 01 12:39:40 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -22,34 +22,15 @@ #include #include #include +#include #include #include #include "TXTMRTSR.H" #include "../incp/T_PMLPAR.H" -//#include "../spml/T_PMLPAR.CPP" -#include "T_TRAN.h" +#include "../spml/T_PMLPAR.CPP" -LOCAL_D CTestStep *pTestStep = NULL; -#define test(cond) \ - { \ - TBool __bb = (cond); \ - pTestStep->TEST(__bb); \ - if (!__bb) \ - { \ - pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed")); \ - User::Leave(1); \ - } \ - } -#undef INFO_PRINTF1 -#undef INFO_PRINTF2 -// copy from tefexportconst.h -#define INFO_PRINTF1(p1) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1)) -#define INFO_PRINTF2(p1, p2) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2)) - -// included in a namespace, to avoid confliction -namespace T_TRAN { /* this fixes a MSVC link warning */ #ifdef __VC32__ #pragma comment (linker, "/opt:noref") @@ -94,6 +75,8 @@ const CCharFormatLayer* iGlobalCharFormatLayer; }; + +LOCAL_D RTest test(_L("Testing Picture Restorer mechanism")); LOCAL_D CTrapCleanup* TheTrapCleanup; LOCAL_D RFs TheFs; // the file server LOCAL_D RFile TheFile; // the data file @@ -392,7 +375,7 @@ // Now store the stuff again TInt error=TheContainer->iText->LoadAllPicturesNowL(); if (error==KErrNotFound) - INFO_PRINTF1(_L(" SIMULATION: Some picture data has been removed as no app could be found.")); + test.Printf(_L(" SIMULATION: Some picture data has been removed as no app could be found.")); // if (aAlwaysFailToLoad) // test(error==KErrNotFound); // else @@ -422,22 +405,22 @@ LOCAL_C void CompareRichTextL(CRichText *aDoc1,CRichText *aDoc2) // { - INFO_PRINTF1(_L("Comparing Documents")); + test.Start(_L("Comparing Documents")); TInt length; TInt num1,num2; TInt ii=0,len1,len2,pos1,pos2,oldPos; - INFO_PRINTF1(_L("Document Length")); + test.Next(_L("Document Length")); length=aDoc1->LdDocumentLength(); num2=aDoc2->LdDocumentLength(); test(length==num2); - INFO_PRINTF1(_L("Paragraph Count")); + test.Next(_L("Paragraph Count")); num1=aDoc1->ParagraphCount(); num2=aDoc2->ParagraphCount(); test(num1==num2); - INFO_PRINTF1(_L("Paragraph Lengths")); + test.Next(_L("Paragraph Lengths")); pos1=-1; oldPos=-2; while (pos1>oldPos) @@ -450,12 +433,12 @@ ii++; } - INFO_PRINTF1(_L("Word Count")); + test.Next(_L("Word Count")); num1=aDoc1->WordCount(); num2=aDoc2->WordCount(); test(num1==num2); - INFO_PRINTF1(_L("Characters")); + test.Next(_L("Characters")); TCharFormat format1,format2; TPtrC chars1,chars2; len1=1; @@ -471,7 +454,7 @@ ii+=len1; } - + test.End(); } @@ -484,20 +467,20 @@ CRichText *document=CRichText::NewL(pLayer,cLayer); TInt err; - INFO_PRINTF1(_L("Document with single Paragraph")); - INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_TRAN-0001 ")); + test.Start(_L("Document with single Paragraph")); + test.Next(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_TRAN-0001 ")); { TheContainer=CContainer::NewL(_L("z:\\test\\app-framework\\etext\\t_para.pml")); - INFO_PRINTF1(_L("Exporting a file by Para")); + test.Start(_L("Exporting a file by Para")); TFileName exportFile=KExportFileName1(); EnsureFileExists(exportFile); TRAP(err,TheContainer->iText->ExportAsTextL(exportFile,CPlainText::EOrganiseByParagraph,0)); test(err==KErrNone); - INFO_PRINTF1(_L("Importing a file by Para")); + test.Next(_L("Importing a file by Para")); document->Reset(); TInt charsImported=document->ImportTextFileL(0,exportFile,CPlainText::EOrganiseByParagraph); test(charsImported>0); - INFO_PRINTF1(_L("Comparing Result")); + test.Next(_L("Comparing Result")); TRAP(err,CompareRichTextL(TheContainer->iText,document)); test(err==KErrNone); delete TheContainer; @@ -505,13 +488,13 @@ { TheContainer=CContainer::NewL(_L("z:\\test\\app-framework\\etext\\t_para.pml")); - INFO_PRINTF1(_L("Exporting and Importing a file by Line")); - INFO_PRINTF1(_L("Line Lengths 25,30,...,95")); + test.Next(_L("Exporting and Importing a file by Line")); + test.Start(_L("Line Lengths 25,30,...,95")); TFileName exportFile=KExportFileName1(); TInt ii; for(ii=25;ii<100;ii+=5) { - INFO_PRINTF1(_L("With next line length")); + test.Next(_L("With next line length")); EnsureFileExists(exportFile); TRAP(err,TheContainer->iText->ExportAsTextL(exportFile,CPlainText::EOrganiseByLine,ii)); test(err==KErrNone); @@ -522,24 +505,24 @@ test(err==KErrNone); } delete TheContainer; - + test.End(); } - - INFO_PRINTF1(_L("Document with two Paragraphs")); + test.End(); + test.Next(_L("Document with two Paragraphs")); { TheContainer=CContainer::NewL(_L("z:\\test\\app-framework\\etext\\t_para2.pml")); - INFO_PRINTF1(_L("Exporting a file by Para")); + test.Start(_L("Exporting a file by Para")); TFileName exportFile=KExportFileName2(); EnsureFileExists(exportFile); TRAP(err,TheContainer->iText->ExportAsTextL(exportFile,CPlainText::EOrganiseByParagraph,0)); test(err==KErrNone); - INFO_PRINTF1(_L("Importing a file by Para")); + test.Next(_L("Importing a file by Para")); document->Reset(); TInt charsImported=document->ImportTextFileL(0,exportFile,CPlainText::EOrganiseByParagraph); test(charsImported>0); - INFO_PRINTF1(_L("Comparing Result")); + test.Next(_L("Comparing Result")); TRAP(err,CompareRichTextL(TheContainer->iText,document)); test(err==KErrNone); delete TheContainer; @@ -547,13 +530,13 @@ { TheContainer=CContainer::NewL(_L("z:\\test\\app-framework\\etext\\t_para.pml")); - INFO_PRINTF1(_L("Exporting and Importing a file by Line")); - INFO_PRINTF1(_L("Line Lengths 30,40,...,100")); + test.Next(_L("Exporting and Importing a file by Line")); + test.Start(_L("Line Lengths 30,40,...,100")); TFileName exportFile=KExportFileName1(); TInt ii; for(ii=30;ii<105;ii+=10) { - INFO_PRINTF1(_L("With next line length")); + test.Next(_L("With next line length")); EnsureFileExists(exportFile); TRAP(err,TheContainer->iText->ExportAsTextL(exportFile,CPlainText::EOrganiseByLine,ii)); test(err==KErrNone); @@ -564,14 +547,14 @@ test(err==KErrNone); } delete TheContainer; - + test.End(); } delete document; delete cLayer; delete pLayer; - + test.End(); } @@ -620,35 +603,29 @@ RDebug::Print(_L("Error %d connecting file session. File: %S.\n"), err, &aFullName); } } -} -CT_TRAN::CT_TRAN() +GLDEF_C TInt E32Main() +// +// Test the streaming framework. +// { - SetTestStepName(KTestStep_T_TRAN); - pTestStep = this; - } - -TVerdict CT_TRAN::doTestStepL() - { - SetTestStepResult(EFail); - INFO_PRINTF1(_L("Testing Picture Restorer mechanism")); - - __UHEAP_MARK; - T_TRAN::setupCleanup(); - TRAPD(r, T_TRAN::GoL()); + test.Title(); + + __UHEAP_MARK; + setupCleanup(); + TRAPD(r,GoL()); + test(r == KErrNone); - delete T_TRAN::TheTrapCleanup; - - __UHEAP_MARKEND; - - T_TRAN::DeleteDataFile(T_TRAN::KExportFileName1); //deletion of data files must be before call to End() - DEF047652 - T_TRAN::DeleteDataFile(T_TRAN::KExportFileName2); - - if (r == KErrNone) - { - SetTestStepResult(EPass); - } + delete TheTrapCleanup; + + __UHEAP_MARKEND; + + ::DeleteDataFile(KExportFileName1); //deletion of data files must be before call to End() - DEF047652 + ::DeleteDataFile(KExportFileName2); + + test.End(); + test.Close(); - return TestStepResult(); + return 0; }