diff -r 748ec5531811 -r 336bee5c2d35 textrendering/texthandling/ttext/T_TIMES.CPP --- a/textrendering/texthandling/ttext/T_TIMES.CPP Tue Aug 31 17:01:26 2010 +0300 +++ b/textrendering/texthandling/ttext/T_TIMES.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" @@ -16,29 +16,11 @@ */ +#include #include #include #include -#include "T_TIMES.h" - -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)) - /* this fixes a MSVC link warning */ #ifdef __VC32__ @@ -73,6 +55,7 @@ LOCAL_D CTrapCleanup* TheTrapCleanup; +LOCAL_D RTest test(_L("CRichText Document")); LOCAL_D CGlobalText* TheText; LOCAL_D CParaFormatLayer* TheParaFormatLayer; LOCAL_D CCharFormatLayer* TheCharFormatLayer; @@ -173,23 +156,23 @@ TInt wordCount=TheText->WordCount(); TBuf<80> stats; stats.Format(_L("Document Stats:\nChars: %d\nWords: %d\nParas: %d\n"),documentLength,wordCount,paraCount); - INFO_PRINTF1(stats); + test.Printf(stats); RDebug::Print(_L("%S"),&stats); TBuf<80> testTitle; // testTitle.Format(_L("Pos: 0-100 %d times"),aTest1Count); - INFO_PRINTF1(testTitle); + test.Start(testTitle); GetTimesForGetChars(aTest1Count,0,100,50); // testTitle.Format(_L("Pos: 18200-18300 %d times"),aTest2Count); - INFO_PRINTF1(testTitle); + test.Next(testTitle); GetTimesForGetChars(aTest2Count,18200,100,50); // testTitle.Format(_L("Pos: all %d times"),aTest3Count); - INFO_PRINTF1(testTitle); + test.Next(testTitle); GetTimesForGetChars(aTest3Count,0,documentLength,50); // - + test.End(); } @@ -210,7 +193,7 @@ // Display the metric TBuf<60> context; context.Format(_L("10 att X %d loops=%d atts\n"),aLoopCount,10*aLoopCount); - INFO_PRINTF1(context); + test.Printf(context); RDebug::Print(_L("%S"),&context); } @@ -239,21 +222,21 @@ // Time tests on format layer access. // { - INFO_PRINTF1(_L("CCharFormatLayer - Attribute reads")); + test.Start(_L("CCharFormatLayer - Attribute reads")); GenerateGlobalLayersL(); // TBuf<80> testTitle; testTitle.Format(_L("Reading empty char format layer %d times"),KCharFormatLayerTest); - INFO_PRINTF1(testTitle); + test.Next(testTitle); DoEmptyCharFormatLayerReadL(KCharFormatLayerTest); // testTitle.Format(_L("Read 10 attributes from layer %d times"),KCharFormatLayerTest); - INFO_PRINTF1(testTitle); + test.Next(testTitle); TRAPD(ret, DoCharFormatLayerReadL(KCharFormatLayerTest)); test(ret==KErrNone); // KillGlobalLayers(); - + test.End(); } @@ -261,18 +244,18 @@ // { // - INFO_PRINTF1(_L("Global text - Empty layers")); + test.Start(_L("Global text - Empty layers")); GenerateGlobalTextL(); DoLongDocumentTestL(KGlobalTextATest1,KGlobalTextATest2,KGlobalTextATest3); KillText(); // - INFO_PRINTF1(_L("Rich text - Empty layers")); + test.Next(_L("Rich text - Empty layers")); GenerateBasicRichTextL(); DoLongDocumentTestL(KRichTextTest1,KRichTextTest2,KRichTextTest3); KillText(); KillGlobalLayers(); // - INFO_PRINTF1(_L("Global text - 2 character attributes stored")); + test.Next(_L("Global text - 2 character attributes stored")); GenerateGlobalTextL(); TBuf<5> name=_L("SWiss"); TCharFormat charFormat(name,178); @@ -285,23 +268,23 @@ DoLongDocumentTestL(KGlobalTextBTest1,KGlobalTextBTest2,KGlobalTextBTest3); KillText(); // - INFO_PRINTF1(_L("Rich text - 2 charcter attributes stored")); + test.Next(_L("Rich text - 2 charcter attributes stored")); GenerateBasicRichTextL(); DoLongDocumentTestL(KRichTextTest1,KRichTextTest2,KRichTextTest3); KillText(); // KillGlobalLayers(); - + test.End(); } LOCAL_C void DoTestsL() // { - INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_TIMES-0001 Long document tests ")); + test.Start(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_TIMES-0001 Long document tests ")); LongDocumentTestL(); // - INFO_PRINTF1(_L("Format layer tests")); + test.Next(_L("Format layer tests")); FormatLayerTestL(); // } @@ -323,29 +306,23 @@ }); } -CT_TIMES::CT_TIMES() - { - SetTestStepName(KTestStep_T_TIMES); - pTestStep = this; - } -TVerdict CT_TIMES::doTestStepL() - { - SetTestStepResult(EFail); - setupCleanup(); - INFO_PRINTF1(_L("CRichText Document")); - __UHEAP_MARK; - - TRAPD(ret,DoTestsL()); - - __UHEAP_MARKEND; - delete TheTrapCleanup; - - if (ret == KErrNone) - { - SetTestStepResult(EPass); - } - - return TestStepResult(); +GLDEF_C TInt E32Main() +// +// Test the Document Model Services. +// + { + setupCleanup(); + test.Title(); + __UHEAP_MARK; + + TRAPD(ret,DoTestsL()); + test(ret == KErrNone); + + test.End(); + test.Close(); + __UHEAP_MARKEND; + delete TheTrapCleanup; + return(0); }